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 |
|---|---|---|---|---|---|
### The MIT License (MIT)
###
### Copyright (c) 2014 (c) Andrew Sichevoi, http://thekondor.net
###
### Permission is hereby granted, free of charge, to any person obtaining a copy
### of this software and associated documentation files (the "Software"), to deal
### in the Software without restriction, including without... | thekondor/p4-identify | test_workspace.py | Python | mit | 3,960 |
# Copyright (c) 2012 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.
class Code(object):
"""A convenience object for constructing code.
Logically each object should be a block of code. All methods except |Render|
an... | mou4e/zirconium | tools/json_schema_compiler/code.py | Python | bsd-3-clause | 6,405 |
"""An asynchronous web server
It doesn't use asyncore / asynchat to make things easier to understand
(hopefully)
Every time a client connects to the server, the server creates
an object which will manage the dialog with the client :
read what the client has sent, write the response, then close the
connection
An asy... | jhjguxin/PyCDC | Karrigell-2.3.5/databases/buzhug/SimpleAsyncHTTPServer.py | Python | gpl-3.0 | 12,405 |
# Copyright (C) 2003-2005 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | liyongyue/dnsspider | tests/tokenizer.py | Python | isc | 6,358 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# url_read.py file is part of slpkg.
# Copyright 2014-2021 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redis... | dslackw/slpkg | slpkg/url_read.py | Python | gpl-3.0 | 1,692 |
import pytest
from nextgisweb import db
from nextgisweb.models import DBSession
from nextgisweb.core.exception import ValidationError
from nextgisweb.spatial_ref_sys.models import (
SRS, SRID_LOCAL,
WKT_EPSG_4326, WKT_EPSG_3857,
BOUNDS_EPSG_3857, BOUNDS_EPSG_4326)
WKT_EPSG_3395 = 'PROJCS["WGS 84 / World M... | nextgis/nextgisweb | nextgisweb/spatial_ref_sys/test/test_model.py | Python | gpl-3.0 | 3,896 |
class Solution:
def myAtoi(self, str: str) -> int:
i = 0
while i < len(str) and str[i] == ' ':
i += 1
if i == len(str):
return 0
sign = 1
if str[i] == '+':
i += 1
elif str[i] == '-':
sign = -1
i += 1
... | jiadaizhao/LeetCode | 0001-0100/0008-String to Integer (atoi)/0008-String to Integer (atoi).py | Python | mit | 681 |
import time
from clockdeco_param import clock
@clock('{name}({args}) dt={elapsed:0.3f}s')
def snooze(seconds):
time.sleep(seconds)
for i in range(3):
snooze(.123)
| YuxuanLing/trunk | trunk/code/study/python/Fluent-Python-example-code/07-closure-deco/clockdeco_param_demo2.py | Python | gpl-3.0 | 182 |
"""MES_srv URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | josecriane/MES_srv | MES_srv/urls.py | Python | apache-2.0 | 1,218 |
import datetime
from urlparse import urlparse
from utils import log as logging
from django.shortcuts import get_object_or_404, render_to_response
from django.views.decorators.http import condition
from django.http import HttpResponseForbidden, HttpResponseRedirect, HttpResponse, Http404
from django.conf import settings... | lucidbard/NewsBlur | apps/rss_feeds/views.py | Python | mit | 19,521 |
"""Support for Vera thermostats."""
import logging
from homeassistant.util import convert
from homeassistant.components.climate import ClimateDevice, ENTITY_ID_FORMAT
from homeassistant.components.climate.const import (
STATE_AUTO, STATE_COOL,
STATE_HEAT, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_OPERATION_MODE,... | HydrelioxGitHub/home-assistant | homeassistant/components/vera/climate.py | Python | apache-2.0 | 4,674 |
# class for driving self string over GPIO.PWM
__author__ = 'cygairko'
# noinspection PyMethodMayBeStatic
class Led:
PORT_RED = 17 # GPIO port for red
PORT_GREEN = 18 # GPIO port for green
PORT_BLUE = 4 # GPIO port for blue
FREQ = 100 # Frequency for PWM
def __init__(self, mockup):
sel... | cygairko/PyDioder | colorlight.py | Python | mit | 3,067 |
#!/usr/bin/env python
#
# Protein Engineering Analysis Tool DataBase (PEATDB)
# Copyright (C) 2010 Damien Farrell & Jens Erik Nielsen
#
# 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 ver... | dmnfarrell/peat | PEATDB/DNAtool/evaluate_primer.py | Python | mit | 16,953 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["centroid"]
import numpy as np
from functools import partial
from itertools import izip, imap
from .c3k import find_centroid
def centroid(tpf, **kwargs):
# Load the data.
data = tpf.read()
times = data["TIME"]
image... | benmontet/K2-noise | k2/centroid.py | Python | mit | 604 |
from flask import request, url_for
from shared_web.decorators import fill_args
from .. import APP, db
from ..data import match
from ..view import View
@APP.route('/formats/<format_name>/')
def show_format(format_name: str = None) -> str:
view = Matches(format_name=format_name)
return view.page()
@APP.route... | PennyDreadfulMTG/Penny-Dreadful-Tools | logsite/views/matches.py | Python | gpl-3.0 | 1,719 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutStrings(Koan):
def test_double_quoted_strings_are_strings(self):
string = "Hello, world."
self.assertEqual(True, isinstance(string, basestring))
def test_single_quoted_strings_are_also_strings(self):
... | xcasper/python_koans | python2/koans/about_strings.py | Python | mit | 3,048 |
# coding: UTF-8
import unittest
import play_file
class TestAssemblyReader(unittest.TestCase):
def test_version_reader(self):
assembly_reader = play_file.AssemblyReader()
version = assembly_reader.get_assembly_version('AssemblyInfo.cs')
self.assertEqual(version, '7.3.1.0210')
def test_... | biztudio/JustPython | syntaxlab/src/test_play_file.py | Python | mit | 570 |
#!/bin/python3
import sys
n = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
total = sum(arr)
print(total)
| costincaraivan/hackerrank | algorithms/warmup/python3/simple_array_sum.py | Python | mit | 149 |
# gamecoordinator/utils/pshell.py
from webtest import TestApp
from .. import models
import inspect
def setup(env):
env.update((name, cls) for name, cls in
inspect.getmembers(models, inspect.isclass))
env['DBSession'] = models.DBSession
env['request'].host = 'dominoes.software.net.nz'
env... | linuxsoftware/dominoes | davezdominoes/gamecoordinator/utils/pshell.py | Python | agpl-3.0 | 389 |
#
# Cardapio is an alternative menu applet, launcher, and much more!
#
# Copyright (C) 2010 Cardapio Team (tvst@hotmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... | daboross/cardapio | src/Cardapio.py | Python | gpl-3.0 | 116,067 |
# -*- coding: utf-8 -*-
import six
import logging
import pydash
log = logging.getLogger(__name__)
def _handle_auto_doc_for_property(doc, typename):
if doc is None:
doc = '<AUTO>'
if '<AUTO>' in doc:
subst = (
':getter: Get\n'
'{pref}:setter: Set\n'
'{pref}:rtype: {typename}'
).format(
typename... | maxkoryukov/route4me-python-sdk | route4me/sdk/_internals/decorators.py | Python | isc | 2,082 |
def _submit(url,
gremlin,
graph,
bindings=None,
lang="gremlin-groovy",
aliases=None,
op="eval",
processor="",
timeout=None,
session=None,
loop=None,
username="",
password="",
... | davebshow/gremlinclient | gremlinclient/api.py | Python | mit | 3,402 |
# coding: utf-8
from __future__ import absolute_import
from swagger_server.models.error_model import ErrorModel
from swagger_server.models.taxonomy import Taxonomy
from . import BaseTestCase
from six import BytesIO
from flask import json
class TestTaxonomyController(BaseTestCase):
""" TaxonomyController integra... | EarthLifeConsortium/elc_api | swagger_server/test/test_taxonomy_controller.py | Python | apache-2.0 | 995 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from djang... | miing/mci_migo | identityprovider/tests/test_models_account.py | Python | agpl-3.0 | 26,575 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import base64
import date... | suutari-ai/shoop | shuup_tests/api/test_products_api.py | Python | agpl-3.0 | 34,273 |
import logging
import os
import sys
LEVEL = logging.DEBUG if os.environ.get('DEBUG') else logging.INFO
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
# get a default logger to the project
log = logging.getLogger()
log.setLevel(LEVEL)
# make this log send messages to stdout
output = logging.Str... | datasciencebr/serenata-toolbox | serenata_toolbox/__init__.py | Python | mit | 440 |
#!/usr/bin/env python
import os
import sipconfig
import PyQt4.pyqtconfig as pyqtconfig
import sys
import getopt
import glob
opt_static=0
opt_debug=0
class EpaModuleMakefile(pyqtconfig.QtCoreModuleMakefile):
"""The Makefile class for modules that %Import QtXml.
"""
def __init__(self, *args, **kw):
... | lordtangent/arsenalsuite | cpp/lib/epa/configure.py | Python | gpl-2.0 | 4,529 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The crimson Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression testing
#
import os
import sys
from binascii import hexlify, unhex... | CrimsonDev14/crimsoncoin | qa/rpc-tests/test_framework/util.py | Python | lgpl-3.0 | 26,752 |
"""
HTTP Utilities
(from web.py)
"""
__all__ = [
"expires", "lastmodified",
"prefixurl", "modified",
"changequery", "url",
"profiler",
]
import sys, os, threading, urllib, urlparse
try: import datetime
except ImportError: pass
import net, utils, webapi as web
def prefixurl(base=''):
"""
Sorry, this... | minixalpha/SourceLearning | webpy/src/web/http.py | Python | apache-2.0 | 4,479 |
# View more python tutorials on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
"""
Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.... | MediffRobotics/DeepRobotics | DeepLearnMaterials/tutorials/tensorflowTUT/tf19_saver.py | Python | gpl-3.0 | 1,436 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taggit', '0001_initial'),
]
operations = [
migrations.AlterIndexTogether(
name='taggeditem',
index_t... | nealtodd/django-taggit | taggit/migrations/0002_auto_20150616_2121.py | Python | bsd-3-clause | 383 |
#!/bin/env dls-python
if __name__ == "__main__":
# Test
from pkg_resources import require
require("pyzmq==13.1.0")
require("cothread==2.12")
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "..", ".."))
from malcolm.core.directoryService import DirectoryService, ... | ulrikpedersen/malcolm | malcolm/iMalcolm/iMalcolmServer.py | Python | apache-2.0 | 1,908 |
import os
import json
from tornado.web import RequestHandler
import numpy as np
arrays = {}
class ArrayHandler(RequestHandler):
def get(self, name):
"""Return only the metadata, not the handle itself"""
if name not in arrays:
raise HTTPError(404)
meta = {k: v for k, v in arra... | seanjtaylor/ArrayServer | arrayserver/server.py | Python | mit | 1,110 |
"""labels.py - gtk.Label convenience classes."""
import gtk
import pango
class FormattedLabel(gtk.Label):
"""FormattedLabel keeps a label always formatted with some pango weight,
style and scale, even when new text is set using set_text().
"""
def __init__(self, text='', weight=pango.WEIGHT_NORMAL,
... | HoverHell/mcomix-0 | mcomix/labels.py | Python | gpl-2.0 | 1,410 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Mazecreator/tensorflow | tensorflow/python/debug/lib/session_debug_testlib.py | Python | apache-2.0 | 62,419 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_Flask-RESTify
----------------------------------
Tests for `Flask-RESTify` module.
"""
import unittest
class FlaskRESTifyTest(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDown(self):
pa... | cllu/Flask-RESTify | tests/test_flask_restify.py | Python | bsd-3-clause | 371 |
from datetime import date
from money.models import CategorySuggestion
class LloydsParser:
@staticmethod
def parse_row(row):
data = {}
splitted_date = row[0].split("/")
date_info = map(
int, [splitted_date[2], splitted_date[1], splitted_date[0]])
data["date"] = date(*date_info)
data["account_number"] ... | shakaran/casterly | money/parser/banks.py | Python | bsd-3-clause | 693 |
# 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/.
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as expected
from... | hoosteeno/bedrock | tests/pages/regions/modal.py | Python | mpl-2.0 | 1,397 |
import random
from tools.cellular.CellularState import CellularState
from tools.cellular.GridMatrix import GridMatrix
class CellularAutomaton:
"""
This is a cellular automaton, with two parameters death_limit and birth_limit,
which works according to the following rules in each iteration:
- If a cell... | simonhampe/pylab | tools/cellular/CellularAutomaton.py | Python | gpl-3.0 | 4,051 |
"""
A Node which fills its bounding box with a given Color.
"""
from Node import *
from Color import *
class ColorNode(Node, object):
"""
A Node which fills its bounding box with a certain L{Color}. (Note that the ColorNode merely uses the backgroundColor to render the color, so setting the backgroundColor will act... | jeremyflores/cocosCairo | cocosCairo/ColorNode.py | Python | mit | 1,570 |
# Copyright 2015 OpenStack Foundation
# 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 requ... | cisco-openstack/tempest | tempest/thirdparty/cisco/base.py | Python | apache-2.0 | 6,239 |
#
# 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... | markflyhigh/incubator-beam | sdks/python/apache_beam/typehints/decorators.py | Python | apache-2.0 | 29,869 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | denny820909/builder | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/util/maildir.py | Python | mit | 5,970 |
from unittest import TestCase
import string
import random
from cryptochallenge import stringmanip
class TestHexStringToByteArray(TestCase):
def test_problemString(self):
challenge_hex = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"
print("challe... | dctelf/poisonous-mushroom | 2018_tests/test_hexStringToByteArray.py | Python | apache-2.0 | 1,898 |
# Django settings for djProject project.
import sys, os
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
sys.path.insert(0, os.path.join(PROJECT_DIR, 'apps'))
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
... | devsar/djProject | djProject/settings.py | Python | bsd-3-clause | 5,237 |
#
# Revelation - a password manager for GNOME 2
# http://oss.codepoet.no/revelation/
# $Id: base.py 602 2007-01-03 08:06:28Z erikg $
#
# Module for basic datahandler functionality
#
#
# Copyright (c) 2003-2006 Erik Grinaker
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of... | FooBarWidget/revelation | src/lib/datahandler/base.py | Python | gpl-2.0 | 1,870 |
from argparse import ArgumentParser
from typing import Any
from django.conf import settings
from django.core.management.base import CommandError
from django.db.models import Q
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.send_email import send_custom_email
from zerver.models import Realm, UserPr... | hackerkid/zulip | zerver/management/commands/send_custom_email.py | Python | apache-2.0 | 5,113 |
from sandglass.time.api.v1.group import GroupResource
from sandglass.time.api.v1.project import ProjectResource
from sandglass.time.models.permission import Permission
def test_project_create_single(request_helper, default_data, session):
"""
Test creation of a project.
"""
project = default_data.pro... | sanglass/sandglass.time | tests/api/v1/test_project.py | Python | bsd-3-clause | 3,775 |
# -*- coding: utf-8 -*-
"""
requests-foauth
~~~~~~~~~~~~~~~
This module provides an foauth.org TransportAdapter for Requests.
In short, foauth.org allows you to easily send requests to OAUth'd
services with HTTP Basic authentication. It's fantastic.
Normally, you have to send all requests to foauth.org manually, aft... | kennethreitz/requests-foauth | setup.py | Python | bsd-2-clause | 1,462 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('flooding_base', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='site',
name='co... | lizardsystem/flooding | flooding_base/migrations/0002_auto_20200925_1649.py | Python | gpl-3.0 | 616 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cloudbase Solutions Srl
# 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.ap... | zestrada/nova-cs498cc | nova/virt/hyperv/snapshotops.py | Python | apache-2.0 | 4,875 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import registration.models
import django.core.validators
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial... | BCGamer/CheckIn-Server | registration/migrations/0001_initial.py | Python | mit | 4,390 |
# -*- coding: utf-8 -*-
import pytest
import six
from sqlalchemy_utils import Ltree
class TestLtree(object):
def test_init(self):
assert Ltree('path.path') == Ltree(Ltree('path.path'))
def test_constructor_with_wrong_type(self):
with pytest.raises(TypeError) as e:
Ltree(None)
... | konstantinoskostis/sqlalchemy-utils | tests/primitives/test_ltree.py | Python | bsd-3-clause | 4,697 |
#
# Copyright 2009-2016 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | EdDev/vdsm | lib/vdsm/storage/exception.py | Python | gpl-2.0 | 49,102 |
'''
Created on 13/set/2014
@author: Vincenzo Pirrone <pirrone.v@gmail.com>
'''
import json
from flask import Flask
from flask.globals import request
from flask_cors import CORS
from conf.node import remote_nodes, NAME, DESCRIPTION, LISTEN_ADDR, stations
from osnf.api import get_network
app = Flask(__name__)
app.d... | sp4x/osnf | osnf/ws.py | Python | apache-2.0 | 1,453 |
'''
All ldap operations for test.
@author: quarkonics
'''
import apibinding.inventory as inventory
import apibinding.api_actions as api_actions
import zstackwoodpecker.test_util as test_util
import account_operations
import config_operations
import os
import inspect
def add_ldap_server(name, descri... | zstackio/zstack-woodpecker | zstackwoodpecker/zstackwoodpecker/operations/ldap_operations.py | Python | apache-2.0 | 2,659 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... | Typecraft/casetagger | travis_pypi_setup.py | Python | mit | 3,758 |
#*- coding: utf-8 -*-
from model.connection import get_session
class RobotBase(object):
def __init__(self):
self.connection = get_session()
def run(self):
self._run()
def _run(self):
pass | t10471/python | stock/src/t10471/robot/robot_base.py | Python | mit | 227 |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
from setuptools import setup, find_packages, Command
import os
import re
class RunTestsCommand(Command):
description = "Test command to run testr in virtualenv"
user_options = [
('coverage', 'c',
"Generate code coverage repor... | tcpcloud/contrail-controller | src/config/device-manager/setup.py | Python | apache-2.0 | 1,563 |
# tupleA = ()
def a (self):
print(self.name)
Person = type("Person", (), {'name':'lisi', 'run':a})
p1 = Person()
p1.run()
def b (str):
print(str)
return str
class Person:
age = b(18)
name = b("李四") # 无视一个属性
# 指明元类方式 1
class Dog:
__metaclass__ = type
pass
# 指明元类方式 2
class Cat(metaclas... | z727354123/pyCharmTest | 2018-01/01_Jan/15/03-创建类对象.py | Python | apache-2.0 | 965 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Swimlane Python documentation build configuration file, created by
# sphinx-quickstart on Tue Jun 6 10:20:12 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 t... | Swimlane/sw-python-client | docs/conf.py | Python | mit | 5,881 |
# start --- config.ini ---
# --*-- python --*--
enemy = "Dr. No"
salary = 100
def tax(salary):
return salary * 0.2
bond = employee(id = "007", salary=salary * 2, tax=tax(salary * 2))
# end --- config.ini ---
# start --- readconf.py ---
class employee:
def __init__(self, id, salary, tax):
self.id = ... | ActiveState/code | recipes/Python/231516_Using/recipe-231516.py | Python | mit | 802 |
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NIN... | goblincoding/ninja-ide | ninja_ide/core/file_handling/filesystem_notifications/windows.py | Python | gpl-3.0 | 8,896 |
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.utils import six
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_required,
webapi_response_errors,
... | 1tush/reviewboard | reviewboard/webapi/resources/review_reply.py | Python | mit | 12,149 |
# -*- coding: utf-8 -*-
# __author__: Yixuan LI
# __email__: yl2363@cornell.edu
import os
import json
import re
from optparse import OptionParser
import tweepy
import time
class UserTimeline:
def __init__(self,inputDir,outputDir):
self.inputDir = inputDir
self.outputDir = outputDir
os.system("mkdir -p %s"%(o... | YixuanLi/geo-tweet | twitter-timeline/get_non_locator_timeline.py | Python | gpl-2.0 | 5,282 |
from .apify_repl import ApifyRepl
from .serial_repl import SerialRepl
from .base_device import MpyDeviceError
class MpyDevice(object):
"""
micropython board interface
This module provides a MpyDevice class to communicate with a micropython
device. It allows to execute python code remote on the device... | stefanhoelzl/mpy-dev-tools | src/mpy_device/__init__.py | Python | mit | 649 |
import os
try:
from psycopg2cffi import compat
compat.register()
except ImportError:
pass
from .settings import * # noqa
DATABASES = {
'default': {
'ENGINE': 'transaction_hooks.backends.postgresql_psycopg2',
'NAME': 'dtc',
},
}
if 'DTC_PG_USERNAME' in os.environ:
DA... | carljm/django-transaction-hooks | transaction_hooks/test/settings_pg.py | Python | bsd-3-clause | 493 |
# -*- coding: utf-8 -*-
"""
Django-Select2 url config.
Add `django_select` to your urlconf **if** you use any 'Model' fields::
url(r'^select2/', include('django_select2.urls')),
"""
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from .views import AutoRespon... | rizumu/django-select2 | django_select2/urls.py | Python | apache-2.0 | 458 |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from views import project_toggle_watch, resource_translation_toggle_watch
urlpatterns = patterns('',
url(
regex = '^ajax/p/(?P<project_slug>[-\w]+)/toggle_watch/$',
view = project_toggle_watch,
name = 'project_toggle_watch',),
... | hfeeki/transifex | transifex/addons/watches/urls.py | Python | gpl-2.0 | 568 |
#!/usr/bin/env python
# Copyright 2015 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program ... | borisroman/vdsm | vdsm_hooks/ovs/ovs_before_network_setup_ip.py | Python | gpl-2.0 | 6,846 |
# 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... | pcm17/tensorflow | tensorflow/python/ops/control_flow_ops.py | Python | apache-2.0 | 116,390 |
# Copyright 2011-2012 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 list of conditions ... | eethomas/eucalyptus | clc/eucadmin/eucadmin/enable.py | Python | gpl-3.0 | 2,154 |
# -*- coding: utf-8 -*-
"""
Provides useful functions for dealing with JWTs and JWSs
Based on the
`JWT <https://tools.ietf.org/html/rfc7519/>`_ and
`JWS <https://tools.ietf.org/html/rfc7515/>`_
IETF RFCs.
"""
from __future__ import unicode_literals
import six
import collections
import json
import time
import loggin... | Neustar-TDI/python-sdk | src/oneid/jwts.py | Python | apache-2.0 | 22,064 |
#Tells the user which year they will turn 100 based on their current age
import time
name = ""
age = int()
def get_name():
global name
name = input("What is your name? ")
return name
def get_age():
age = int(input("Hello " + name + "! \nHow old are you? "))
return age
while True... | derekDahl/Mutiny | age.py | Python | mit | 711 |
from .api_key import APIKeyCookie as APIKeyCookie
from .api_key import APIKeyHeader as APIKeyHeader
from .api_key import APIKeyQuery as APIKeyQuery
from .http import HTTPAuthorizationCredentials as HTTPAuthorizationCredentials
from .http import HTTPBasic as HTTPBasic
from .http import HTTPBasicCredentials as HTTPBasicC... | tiangolo/fastapi | fastapi/security/__init__.py | Python | mit | 881 |
### Author: <lefred$inuits,be>
global mysql_user
mysql_user = os.getenv('DSTAT_MYSQL_USER') or os.getenv('USER')
global mysql_pwd
mysql_pwd = os.getenv('DSTAT_MYSQL_PWD')
global mysql_host
mysql_host = os.getenv('DSTAT_MYSQL_HOST')
global mysql_port
mysql_port = os.getenv('DSTAT_MYSQL_PORT')
global mysql_socket
m... | nckx/dstat | plugins/dstat_mysql5_keys.py | Python | gpl-2.0 | 1,976 |
from flask.ext.assets import Bundle
from nomenklatura.core import assets
deps_assets = Bundle(
'vendor/jquery/dist/jquery.js',
'vendor/bootstrap/js/collapse.js',
'vendor/angular/angular.js',
'vendor/angular-route/angular-route.js',
'vendor/angular-bootstrap/ui-bootstrap-tpls.js',
'vendor/ngUpl... | robbi5/nomenklatura | nomenklatura/assets.py | Python | mit | 1,180 |
# Copyright (C) 2012 PiB <pixelbound@gmail.com>
#
# EQuilibre is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is dis... | pixelbound/equilibre | s3d.py | Python | gpl-2.0 | 5,652 |
import asyncio
import hashlib
import json
import logging
import os.path
import re
from io import BytesIO
from itertools import islice
from typing import ClassVar, Optional, Sequence, Union
import tornado.escape
import tornado.web
import tornado.websocket
import mitmproxy.flow
import mitmproxy.tools.web.master
from mi... | mitmproxy/mitmproxy | mitmproxy/tools/web/app.py | Python | mit | 22,761 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ReportTemplate(models.Model):
_description = 'Report Template'
_name = 'clv.report.template'
_order = 'name'
nam... | CLVsol/clvsol_odoo_addons | clv_report/models/report_template.py | Python | agpl-3.0 | 1,110 |
from setuptools import setup
setup(
name='babbisch-gccxml',
version='0.1',
packages=['babbisch'],
install_requires=['pygccxml'],
entry_points={
'console_scripts': [
'babbisch-gccxml = babbisch:main',
]
},
zip_safe=False,
package_data={
... | fredreichbier/babbisch-gccxml | setup.py | Python | mit | 359 |
from __future__ import absolute_import
import sys, functools, inspect
def return_locals(func):
'''Modifies decorated function to return its locals'''
@functools.wraps(func)
def wrap(*args, **kwargs):
frames = []
def tracer(frame, event, arg):
frames.append(frame)
... | Lehych/iktomi | iktomi/unstable/utils/functools.py | Python | mit | 1,090 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | opadron/girder | plugins/geospatial/server/__init__.py | Python | apache-2.0 | 1,704 |
#!/usr/bin/env python2
# Copyright (c) 2016 GoSecure Inc.
from opcache_disassembler import OPcacheDisassembler
import hashlib
import opcache_parser
import opcache_parser_64
import sys
import os
import subprocess
import shutil
import difflib
import time
hunt_source_files = "hunt_source_files.tmp"
hunt_ini = ... | GoSecure/php7-opcache-override | analysis_tools/opcache_malware_hunt.py | Python | mit | 11,202 |
# Touchy is Copyright (c) 2009 Chris Radek <chris@timeguy.com>
#
# Touchy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Touchy i... | CalvinHsu1223/LinuxCNC-EtherCAT-HAL-Driver | src/emc/usr_intf/touchy/mdi.py | Python | gpl-2.0 | 10,007 |
from pyowm import OWM, exceptions as owm_exceptions
from mindbot.config import WEATHER_TOKEN
from ..commandbase import CommandBase
FORECAST_TEXT = ('*Forecast time: {fc_time}*\n\n'
'City: {city}\n'
'Status: *{status}*\n'
'Day temperature: *{temperature[day]}* Celsius... | JulyJ/MindBot | mindbot/command/weather/forecast.py | Python | mit | 1,531 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... | UManPychron/pychron | pychron/core/fits/fit.py | Python | apache-2.0 | 2,945 |
#!/usr/bin/env python
"""
Object with built-in logger.
"""
import twiggy
class LoggerMixin(object):
"""
Mixin that provides a per-instance logger that can be turned off.
Parameters
----------
name : str
Name to assign logger.
log_on : bool
Initial value to assign to class ins... | cerrno/neurokernel | neurokernel/mixins.py | Python | bsd-3-clause | 1,930 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | joebowen/LogMyRocket_API | LogMyRocket/libraries/sys_packages/boto3/boto3/__init__.py | Python | gpl-3.0 | 2,981 |
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from setuptools import setup
from common_setup import common_setup
classifiers = [
'License :: OSI Approved :: MIT License',
'Development Status :: 5 - Production/Stable',
'Topic :: Software Development :: Libraries',
'To... | manahl/pytest-plugins | pytest-verbose-parametrize/setup.py | Python | mit | 1,398 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_v2beta1_generated_intents_batch_delete_intents_sync.py | Python | apache-2.0 | 1,704 |
# ----------------------------------------------------------------------------
# Copyright 2014 Nervana Systems 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.o... | ypkang/neon | neon/diagnostics/ranges_decorators.py | Python | apache-2.0 | 6,955 |
"""Empty python unit tests for the IntersectionOperator"""
# Copyright (C) 2011 Andre Massing
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version ... | alogg/dolfin | test/unit/intersection/python/IntersectionOperator.py | Python | gpl-3.0 | 907 |
#!/usr/bin/env python3
"""
refguide_check.py [OPTIONS] [-- ARGS]
- Check for a NumPy submodule whether the objects in its __all__ dict
correspond to the objects included in the reference guide.
- Check docstring examples
- Check example blocks in RST files
Example of usage::
$ python refguide_check.py optimize... | abalkin/numpy | tools/refguide_check.py | Python | bsd-3-clause | 37,850 |
class DBXRef:
def __init__(self, dbname, dbid, reftype = None, negate = 0):
self.dbname = dbname
self.dbid = dbid
self.reftype = reftype
self.negate = negate
def __str__(self):
if self.reftype is None:
reftype = ""
else:
reftype = self.ref... | dbmi-pitt/DIKB-Micropublication | scripts/mp-scripts/Bio/DBXRef.py | Python | apache-2.0 | 9,448 |
"""
The custom decorators for the REST API.
"""
| devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/edx_proctoring/decorators.py | Python | agpl-3.0 | 48 |
# -*- coding: utf-8 -*-
#
# 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
#... | Fokko/incubator-airflow | airflow/providers/amazon/aws/operators/datasync.py | Python | apache-2.0 | 18,190 |
import csv
import tempfile
import os
from transaction import Transaction
class LastTransactionsParser:
LAST_TRANSACTIONS_FILENAME = os.path.join(tempfile.gettempdir(), 'raapija_transactions_last.csv')
@staticmethod
def read():
try:
with open(LastTransactionsParser.LAST_TRANSACTIONS_FILENAME, 'r', e... | 2mv/raapija | last_transactions_parser.py | Python | isc | 884 |
"""
Work-in-progress!!!
Reads the logdata-data json files generated by the Fronius Push Service.
Extracts some data and generates a html report
"""
import json
import csv
import collections
import matplotlib.pyplot as plt
from pprint import pprint
import sys, os
from datetime import date
from calendar import monthra... | akleber/fronius-json-tools | logdata-data2report.py | Python | mit | 9,505 |
# for accessing babusca library.
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import smatrix
import scattering
import g1
import g2
import generators
| georglind/babusca | examples/context.py | Python | mit | 209 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.