code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from typing import Tuple, cast
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
from pants.backend.python.target_types import ConsoleScript
from pants.option.cu... | benjyw/pants | src/python/pants/backend/python/lint/docformatter/subsystem.py | Python | apache-2.0 | 1,612 |
#!/usr/bin/env python
from distutils.core import setup
setup(name = "ciscotropo-webapi-python",
version = "0.1.4",
url = "http://github.com/tropo/tropo-webapi-python",
maintainer = "Cisco",
maintainer_email = "support@tropo.com",
description ... | tropo/tropo-webapi-python | setup.py | Python | mit | 962 |
#-*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Nicolas Bessi (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers who... | VitalPet/c2c-rd-addons | report_crm_helpdesk/report/__init__.py | Python | agpl-3.0 | 1,440 |
# Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | Yangqing/caffe2 | caffe2/python/modeling/compute_statistics_for_blobs.py | Python | apache-2.0 | 2,626 |
# -*- coding: utf-8 -*-
'''需求管理接口
@author: Gao Le
'''
from flask import jsonify, request, abort, Blueprint
from model import demand
from model.db import Demand
from flask_jwt_extended import (fresh_jwt_required)
from marshmallow import Schema, fields
from rbac.context import PermissionDenied
from playhouse.shortcuts... | WX-DongXing/pms | api/controller/demand.py | Python | mit | 2,948 |
"""Simple models to track information related to a particular job/posting."""
import logging
from future.utils import python_2_unicode_compatible
from model_utils.models import TimeStampedModel, SoftDeletableModel
from model_utils.managers import SoftDeletableManager
from nltk import bigrams
from taggit.managers impo... | ScorpionResponse/freelancefinder | freelancefinder/jobs/models.py | Python | bsd-3-clause | 6,966 |
#!/usr/bin/env python3
## Copyright (C) 2020 David Miguel Susano Pinto <carandraug@gmail.com>
##
## This file is part of Microscope.
##
## Microscope 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 v... | carandraug/microscope | microscope/mirror/bmc.py | Python | gpl-3.0 | 2,295 |
#!/usr/bin/env python
#
# Copyright 2013 Philip Tricca <flihp@twobit.us>
#
import base64
import hashlib
import sys
# /* default policy */
# static const tb_policy_t _def_policy = {
# version : 2,
# policy_type : TB_POLTYPE_CONT_NON_FATAL,
# policy_control : TB_POLCTL_EXTEND_PCR17,
# num_entr... | flihp/pcr-calc | bin/pcr-static.py | Python | gpl-2.0 | 4,825 |
"""
CSV Parameters class
"""
from re import search, split
from .utils import lines_to_csv, has_duplicates, remove_backslashes, grouped
from .exceptions import DslSyntaxError, ValidationError
from .constants import IDENTIFIER_REGEX
class TableParameters:
def __init__(self, lines):
self.__validate_lines(... | sbsmirnoff/templie | src/templie/table_parameters.py | Python | mit | 2,260 |
# ------------------------------------------------------------------------
# This block checks to see if the script is being run directly,
# i.e. through the command line. If it is, then it stops and exits the
# program, asking the user to use these files by running the main.py
# --------------------------------------... | proflayton/iPerfParser | ParserStructure/SpeedTestDataStructure.py | Python | mit | 41,657 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Firestarter binary.
@author: Tobias Hunger <tobias.hunger@gmail.com>
"""
from cleanroom.firestarter.installtarget import InstallTarget
from cleanroom.firestarter.containerfsinstalltarget import (
ContainerFilesystemInstallTarget,
)
from cleanroom.firestarter.copy... | hunger/cleanroom | cleanroom/firestarter/main.py | Python | gpl-3.0 | 4,267 |
"""Config flow for flo integration."""
from aioflo import async_get_api
from aioflo.errors import RequestError
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers.aiohttp_client import async_get_clie... | lukas-hetzenecker/home-assistant | homeassistant/components/flo/config_flow.py | Python | apache-2.0 | 2,046 |
import traceback
import inspect
# todo features:
# prints the arguments to each function
def stack():
#traceback.print_stack()
format_inspect_stack(inspect.stack())
frame = inspect.currentframe()
print inspect.getargvalues(frame)
def format_inspect_stack(inspect_stack, context=2):
for frame, file... | liyanchang/pancakes | pancakes.py | Python | mit | 2,053 |
# Copyright (c) 2015, Scott J Maddox. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file.
import os
import sys
fpath = os.path.join(os.path.dirname(__file__), '../fdint/_dgfd.pyx')
templates_dir = os.path.join(os.path.dirname(__file__), 'templa... | scott-maddox/fdint | scripts/gen__dgfd_pyx.py | Python | bsd-3-clause | 5,668 |
# 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_06_01/models/subnet_paged.py | Python | mit | 922 |
# -*- coding: utf-8 -*-
"""
Содержит функции общего назначения
"""
__author__ = 'max'
import os
import random
import string
import traceback
from callfeed.settings import MEDIA_ROOT, MEDIA_URL, BASE_URL
MIN_MEDIA_FILENAME_LENGTH, MAX_MEDIA_FILENAME_LENGTH = 6, 10
def rand_string(length=16):
# default length = 1... | vesellov/callfeed.net | mainapp/utils/common.py | Python | mit | 1,686 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
COHORTE JSON configuration file reader.
Parses JSON files and handles "import-files" and "from-file" special fields.
:author: Thomas Calmant
:license: Apache Software License 2.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Versi... | isandlaTech/cohorte-devtools | org.cohorte.eclipse.runner.basic/files/test/cohorte/config/reader.py | Python | apache-2.0 | 11,536 |
#!/usr/bin/env python
# import csv
# import titlecase
from elasticsearch import Elasticsearch
from app import app
# PATH_FILE = 'data/dict_financial_accounting.csv'
# PATH_FILE = 'data/dict_economics.csv'
# PATH_FILE = 'data/dict_accounting.csv'
# PATH_FILE = 'data/dict_digital-marketing-terms.csv'
# PATH_FILE = 'da... | tranhuucuong91/simple-notebooks | app/routes/load_data.py | Python | mit | 4,200 |
# ______________________________________________________________________________
# GUI - Graphical User Interface for Environments
# If you do not have Tkinter installed, either get a new installation of Python
# (Tkinter is standard in all new releases), or delete the rest of this file
# and muddle through without a G... | armadill-odyssey/aima-python | envgui.py | Python | mit | 11,683 |
class ContactHelper:
def __init__(self, app):
self.app = app
def create(self, contact):
wd = self.app.wd
# init contact creation
wd.find_element_by_link_text("add new").click()
# fill contact form
wd.find_element_by_name("firstname").click()
wd.find_elem... | LenaNaum4ik/python_training | fixture/contact.py | Python | apache-2.0 | 9,413 |
#!/usr/bin/env python
import pymongo
import sys
c = pymongo.MongoClient(host=["mongodb://localhost:27017",
"mongodb://localhost:27018",
"mongodb://localhost:27019"],
replicaSet="rs1",
w=1, j=True)
db = c.m101... | baocongchen/M101P-MONGODB-FOR-PYTHON-DEVELOPERS | week6/pymongo_to_replicaset.py | Python | mit | 719 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-11-19 12:49
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('battle', '0001_initial'),
]
oper... | jardiacaj/finem_imperii | unit/migrations/0001_initial.py | Python | agpl-3.0 | 2,152 |
#!/cygdrive/e/workspaces/Django_React_Tutorial/02-djreact-owais/myvenv/bin/python3
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| KyoungRan/Django_React_ex | 02-djreact-owais/myvenv/bin/django-admin.py | Python | mit | 189 |
# Copyright (c) 2015 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | tonytan4ever/canary | canary/tasks/taskflow/services.py | Python | apache-2.0 | 3,133 |
# Copyright 2015 Allen Institute for Brain Science
# This file is part of Allen SDK.
#
# Allen SDK 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, version 3 of the License.
#
# Allen SDK is distributed in the ... | wvangeit/AllenSDK | allensdk/api/queries/tree_search_api.py | Python | gpl-3.0 | 2,548 |
from django.conf.urls import include, url
from web.forms import WishlistAuthenticationForm
from django.contrib.auth.views import (
login, logout, password_change, password_change_done
)
from web import views
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^accounts/login', login,
... | honza/wishlist-app | wishlist/urls.py | Python | bsd-2-clause | 1,929 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... | SKIRT/PTS | magic/tests/Sky/config.py | Python | agpl-3.0 | 2,354 |
"""
Iceland specific form helpers.
"""
from django.newforms import ValidationError
from django.newforms.fields import RegexField, EMPTY_VALUES
from django.newforms.widgets import Select
from django.utils.translation import ugettext
from django.utils.encoding import smart_unicode
class ISIdNumberField(RegexField):
... | rawwell/django | django/contrib/localflavor/is_/forms.py | Python | bsd-3-clause | 2,685 |
from collections import OrderedDict
from string import Formatter
from django.db import DEFAULT_DB_ALIAS, connections
from .base import ALPHANUM, ALPHANUM_LEN
class Arg:
pattern = '%{position}${format_type}'
format_types = ('I', 'L', 's')
def __init__(self, position):
self.position = position
... | BertrandBordage/django-tree | tree/sql/postgresql.py | Python | bsd-3-clause | 14,028 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... | wbsoft/frescobaldi | frescobaldi_app/preferences/tools.py | Python | gpl-2.0 | 10,518 |
__VERSION__ = '1.2.3'
| consbio/ncdjango | ncdjango/__init__.py | Python | bsd-3-clause | 22 |
# -------------------------------------------------------------
#
# 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/tests/federated/test_federated_matrix_mult.py | Python | apache-2.0 | 10,626 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... | yunfanz/ReionBub | save_animation.py | Python | mit | 3,420 |
from flow_workflow.future_operation import NullFutureOperation
from flow_workflow.parallel_id import ParallelIdentifier
from lxml import etree
import mock
import unittest
from flow_workflow.entities.workflow.adapters import WorkflowAdapter
from flow_workflow.entities.workflow.future_nets import WorkflowNet
VALID_XML... | genome/flow-workflow | unit_tests/entities/workflow/test_adapters.py | Python | agpl-3.0 | 2,783 |
import gtk
import common.Config as Config
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.toggletoolbutton import ToggleToolButton
from sugar.graphics.radiotoolbutton import RadioToolButton
from gettext import gettext as _
def main_toolbar_common(toolbar, synthLab):
def _button_factory(... | godiard/tamtam | SynthLab/SynthLabToolbars.py | Python | gpl-2.0 | 7,125 |
#!python
'''Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptool... | tsnaomi/finnsyll | ez_setup.py | Python | bsd-2-clause | 11,878 |
class Media(Widget):
def setSrc(self, src):
print "setSrc", src
obj = self.getElement()
DOM.setAttribute(obj, "URL", src)
def setControls(self, controls):
print "setControls", controls
self.ctrlparam = DOM.createElement("PARAM")
DOM.setAttribute(self.ctrlparam,... | minghuascode/pyj | library/pyjamas/media/Media.ie6.py | Python | apache-2.0 | 1,553 |
from nose2.tools import such
import logging
from .common import UniqueResource, NormalTest, NormalTestTwo
log = logging.getLogger(__name__)
class Layer1(object):
description = 'Layer1'
@classmethod
def setUp(cls):
log.info("Called setup in layer 1")
it.unique_resource = UniqueResource()
... | little-dude/nose2 | nose2/tests/functional/support/scenario/layers_and_non_layers/test_such_with_uses_decorator.py | Python | bsd-2-clause | 1,067 |
from django.contrib.auth.models import User, Group
from django.db.models import Q
from django.http import Http404
from django.shortcuts import get_object_or_404
from models import Cred, CredChangeQ, Tag
# TODO: Move this to a ModelManager
def cred_search(user, cfilter='special', value='all', sortdir='ascending', sor... | ipernet/RatticWeb | cred/search.py | Python | gpl-2.0 | 2,541 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | xhorn/xchorizon | horizon/forms/base.py | Python | apache-2.0 | 3,882 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import fields, models, api
import re
... | adrianpaesani/odoo-argentina | l10n_ar_invoice/models/partner.py | Python | agpl-3.0 | 1,597 |
"""empty message
Revision ID: 2357b6b3d76
Revises: fecca96b9d
Create Date: 2015-10-27 10:26:52.074526
"""
# revision identifiers, used by Alembic.
revision = '2357b6b3d76'
down_revision = 'fecca96b9d'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please... | codeforamerica/comport | migrations/versions/2357b6b3d76_.py | Python | bsd-3-clause | 794 |
"""
WSGI config for keyformproject 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/dev/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | mostateresnet/keyformproject | keyformproject/wsgi.py | Python | mit | 405 |
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import QUrl
from PyQt5.QtNetwork import QNetworkRequest
from chat._avatarWidget import AvatarWidget
import time
from urllib import parse
from fa.replay import replay
from fa import maps
import util
from config import Settings
from model.game import GameSta... | GrotheFAF/client | src/chat/chatter.py | Python | gpl-3.0 | 20,871 |
import _plotly_utils.basevalidators
class TickcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="tickcolor", parent_name="contour.colorbar", **kwargs
):
super(TickcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_... | plotly/plotly.py | packages/python/plotly/plotly/validators/contour/colorbar/_tickcolor.py | Python | mit | 429 |
import mwclient.listing
import mwclient.page
class Image(mwclient.page.Page):
def __init__(self, site, name, info=None):
super(Image, self).__init__(site, name, info,
extra_properties={'imageinfo': (('iiprop', 'timestamp|user|comment|url|size|sha1|metadata|archivename'... | ubibene/mwclient | mwclient/image.py | Python | mit | 2,640 |
print 1 + 2
print 1 + 3.5
print -1 + 2.5
print 100 - 45
print -1.1 + 5
print 3 * 2
print 3.5 * 1.5
print 3 / 2
print 4 / 2
print 3 // 2
print -3 // 2
print 9 % 2
print 2 ** 2
print 2 ** 10
print 1 ** 10
print 8 ** (1/3)
print 5 + 5 * 5
print (5 + 5) * 5
a = 3
print a + 1
a = 5
print a + 1
print type(3)
print type(3.5)
... | belenox/dmwp | Chap1.py | Python | unlicense | 3,188 |
from xml.etree import cElementTree as ElementTree
from django.http import HttpResponse
from tastypie.authentication import Authentication
from tastypie.authorization import Authorization
from tastypie.resources import Resource
from tastypie.serializers import Serializer
from tastypie.throttle import CacheThrottle
from... | dimagi/commcare-hq | corehq/messaging/smsbackends/grapevine/models.py | Python | bsd-3-clause | 8,527 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... | xclxxl414/rqalpha | rqalpha/utils/package_helper.py | Python | apache-2.0 | 953 |
from pyvisdk.esxcli.executer import execute_soap
from pyvisdk.esxcli.base import Base
class NetworkFirewallRuleset(Base):
'''
Commands to list and update firewall ruleset configuration
'''
moid = 'ha-cli-handler-network-firewall-ruleset'
def set(self, rulesetid, allowedall=None, enabled=None):
... | xuru/pyvisdk | pyvisdk/esxcli/handlers/ha_cli_handler_network_firewall_ruleset.py | Python | mit | 1,411 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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',
... | photoninger/ansible | lib/ansible/modules/cloud/digital_ocean/digital_ocean_domain.py | Python | gpl-3.0 | 6,364 |
# 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 use ... | tmgstevens/flume | flume-ng-doc/sphinx/conf.py | Python | apache-2.0 | 3,274 |
"""Trace module."""
import os
TRACE_SOW_DIR = os.path.join('.sow', 'trace')
| ThoughtWorksInc/treadmill | treadmill/apptrace/__init__.py | Python | apache-2.0 | 83 |
from django import template
from django.contrib.auth.models import User
from ..forms import UserCreateForm
register = template.Library()
@register.inclusion_tag('registration/_signup.html')
def signup_form():
return {'form': UserCreateForm(instance=User())}
| rwblair/cogat | cognitive/apps/users/templatetags/user_auth.py | Python | mit | 265 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012 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-... | paulftw/titan-files | tests/files/files_test.py | Python | apache-2.0 | 48,480 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'jinyang'
from PIL import Image
import glob
def reSize(dirPath, sizeX = 100, sizeY = 100):
for file in glob.glob(dirPath + '*.jpg'):
print file
ori = Image.open(file)
modi = ori.resize((sizeX, sizeY))
#modi.save(os.path.sp... | luoxufeiyan/python | ailurus1991/0005/main.py | Python | mit | 416 |
# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2019 Olof-Joachim Frahm <olof@macrolet.net> #
# ... | mgorny/PyGithub | tests/PullRequest1169.py | Python | lgpl-3.0 | 2,150 |
"""
Module. Includes classes for 1D longidutinal space charge accelerator nodes.
"""
import sys
import os
import math
# import the function that finalizes the execution
from orbit.utils import orbitFinalize
# import physical constants
from orbit.utils import consts
# import general accelerator elements and lattice
... | PyORBIT-Collaboration/py-orbit | py/orbit/space_charge/sc1d/sc1DNode.py | Python | mit | 9,613 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('videoclases', '0013_tarea_profesor'),
]
operations = [
migrations.AddField(
model_name='grupo',
name... | Videoclases/videoclases | videoclases/migrations/0014_auto_20150726_1441.py | Python | gpl-3.0 | 975 |
from Tkinter import *
import icmpfltr
class icmpfltcnsl:
def show(self,mainfrm):
txtfont=("FreeSerif", 11,"bold")
icmpfltfrm=Frame(mainfrm,relief=SOLID,borderwidth=1,bg="white")
#---------------Information text for ICMP console--------------------------
icmpflttxtfrm=Frame(icmpfltfrm,relief=SOLID,borderwid... | d4rkl0rd3r3b05/Firewall | Firewall/icmpconsole.py | Python | mit | 5,051 |
import os
import unittest
from vsg.rules import signal
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_012_test_input.vhd'))
lExpected = []
lExpected.append('')
utils.read_file(os.path.join(sTestDir, '... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/signal/test_rule_012.py | Python | gpl-3.0 | 1,200 |
from __future__ import print_function, division
from argparse import Namespace
from random import randint
import myhdl
from myhdl import instance, delay, StopSimulation
from rhea import Clock, Reset, Global
from rhea.system import Wishbone
from rhea.cores.sdram import SDRAMInterface
from rhea.cores.sdram import sd... | cfelton/rhea | test/test_cores/test_sdram/test_sdram.py | Python | mit | 3,406 |
import os
import json
import logging
import settings
import json
import urlparse
import HTMLParser
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render, render_to_response
from django.template import RequestContext
from django.core.urlresolvers import reverse
from rout... | raysaavedra/open-route | route/views.py | Python | gpl-3.0 | 3,015 |
"""Layout for inline-level boxes."""
import unicodedata
from math import inf
from ..css import computed_from_cascaded
from ..css.computed_values import ex_ratio, strut_layout
from ..formatting_structure import boxes
from ..text.line_break import can_break_text, create_layout, split_first_line
from .absolute import Ab... | Kozea/WeasyPrint | weasyprint/layout/inline.py | Python | bsd-3-clause | 49,000 |
class Square(object):
def __init__(self, l, w):
self.l = l
self.w = w
def area(self):
return self.l * self.w
def __lt__(self, other):
if isinstance('Triangle', other):
return self.area() < other.area()
class Triangle(object):
def __init__(self, b, h):
... | irawoodring/343 | operator_overloading/code_samples/Square.py | Python | gpl-3.0 | 479 |
'''
Evaluates whether a date-time string conforms to
the DateRangeField specification of SOLR 5.4.
See https://cwiki.apache.org/confluence/display/solr/Working+with+Dates
Notes on its interpretation:
+ Points in time, i.e. not truncated or "implicit" ranges
have to end with character "Z", indicating UTC.
+ "hh"... | eawag-rdm/daterange | validate_solr_daterange.py | Python | agpl-3.0 | 3,557 |
import numpy as np
import pandas
from ulmo import util
from ulmo.ncdc import ghcn_daily
import test_util
test_stations = [
{
'country': 'US',
'elevation': 286.5,
'gsn_flag': 'GSN',
'hcn_flag': 'HCN',
'id': 'USW00003870',
'latitude': 34.8831,
'longitude': -... | nathanhilbert/ulmo | test/ghcn_daily_test.py | Python | bsd-3-clause | 9,404 |
#!/usr/bin/python
#
# dta_withcov.py runs Dynamic Tensor Decomposition (DTA: Dynamic Tensor Analysis). Given the input tensor, incrementally update the tensor decomposition. This operation requires the covariance matrices of the input tensor, which are computed by comp_cov_dense.py, comp_cov_sparse.py, or comp_cov_comp... | Peratham/TensorDB | tensordb_pkg/algorithms/dta_withcov.py | Python | agpl-3.0 | 8,446 |
import zope.interface
import zope.schema
class ICharKeyPressEvent(zope.interface.Interface):
"""An adapter providing different views for the application
depending on the user input.
"""
key = zope.interface.Attribute(
"The name of the key pressed.")
class IFunctionKeyPressEvent(ICharKeyP... | romanofski/superorganism | src/superorganism/gui/interfaces.py | Python | gpl-3.0 | 3,845 |
import uuid
from boto.swf.exceptions import SWFResponseError
from boto.swf.layer1 import Layer1
from flowy import logger, posint_or_none, str_or_none
from flowy.task import serialize_args
class WorkflowStarter(object):
def __init__(self, domain, name, version,
task_list=None,
d... | severb/flowy-website | flowy_module/flowy/swf/starter.py | Python | mit | 1,953 |
from django.db import models
from uuid import uuid4
def get_short_uuid():
return str(uuid4())[0:5]
class Code(models.Model):
key = models.CharField(max_length=6, primary_key=True, default=get_short_uuid)
lang = models.CharField(max_length=32, default='bash')
code = models.TextField(max_length=2048, he... | octomike/hellodjango | paste/models.py | Python | mit | 341 |
# -*- 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 'SourceFile.last_modified'
db.add_column(u'ide_sourcefile'... | pebble/cloudpebble | ide/migrations/0017_auto__add_field_sourcefile_last_modified.py | Python | mit | 11,738 |
# -*- coding: utf-8 -*-
# Scrapy settings for aCloudGuru 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.org/en/lat... | miztiik/scrapy-Demos | aCloudGuru/aCloudGuru/settings.py | Python | mit | 3,160 |
import random
import string
from ..models import GoogleUser
class GoogleBackend:
def authenticate(self, google_user):
if google_user is None:
return None
try:
return GoogleUser.objects.get(user_id=google_user.user_id())
except GoogleUser.DoesNotExist:
... | DeMille/emailhooks | emailhooks/backends/google.py | Python | mit | 818 |
from __future__ import unicode_literals
import xml.etree.ElementTree
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
)
from ..compat import compat_HTTPError
class BBCCoUkIE(InfoExtractor):
IE_NAME = 'bbc.co.uk'
IE_DESC = 'BBC iPlayer'
_VALID_URL = r'https?://... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/bbccouk.py | Python | unlicense | 15,797 |
import datetime
import logging
from flask import Blueprint, abort
from flask.ext.restful import reqparse
from sqlalchemy import func, and_
from flask.ext import restful
from model.token import Token
blueprint = Blueprint('velov-companion-api', __name__)
api = restful.Api(blueprint, prefix="/api")
def verify_auth():... | hexa4313/velov-companion-server | api/app/route/base.py | Python | mit | 784 |
from PySide import QtGui, QtCore
from PySide.QtCore import (Qt, QThread, QObject, Slot, Signal)
from PySide.QtGui import (
QMainWindow, QPushButton, QApplication, QPainter, QFont
)
from multiprocessing import Queue
from threading import Barrier
import LNcommon
import LNdigitalIO
from .LN_Digital_Emulator_ui import... | LeMaker/LN_Digital_Emulator | LN_Digital_Emulator/gui.py | Python | gpl-3.0 | 24,519 |
# server.py
from flask import Flask, flash, redirect, render_template, request, session, abort, jsonify
#from oAuth import *
import datetime
import os
import auto_email
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Table, Column, Integer, String, create_engine, Sequence, ForeignKey
from... | NordicSHIFT/NordicSHIFT | app/server/app.py | Python | mit | 26,652 |
import pytest
import time
from cfme.configure.configuration.region_settings import RedHatUpdates
from cfme.utils import conf, version
from cfme.utils.conf import cfme_data
from cfme.utils.blockers import BZ
from cfme.utils.log import logger
from cfme.utils.testgen import parametrize
from cfme.utils.wait import wait_fo... | quarckster/cfme_tests | cfme/tests/configure/test_register_appliance.py | Python | gpl-2.0 | 7,641 |
# Copyright 2017, Xavier Snelgrove
import argparse
import os
import sys
import numpy as np
from scipy import ndimage
import gram
from gram import JoinMode
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Synthesize image from texture", formatter_class=argparse.ArgumentDefaultsHelpFormatter)... | wxs/subjective-functions | synthesize.py | Python | mit | 7,775 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 t... | mail-apps/translate | translate/storage/symbian.py | Python | gpl-2.0 | 2,257 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyBasisSetExchange(PythonPackage):
"""Command-line interface for the Basis Set Exchange We... | LLNL/spack | var/spack/repos/builtin/packages/py-basis-set-exchange/package.py | Python | lgpl-2.1 | 1,691 |
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 16, D-... | openwns/wrowser | openwns/wrowser/Configuration.py | Python | gpl-2.0 | 7,768 |
# Authors: Eric Larson <larson.eric.d@gmail.com>
# Sheraz Khan <sheraz@khansheraz.com>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from ..filter import next_fast_len
from ..source_estimate import _BaseSourceEstimate
from ..utils import verbose, _check_c... | kambysese/mne-python | mne/connectivity/envelope.py | Python | bsd-3-clause | 6,302 |
import re
import urllib
from json import JSONDecoder
from datetime import datetime
from de.generia.kodi.plugin.backend.zdf.Regex import getAttrPattern
from de.generia.kodi.plugin.backend.zdf.Teaser import Teaser
teaserXhrUrlAttrPattern = getAttrPattern("data-teaser-xhr-url")
class TeaserLazyload(object):
url = ... | generia/plugin.video.zdf_de_2016 | de/generia/kodi/plugin/backend/zdf/TeaserLazyload.py | Python | gpl-2.0 | 1,066 |
from ..dataset.arff import ArffFile
from scipy.spatial import kdtree, distance
from ..representations.intervalsProbability import IntervalsProbability
import numpy as np
from math import exp
class IPKNN(object):
"""IPKNN implements a K-nearest neighbour method using lower previsions.
If data are all preci... | sdestercke/classifip | classifip/models/knn.py | Python | gpl-2.0 | 5,129 |
from django.contrib import admin
from .models import TeacherMessage, CourseInfo
# Register your models here.
admin.site.register(TeacherMessage)
admin.site.register(CourseInfo)
| MerleLK/StudentSystem | teacher/admin.py | Python | gpl-3.0 | 178 |
#!/usr/bin/env python
# encoding: utf-8
"""
Created by laramies on 2008-08-21.
"""
import sys
import socket
class Checker():
def __init__(self, hosts):
self.hosts = hosts
self.realhosts=[]
def check(self):
for x in self.hosts:
try:
res=socket.gethostbyname(x)
self.realhosts.append(res+":"+x)
... | WesternCyber/Hacking-Tools | the-harvester/theHarvester/lib/hostchecker.py | Python | gpl-3.0 | 377 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
imp... | kslundberg/pants | tests/python/pants_test/util/test_eval.py | Python | apache-2.0 | 1,392 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2017 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | sergiusens/snapcraft | tests/unit/commands/test_list_keys.py | Python | gpl-3.0 | 4,386 |
import xml.sax
import unittest
import test_utils
import xmlreader
import os
path = os.path.dirname(os.path.abspath(__file__) )
class XmlReaderTestCase(unittest.TestCase):
def test_XmlDumpAllRevs(self):
pages = [r for r in xmlreader.XmlDump(path + "/data/article-pear.xml", allrevisions=True).parse()]
... | races1986/SafeLanguage | CEM/tests/test_xmlreader.py | Python | epl-1.0 | 1,809 |
# Plugin by GhettoWizard and Scaevolus
import re
from util import hook
from util import http
@hook.command('dictionary')
@hook.command
def define(inp):
"define <word> -- Fetches definition of <word>."
url = 'http://ninjawords.com/'
h = http.get_html(url + http.quote_plus(inp))
definition = h.xpath(... | ihatevim/spotbot | plugins/dictionary.py | Python | gpl-3.0 | 2,471 |
#!/usr/bin/python
import os
import psycopg2
import sys
file = open("/home/" + os.getlogin() + "/.pgpass", "r")
pgpasses = []
for line in file:
pgpasses.append(line.rstrip("\n").split(":"))
file.close()
for pgpass in pgpasses:
#print str(pgpass)
if pgpass[0] == "54.236.235.110" and pgpass[3] == "geonode":
sr... | DOE-NEPA/geonode_2.0_to_2.4_migration | migrate_account_accountdeletion.py | Python | gpl-2.0 | 1,536 |
# encoding:UTF-8
__author__ = 'Hope6537'
import mysql.connector
conn = mysql.connector.connect(user='root', password='*****', database='test', use_unicode=True)
# 获得一个链接实例
cursor = conn.cursor()
# cursor.execute('create table user (id varchar(20) primary key, name varchar(20))')
# MySQL的占位符是%s而不是?
# cursor.execute('i... | Hope6537/hope-tactical-equipment | hope-note-module/hope-python-2.7-note/MySQLChapter20.py | Python | apache-2.0 | 640 |
# 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 os
import unittest
from telemetry import test
from telemetry.core import util
from telemetry.core.platform import mac_platform_backend... | patrickm/chromium.src | tools/telemetry/telemetry/core/platform/power_monitor/powermetrics_power_monitor_unittest.py | Python | bsd-3-clause | 2,670 |
#! /usr/bin/python
# vim: set et ts=4 sw=4 fdm=marker
import curses
import curses.ascii
import sys
import time
import signal
CURSES_ERR=-1
curses.KEY_SDOWN=-2
curses.KEY_SUP=-3
curses.KEY_CRIGHT=-4
curses.KEY_CLEFT=-5
curses.KEY_CTRL_C=-6
curses.KEY_CTRL_V=-7
curses.KEY_CDOWN=-8
curses.KEY_CUP=-9
def db():
curses... | jhogan/pywid | widgets.py | Python | gpl-2.0 | 68,088 |
#!/usr/bin/python
"""
Mr Freeze
A simple Python-based backup script to make sure your websites are kept on ice (aka, backed up).
"""
import os
import imp
import time
import glob
import logging
import smtplib
import argparse
import subprocess
logger = logging.getLogger('mr_freeze')
def snapshot(interval, site, settin... | zimventures/MrFreeze | freeze.py | Python | mit | 9,716 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
try:
from setuptools import setup, find_packages
except:
from distutils.core import setup, find_packages
setup(
name='dap2rpm',
version='0.1.11',
description='Generate RPM specfile for DevAssistant DAP packages',
long_description=''.join(open('REA... | devassistant/dap2rpm | setup.py | Python | gpl-2.0 | 1,041 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import wrtprices.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Brand',
fields=[
('name... | rooterkyberian/wrtweb | wrtprices/migrations/0001_initial.py | Python | gpl-2.0 | 3,122 |
import urllib, urllib2, sys, httplib
url = "/MELA/REST_WS"
#HOST_IP="128.130.172.191:8180"
newName="EventProcessingTopology_STRATEGY_MELA_COST_RECOMMENDATION_EFFICIENCY_Larger_VMs"
HOST_IP="localhost:8480"
if __name__=='__main__':
connection = httplib.HTTPConnection(HOST_IP)
description_file = open("./2... | tuwiendsg/MELA | MELA-Extensions/MELA-ComplexCostEvaluationService/tests/mela-clients/emulateCost.py | Python | apache-2.0 | 719 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.