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 |
|---|---|---|---|---|---|
#########################################################################
## This program is part of 'MOOSE', the
## Messaging Object Oriented Simulation Environment.
## Copyright (C) 2013 Upinder S. Bhalla. and NCBS
## It is made available under the terms of the
## GNU Lesser General Public License version 2... | dilawar/moose-full | moose-examples/snippets/chemDoseResponse.py | Python | gpl-2.0 | 6,804 |
# Copyright 2018 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... | aam-at/tensorflow | tensorflow/compiler/tf2xla/python/xla.py | Python | apache-2.0 | 16,835 |
"""
Support for tracking the moon phases.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.moon/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import... | MungoRae/home-assistant | homeassistant/components/sensor/moon.py | Python | apache-2.0 | 2,108 |
# coding: utf-8
# ## Capital One Labs Data Scientist Assignment - Part one
# #### Author Information:
#
# Oguz Semerci<br>
# [email protected]<br>
# ### Summary of the investigation
# We have in hand a regression problem with 5000 observations and 254 features, whose names are not known. The number of featur... | osemer01/regression-w-unknown-feature-names | Codetest_Part1.py | Python | cc0-1.0 | 13,223 |
# -*- coding: utf-8 -*-
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.tests import tagged
from odoo import fields
@tagged('post_install', '-at_install')
class TestAccountInvoiceReport(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
... | ygol/odoo | addons/account/tests/test_account_invoice_report.py | Python | agpl-3.0 | 4,611 |
# -*- coding: utf-8 -*-
# flake8: noqa
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
mi... | jwhitlock/dsh-orderwrt-bug | sample/migrations/0001_initial.py | Python | mpl-2.0 | 2,117 |
import math
import sys
import re
valuePattern = re.compile('= (.+)$')
def extractValue(line):
match = re.search(valuePattern, line)
if match:
return float.fromhex(match.group(1))
else:
return "ERROR"
intervalPattern = re.compile('= \[(.*?), (.*?)\]')
def extractInterval(line):
match = re.search(interv... | jacekburys/csmith | programs/validate.py | Python | bsd-2-clause | 1,157 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron and Valeureux Copyright Valeureux.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | Valeureux/wezer-exchange | __unreviewed__/mail_holacracy/__openerp__.py | Python | agpl-3.0 | 2,149 |
# -*- encoding: utf-8 -*-
# Copyright (C) 2015 Alejandro López Espinosa (kudrom)
import os
import os.path
settings = {
# Current working directory
"lupulo_cwd": os.path.dirname(os.path.abspath(__file__)),
# Avoid the testing port 8081 if you are going to run the tests with
# an instance of the webp... | kudrom/lupulo | lupulo/settings.py | Python | gpl-2.0 | 1,240 |
# -*- coding: utf-8 -*-
import os
import json
from gensim.models import word2vec
from gensim import models
class Rule(object):
"""
Store the concept terms of a rule, and calculate the rule similarity.
"""
def __init__(self, domain, rule_terms, children, response, word2vec_model):
self.id_ter... | konata39/chatbot-backend | RuleMatcher/rulebase.py | Python | gpl-3.0 | 7,750 |
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'dscl Get-Groups',
# list of one or more authors for the module
... | adaptivethreat/Empire | lib/modules/python/situational_awareness/network/active_directory/dscl_get_groups.py | Python | bsd-3-clause | 3,241 |
#!/usr/bin/env python
# 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.ui import WebDriverWa... | DESHRAJ/fjord | smoketests/pages/generic_feedback_form.py | Python | bsd-3-clause | 5,126 |
# Copyright 2016 Cyril Gaudin (Camptocamp)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models
class AccountPaymentTerm(models.Model):
_inherit = 'account.payment.term'
early_payment_discount = fields.Boolean(
string="Early Payment Discount",... | kittiu/account-payment | account_early_payment_discount/models/account_payment_term.py | Python | agpl-3.0 | 1,389 |
from django.db import models
class Section(models.Model):
name = models.CharField(max_length=32)
| libreoss/liberator-api | liberator/models/section.py | Python | gpl-2.0 | 104 |
from helpers import read_config
import importlib
screen = None
def init():
""" This function is called by main.py to read the output configuration, pick the corresponding drivers and initialize a Screen object.
It also sets ``screen`` global of ``output`` module with created ``Screen`` object."""
global ... | CRImier/pyLCI | output/output.py | Python | apache-2.0 | 717 |
# 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... | kobejean/tensorflow | tensorflow/python/ops/numerics.py | Python | apache-2.0 | 4,096 |
#!/usr/bin/env python
# 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.
"""Tests for checkdeps.
"""
import os
import unittest
import builddeps
import checkdeps
import results
class CheckDepsTest(uni... | junhuac/MQUIC | src/buildtools/checkdeps/checkdeps_test.py | Python | mit | 8,256 |
_method_cache = {}
class methodcaller(object):
"""
Return a callable object that calls the given method on its operand.
Unlike the builtin `operator.methodcaller`, instances of this class are
serializable
"""
__slots__ = ('method',)
func = property(lambda self: self.method) # For `funcn... | mrocklin/streams | streamz/utils.py | Python | bsd-3-clause | 1,184 |
# Copyright 2020 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-core/cirq/sim/clifford/act_on_stabilizer_ch_form_args.py | Python | apache-2.0 | 4,827 |
# Copyright 2015, Pinterest, 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 writ... | sungjuly/pinball | pinball_ext/job/hive_jobs.py | Python | apache-2.0 | 3,084 |
# Pipeline that tests the pre-trained weights for different zones
#
# Copyright: (c) Daniel Duma 2018
# Author: Daniel Duma <[email protected]>
# For license information, see LICENSE.TXT
from __future__ import print_function
from __future__ import absolute_import
import json, os, time
from .base_pipeline impor... | danieldmm/minerva | evaluation/weight_testing_pipeline.py | Python | gpl-3.0 | 6,437 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Nicira, 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/li... | ntt-sic/neutron | neutron/plugins/nicira/dbexts/vcns_db.py | Python | apache-2.0 | 7,637 |
# Copyright 2014 eBay Software 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 ... | Tesora-Release/tesora-trove | trove/common/strategies/cluster/mongodb/api.py | Python | apache-2.0 | 29,811 |
# -*- 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 | google/cloud/dialogflow_v2beta1/services/documents/transports/grpc_asyncio.py | Python | apache-2.0 | 23,262 |
from pymongo import MongoClient
from wordcloud import WordCloud
import matplotlib.pyplot as plt
keys = ['school', 'location', 'major', 'position', 'employment']
def get_userData():
client = MongoClient()
db = client['Zhihu']
col = db['UserInfo']
return col.find()
def get_word(userdata, keyword='sc... | wangmengcn/LearningFlask | app/main/ZHData/wordCloud.py | Python | mit | 1,039 |
import json
import time
import logging
from collections import UserDict
import argparse
import datetime
import re
from pajbot.tbutil import find
from pajbot.models.db import DBManager, Base
from pajbot.models.action import ActionParser, RawFuncAction, FuncAction
from pajbot.managers.redis import RedisManager
from sql... | gigglearrows/anniesbot | pajbot/models/banphrase.py | Python | mit | 11,138 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# MIT License
#
# Copyright (c) 2018 Miha Purg <[email protected]>
#
# 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, in... | mpurg/qtools | packages/Qpyl/core/qstructure.py | Python | mit | 13,331 |
def get_binary_labeled_data():
labeled_data = []
x = [
[-0.155, 0.128, -0.688, 0.028, -0.555, -1.112, 0.427, -0.199, 0.807, -1.705],
[-0.847, 2.342, 1.156, 0.767, 0.171, 0.814, -0.657, 0.631, -0.346, 0.682],
[-0.886, 1.638, -0.818, -0.838, 1.137, 2.086, -0.662, 1.396, -1.613, -0.268],
... | shawnhermans/soothsayer | soothsayer/tests/common.py | Python | bsd-3-clause | 9,213 |
from django import forms
from django.contrib import admin
from django.contrib.admin import BooleanFieldListFilter, SimpleListFilter
from django.contrib.admin.options import VERTICAL, ModelAdmin, TabularInline
from django.contrib.admin.sites import AdminSite
from django.core.checks import Error
from django.db.models imp... | atul-bhouraskar/django | tests/modeladmin/test_checks.py | Python | bsd-3-clause | 46,499 |
import logging
from collections import Counter
from udata.commands import cli, header, success
log = logging.getLogger(__name__)
@cli.group('images')
def grp():
'''Images related operations'''
pass
def render_or_skip(obj, attr):
try:
getattr(obj, attr).rerender()
obj.save()
re... | opendatateam/udata | udata/commands/images.py | Python | agpl-3.0 | 2,037 |
#! /usr/bin/env python
# Triggers the webcam after getting a signal from the publisher pi.
import sys
from subprocess import call
from time import time, sleep
import datetime
# Global variables
GIT_BASE_DIRECTORY = "./snapshots/"
# Function that triggers the webcam, takes a picture
# and names the file with date an... | raiarun/HomeGuard | webcam_pi.py | Python | lgpl-2.1 | 1,703 |
import _plotly_utils.basevalidators
class MinexponentValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name="minexponent",
parent_name="histogram.marker.colorbar",
**kwargs
):
super(MinexponentValidator, self).__init__(
plot... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram/marker/colorbar/_minexponent.py | Python | mit | 507 |
import pytest
from diofant import (Dummy, E, Float, GoldenRatio, I, Integer, Mod, Mul, Pow,
Rational, Symbol, Wild, acos, asin, cbrt, exp, false, log,
nan, oo, pi, simplify, sin, sqrt, zoo)
from diofant.abc import x, y
from diofant.core.facts import InconsistentAssumptions
_... | diofant/diofant | diofant/tests/core/test_assumptions.py | Python | bsd-3-clause | 27,771 |
'''
Support for reading LIT files.
'''
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net> ' \
'and Marshall T. Vandegrift <[email protected]>'
import struct, os, functools, re
from urlparse import urldefrag
from cStringIO import StringIO
fro... | hazrpg/calibre | src/calibre/ebooks/lit/reader.py | Python | gpl-3.0 | 34,423 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier, Jacques-Etienne Baudoux
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General ... | lepistone/vertical-ngo | __unported__/logistic_requisition/model/purchase.py | Python | agpl-3.0 | 9,709 |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = ""
services_str = "/home/karl/catkin_ws/src/navigation/robot_pose_ekf/srv/GetStatus.srv"
pkg_name = "robot_pose_ekf"
dependencies_str = "std_msgs"
langs = "gencpp;geneus;genlisp;gennodejs;genpy"
dep_include_paths_str = "std_msgs;/opt/ros/lunar/share/st... | kschultz1986/robots_for_all | build/navigation/robot_pose_ekf/cmake/robot_pose_ekf-genmsg-context.py | Python | gpl-3.0 | 525 |
import numpy as np
from numpy import array, float32
from numpy.linalg import norm
import networkx as nx
from collections import namedtuple
from catmaid.models import Treenode, TreenodeConnector, ClassInstance, Relation
try:
from scipy.sparse.csgraph import dijkstra
except:
pass
def synapse_clustering( skele... | htem/CATMAID | django/applications/catmaid/control/synapseclustering.py | Python | agpl-3.0 | 6,882 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from .factories import ProxyGrantingTicketFactory
from .factories import ProxyTicketFactory
from .factories import ServiceTicketFactory
from .factories import ConsumedServiceTicketFactory
from .utils import parse
from ma... | forcityplatform/django-mama-cas | mama_cas/tests/test_response.py | Python | bsd-3-clause | 10,106 |
import time
import os
import enigma
from Components.config import config
from Components import Harddisk
from twisted.internet import threads
def getTrashFolder(path):
# Returns trash folder without symlinks. Path may be file or directory or whatever.
mountpoint = Harddisk.findMountPoint(os.path.realpath(path))
mov... | vit2/vit-e2 | lib/python/Tools/Trashcan.py | Python | gpl-2.0 | 4,858 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test example app."""
import json
import os
import signal
import subprocess
import... | tiborsimko/invenio-search | tests/test_examples_app.py | Python | mit | 1,522 |
import pytest
from charfinder import UnicodeNameIndex, tokenize, sample_chars, query_type
from unicodedata import name
@pytest.fixture
def sample_index():
return UnicodeNameIndex(sample_chars)
@pytest.fixture(scope="module")
def full_index():
return UnicodeNameIndex()
def test_query_type():
assert qu... | fluentpython/unicode-solutions | flupy-ch18/test_charfinder.py | Python | cc0-1.0 | 3,160 |
import subprocess
import os
from logging import info
import argparse
from servi.command import Command
import servi.config as c
from servi.utils import timeit
from servi.template_mgr import TemplateManager
from servi.commands.buildbox import get_all_boxes
from servi.exceptions import ServiError, ForceError
class Use... | rr326/servi | servi/commands/usebox.py | Python | mit | 2,241 |
"""
@author: dhoomakethu
"""
from __future__ import absolute_import, unicode_literals
from abc import ABCMeta, abstractmethod
class App(object):
__metaclass__ = ABCMeta
_driver = None
_service_store = None
_emulator = None
def __init__(self, network):
# self._network = getattr(Provider... | dhoomakethu/apocalypse | apocalypse/app/__init__.py | Python | mit | 3,520 |
# Copyright 2015 Kevin Murray <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program i... | kdmurray91/libqcpp | ui/qcpp/util.py | Python | mpl-2.0 | 1,347 |
# Copyright (C) 2005, Giovanni Bajo
# Based on previous work under copyright (c) 1999, 2002 McMillan Enterprises, 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... | supercheetah/diceroller | pyinstaller/e2etests/win32/NextID.py | Python | artistic-2.0 | 2,653 |
import re
from ros_homebot_python import constants as c
from ros_homebot_python import utils
def camelcase_to_underscores(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
def hash_str(s):
# print 'hash str:', repr(s)
s = str(s)
return... | chrisspen/homebot | src/ros/src/ros_homebot_python/src/ros_homebot_python/packet.py | Python | mit | 2,993 |
"""Unittest for idlelib.WidgetRedirector
100% coverage
"""
from test.test_support import requires
import unittest
from idlelib.idle_test.mock_idle import Func
from Tkinter import Tk, Text, TclError
from idlelib.WidgetRedirector import WidgetRedirector
class InitCloseTest(unittest.TestCase):
@classmethod
def... | svanschalkwyk/datafari | windows/python/Lib/idlelib/idle_test/test_widgetredir.py | Python | apache-2.0 | 4,133 |
import pytest
from flask import Flask
from fittrackee.emails.email import EmailTemplate
from .template_results.password_reset_request import (
expected_en_html_body,
expected_en_text_body,
expected_fr_html_body,
expected_fr_text_body,
)
class TestEmailTemplateForPasswordRequest:
@pytest.mark.par... | SamR1/FitTrackee | fittrackee/tests/emails/test_email_template_password_request.py | Python | agpl-3.0 | 2,820 |
from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from typing import Text
from zerver.decorator import authenticated_json_post_view,\
has_request_variables, REQ, JsonableError
from zerver.lib.actions import check_send_typing_notification, \
extract_recipients
from zerver... | sonali0901/zulip | zerver/views/typing.py | Python | apache-2.0 | 766 |
# -*- coding: utf-8 -*-
from django.db.models import Q
from django.views.generic import ListView
from django_get_forms.views import ProcessGetFormMixin
from .forms import SearchForm
from .models import Article
class SearchView(ProcessGetFormMixin, ListView):
template_name = 'demo/index.html'
form_class = S... | estebistec/django-get-forms | examples/demo/demo/views.py | Python | bsd-3-clause | 722 |
def foo(*, a, b):
print(a)
print(b)
def bar():
print(1)
print(2)
| siosio/intellij-community | python/testData/refactoring/inlineFunction/keywordOnlyArgs/main.after.py | Python | apache-2.0 | 83 |
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... | AffzPedro/motioneye | motioneye/config.py | Python | gpl-3.0 | 70,399 |
# (c) 2012-2014, Michael DeHaan <[email protected]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | skg-net/ansible | test/units/template/test_templar.py | Python | gpl-3.0 | 19,870 |
# GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistributi... | pywinauto/pywinauto | pywinauto/__init__.py | Python | bsd-3-clause | 7,043 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/apps/hbase/src/hbase/management/commands/hbase_setup.py | Python | gpl-2.0 | 3,477 |
import sys, re, textwrap
class ParseError(Exception):
# args[1] is the line number that caused the problem
def __init__(self, why, lineno):
self.why = why
self.lineno = lineno
def __str__(self):
return ("ParseError: the JS API docs were unparseable on line %d: %s" %
... | mozilla/FlightDeck | cuddlefish/apiparser.py | Python | bsd-3-clause | 9,926 |
import gdsCAD as cad
from junctions import JJunctions
import utilities
import collections
class Singlejunction_transmon():
"""
This class returns a single junction Yale Transmon
"""
def __init__(self, name, dict_pads, dict_junctions, short=False,
junctiontest=False):
self.n... | srpeiter/ChipDesignCad | source_dev/transmon.py | Python | gpl-3.0 | 10,556 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("stories", "0010_auto_20140922_1514")]
operations = [
migrations.AddField(
model_name="story",
name="audio_link",
field=models.URLField(
... | rapidpro/dash | dash/stories/migrations/0011_story_audio_link.py | Python | bsd-3-clause | 461 |
import json
import threading
import webbrowser
from wsgiref.simple_server import make_server
import dataset
PORT = 8080
def showleaderboard(environ, response):
res = open("leaderboard.html").read()
return res
def getleaderboard(environ, response):
return getleaderboardJSON()
def getle... | Daarknes/Gadakeco | server/startserver.py | Python | gpl-3.0 | 2,800 |
## Copyright 2003-2006 Luc Saffre.
## This file is part of the Lino project.
## Lino 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... | lsaffre/timtools | timtools/gendoc/styles.py | Python | bsd-2-clause | 7,898 |
import cherrypy
# 這是 MAN 類別的定義
'''
# 在 application 中導入子模組
import programs.cdag30.man as cdag30_man
# 加入 cdag30 模組下的 man.py 且以子模組 man 對應其 MAN() 類別
root.cdag30.man = cdag30_man.MAN()
# 完成設定後, 可以利用
/cdag30/man/assembly
# 呼叫 man.py 中 MAN 類別的 assembly 方法
'''
class MAN(object):
# 各組利用 index 引導隨後的程式執行
@cherrypy.expo... | 40123248/2015cd_midterm2 | man2.py | Python | gpl-3.0 | 13,353 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | ProjectSWGCore/NGECore2 | scripts/mobiles/generic/static/tatooine/bibfortuna.py | Python | lgpl-3.0 | 1,107 |
"""A library for integrating pyOpenSSL with CherryPy.
The OpenSSL module must be importable for SSL functionality.
You can obtain it from `here <https://launchpad.net/pyopenssl>`_.
To use this module, set CherryPyWSGIServer.ssl_adapter to an instance of
SSLAdapter. There are two ways to use SSL:
Method One
---------... | drzoidberg33/plexpy | lib/cherrypy/wsgiserver/ssl_pyopenssl.py | Python | gpl-3.0 | 9,357 |
# coding=utf-8
from __future__ import unicode_literals
import time
from collections import namedtuple
class ExpiringList(list):
"""Smart custom list, with a cache expiration."""
CachedResult = namedtuple('CachedResult', 'time value')
def __init__(self, items=None, cache_timeout=3600, implicit_clean=Fa... | pymedusa/Medusa | medusa/show/recommendations/__init__.py | Python | gpl-3.0 | 5,174 |
"""Utility functions for copying and archiving files and directory trees.
XXX The functions here don't copy the resource fork or other metadata on Mac.
"""
import os
import sys
import stat
from os.path import abspath
import fnmatch
import collections
import errno
try:
from pwd import getpwnam
except ImportError... | Symmetry-Innovations-Pty-Ltd/Python-2.7-for-QNX6.5.0-x86 | usr/pkg/lib/python2.7/shutil.py | Python | mit | 18,302 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Commands for:
- building and publishing virtual environments
- sync'ing application code
- managing (e.g. start, stop, etc.) the any service
on hosts.
Here's an example of updating all running hosts attached to a load-balancer... | verygood-ops/fab-ops | fabfile.py | Python | apache-2.0 | 16,236 |
from cs_plone3_theme import Plone3Theme
class BootstrapTheme(Plone3Theme):
_template_dir = 'templates/bootstrap_theme'
summary = 'A Theme for Plone 3/4 based on Twitter Bootstrap'
skinbase = 'Bootstrap Theme'
use_local_commands = True
def post(self, command, output_dir, vars):
print "-----... | codesyntax/CodeSkel | codeskel/bootstrap_theme.py | Python | mit | 637 |
# oppia/context_processors.py
from django.conf import settings
import oppia
from oppia.models import Points, Award
def get_points(request):
if not request.user.is_authenticated():
return {'points': 0, 'badges':0 }
else:
points = Points.get_userscore(request.user)
if points is None:
... | DigitalCampus/django-maf-oppia | oppia/context_processors.py | Python | gpl-3.0 | 1,090 |
"""This module corresponds to functionality documented
at https://blockchain.info/api/blockchain_wallet_api
"""
import json
from . import util
from .exceptions import *
import logging
class Wallet:
"""The :class:`Wallet` class mirrors operations listed on the wallet API page.
It needs to be initialized on ... | mofax/evendice | blockchain/wallet.py | Python | mit | 8,480 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 10 14:46:37 2019
Funções de forma para a viga de 3 nós de Euler-Bernouilli
Completo!
@author: markinho
"""
import sympy as sp
import numpy as np
import matplotlib.pyplot as plt
#para viga
L = sp.Symbol('L')
x1 = -L/2
x2 = 0
x3 = L/2
u1 = sp.Sym... | argenta-web/argenta-web.github.io | MEFaplicado-html/vigas/codigos/Derivando-FuncoesFormaVigaEulerBernouilli3nos.py | Python | mit | 12,228 |
"""
Tor Browser Launcher
https://github.com/micahflee/torbrowser-launcher/
Copyright (c) 2013-2014 Micah Lee <[email protected]>
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
restrict... | kytvi2p/torbrowser-launcher | torbrowser_launcher/__init__.py | Python | mit | 2,525 |
# Copyright 2017 Capital One Services, 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 agreed to in... | FireballDWF/cloud-custodian | tools/c7n_mailer/tests/common.py | Python | apache-2.0 | 16,794 |
"""
FormES
--------
"""
from corehq.pillows.mappings.const import NULL_VALUE
from . import filters
from .es_query import HQESQuery
class FormES(HQESQuery):
index = 'forms'
default_filters = {
'is_xform_instance': filters.term("doc_type", "xforminstance"),
'has_xmlns': filters.exists("xmlns"),... | dimagi/commcare-hq | corehq/apps/es/forms.py | Python | bsd-3-clause | 3,080 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | argv0/cloudstack | test/integration/smoke/test_templates.py | Python | apache-2.0 | 31,136 |
def inicializar():
tab = []
for i in range(3):
linha = []
for j in range(3):
linha.append("XX")
tab.append(linha)
return tab
def main():
jogo = inicilizar()
print (jogo)
if _name_ == "_main_":
main()
| dehssousa/devops-aula05 | docs/docs/docs/src/src/jogovelha.py | Python | apache-2.0 | 266 |
#!/usr/bin/env python3
import sys,re
from beautifier import Email, Url
import ftfy
name1="Tschöp"
email1=" [email protected]"
email2=" [email protected]. "
email3=" jim at gmail.com"
#cleanre = r"[^a-zA-Z0-9@]"
#cleanmail = re.sub(cleanre,"",email2)
clean = email2.strip(' ').strip(".")
print(f">{clean}<")
clean=emai... | jdurbin/sandbox | python/panda/emailfix.py | Python | mit | 485 |
#
# Example file for working with filesystem shell methods
# (For Python 3.x, be sure to use the ExampleSnippets3.txt file)
import os
import shutil
from os import path
from shutil import make_archive
from zipfile import ZipFile
def main():
if path.exists("textfile.txt"):
src = path.realpath("textfile.txt... | thatguyandy27/python-sandbox | learning-python/Ch4/shell_start.py | Python | mit | 846 |
"""
The :mod:`costcla.probcal` module includes methods for probability calibration
"""
from .probcal import ROCConvexHull
__all__ = ['ROCConvexHull',]
| albahnsen/CostSensitiveClassification | costcla/probcal/__init__.py | Python | bsd-3-clause | 153 |
__author__ = 'manabchetia'
from pyneural import pyneural
from os import listdir
from os.path import join, isfile
import pandas as pd
import numpy as np
from PIL import Image
import leargist as gist
from sklearn.cross_validation import train_test_split
from sknn.mlp import Classifier, Layer
from pandas.io.pickle import... | liboyin/horc | src/classifier_gist_neural.py | Python | gpl-2.0 | 5,380 |
#!/usr/bin/env python
#
# getSeqFlankBlatHit.py
#
# author: Joseph Tran <[email protected]>
# date: 25-03-2015
#
import argparse
import logging
## arguments ##
parser = argparse.ArgumentParser(description="Extract genomic sequences flanking blat hits")
parser.add_argument("genome", help="genome in fast... | jos4uke/getSeqFlankBlatHit | getSeqFlankBlatHit.py | Python | gpl-2.0 | 4,651 |
from flask_restful import Resource
from flask import request, Response
from emuvim.api.openstack.openstack_dummies.base_openstack_dummy import BaseOpenstackDummy
from datetime import datetime
import logging
import json
import uuid
import copy
class NeutronDummyApi(BaseOpenstackDummy):
def __init__(self, ip, port,... | knodir/son-emu | src/emuvim/api/openstack/openstack_dummies/neutron_dummy_api.py | Python | apache-2.0 | 38,680 |
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/python-bigquery-storage | samples/snippets/append_rows_pending_test.py | Python | apache-2.0 | 2,359 |
# coding=utf-8
# Author: Nic Wolfe <[email protected]>
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# This file is part of SickRage.
#
# SickRage 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... | pedro2d10/SickRage-FR | sickbeard/scene_exceptions.py | Python | gpl-3.0 | 12,610 |
import datetime
import os
from django import forms
from django.db.models.fields import Field
from django.core import checks
from django.core.files.base import File
from django.core.files.storage import default_storage
from django.core.files.images import ImageFile
from django.db.models import signals
from django.utils... | simbha/mAngE-Gin | lib/django/db/models/fields/files.py | Python | mit | 18,693 |
# Copyright 2022 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | google/flax | tests/core/design/core_resnet_test.py | Python | apache-2.0 | 4,684 |
from __future__ import unicode_literals
import warnings
from django.contrib import admin
from django.contrib.auth import logout
from django.contrib.messages import error
from django.contrib.redirects.models import Redirect
from django.core.exceptions import MiddlewareNotUsed
from django.urls import reverse, resolve
f... | readevalprint/mezzanine | mezzanine/core/middleware.py | Python | bsd-2-clause | 13,207 |
import enum
import os
import subprocess
from typing import Optional, Dict, Tuple
from ray_release.exception import ReleaseTestConfigError
from ray_release.logger import logger
from ray_release.wheels import DEFAULT_BRANCH
class Frequency(enum.Enum):
DISABLED = enum.auto()
ANY = enum.auto()
MULTI = enum.a... | ray-project/ray | release/ray_release/buildkite/settings.py | Python | apache-2.0 | 5,311 |
"""
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.
The tests in this file are inherited from the BaseExtensionTests, and only
minimal ... | datapythonista/pandas | pandas/tests/extension/test_datetime.py | Python | bsd-3-clause | 7,463 |
# Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <[email protected]>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | andi34/kernel_samsung_espresso-cm | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | Python | gpl-2.0 | 3,244 |
import sys
import os.path
import pprint
import xmlrpclib
class SafeTransportWithCert(xmlrpclib.SafeTransport):
"""Helper class to force the right certificate for the transport class."""
def __init__(self, key_path, cert_path):
xmlrpclib.SafeTransport.__init__(self) # no super, because old style class
... | EICT/C-BAS | test/unit/v1/testtools.py | Python | bsd-3-clause | 2,817 |
from django.apps import apps
from django.conf import settings
from django.utils.module_loading import import_string
from collections import namedtuple
import io
import inspect
from uuid import uuid1
from ..template import template_inheritance
from ..util import qualified_name, b58enc
# __init__() below creates a lis... | doconix/django-mako-plus | django_mako_plus/provider/runner.py | Python | apache-2.0 | 4,260 |
# Generated by Django 2.0.8 on 2019-04-10 11:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('structure', '0011_structurecomplexprotein'),
]
operations = [
migrations.CreateModel(
name='Str... | cmunk/protwis | structure/migrations/0012_structurevectors.py | Python | apache-2.0 | 842 |
from django import forms
from django.db.models.functions import Lower
from django.contrib.auth.models import User
from core import models
class Search(forms.Form):
name = forms.CharField(required=False)
address = forms.CharField(required=False)
group = forms.ModelChoiceField(queryset=models.HostGroup.obj... | telminov/ansible-manager | core/forms/host.py | Python | mit | 1,005 |
import collections
from supriya import CalculationRate
from supriya.ugens.BEQSuite import BEQSuite
class BHiCut(BEQSuite):
"""
A high-cut filter.
::
>>> source = supriya.ugens.In.ar(0)
>>> bhi_cut = supriya.ugens.BHiCut.ar(
... frequency=1200,
... max_order=5,
... | Pulgama/supriya | supriya/ugens/BHiCut.py | Python | mit | 666 |
"""
Settings for the blog are namespaced in the BLOG setting.
For exmaple your project's `settings.py` file might looks like this:
BLOG = {
'BLOG_TITLE': 'My Blog',
}
"""
from django.conf import settings as project_settings
DEFAULTS = {
'BLOG_TITLE': 'My Blog',
'BLOG_SITE_URL': 'http://localhost',
}
# C... | vacuus/kilonull | kilonull/settings.py | Python | lgpl-3.0 | 654 |
import random
import string
def random_string(n):
result = ''
for _ in range(10):
result += random.SystemRandom().choice(
string.ascii_uppercase + string.digits)
return result
| adrianp/cartz | server/utils.py | Python | mit | 210 |
import pytest
from thefuck.rules.python_module_error import get_new_command, match
from thefuck.types import Command
@pytest.fixture
def module_error_output(filename, module_name):
return """Traceback (most recent call last):
File "{0}", line 1, in <module>
import {1}
ModuleNotFoundError: No module named '... | nvbn/thefuck | tests/rules/test_python_module_error.py | Python | mit | 1,629 |
<<<<<<< HEAD
<<<<<<< HEAD
"Test posix functions"
from test import support
# Skip these tests if there is no posix module.
posix = support.import_module('posix')
import errno
import sys
import time
import os
import fcntl
import platform
import pwd
import shutil
import stat
import tempfile
import unittest
import warni... | ArcherSys/ArcherSys | Lib/test/test_posix.py | Python | mit | 147,179 |
"""
WSGI config for pykrd project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | python-krasnodar/python-krasnodar.ru | src/pykrd/wsgi.py | Python | mit | 388 |
import os
import cv2
import numpy as np
import pandas as pd
from scipy import stats
from plotnine import ggplot, aes, geom_line, scale_x_continuous, scale_color_manual, labs
from plantcv.plantcv import fatal_error
from plantcv.plantcv import deprecation_warning
from plantcv.plantcv import params
from plantcv.plantcv._d... | stiphyMT/plantcv | plantcv/plantcv/analyze_color.py | Python | mit | 13,218 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.