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 |
|---|---|---|---|---|---|
#! -*- coding: utf-8 -*-
"""
抽象工厂模式
"""
# 原料
class FreshClams:
def __str__(self):
return 'Fresh Clams'
class MarinaraSauce:
def __str__(self):
return "Marinara Sauce"
class ThickCrustDough:
def __str__(self):
return "Thick Crust Dough"
class ReggianoCheese:
def __st... | tencrance/cool-config | python_tricks/factory.py | Python | mit | 4,723 |
#! /usr/bin/env python3
import sys
import argparse
import os
import re
import shutil
from pathlib import Path
CMAKELISTS_TEMPLATE = '''\
check_include_file_cxx(stdint.h HAVE_STDINT_H)
if(HAVE_STDINT_H)
add_definitions(-DHAVE_STDINT_H)
endif()
set(examples_as_tests_sources)
if(${{ENABLE_EXAMPLES}})
set(exampl... | nsnam/ns-3-dev-git | utils/create-module.py | Python | gpl-2.0 | 17,158 |
# [Comet] VIEWS.PY - Copyright (c) 2016 - Sean Bailey - All Rights Reserved
# Powered by Django (https://www.djangoproject.com/) - Not endorsed by Django
#
# 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 o... | LuckehPickle/Comet | comet/views.py | Python | apache-2.0 | 1,256 |
#!/usr/bin/python3
import random
# Definições.
ARQUIVO_COM_NOMES = "Dados/Nomes de Pessoas.txt"
ARQUIVO_DE_SAIDA = "SQL Gerado/Motorista.sql"
# Define o id com que o motorista será inserido.
__idMotorista = 1 # Primeiro id.
# Controla o incremento dos dados únicos.
__incrementoCPF = 233 # Qualquer número de 3 digit... | possatti/trabalho-bd-sql | query2/Motorista.py | Python | gpl-2.0 | 3,282 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Employee Contracts',
'version': '1.0',
'category': 'Human Resources',
'description': """
Add all information on the employee form to manage contracts.
==========================================... | Aravinthu/odoo | addons/hr_contract/__manifest__.py | Python | agpl-3.0 | 772 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...worksheet import Worksheet
class TestWriteColBreaks(unitt... | jmcnamara/XlsxWriter | xlsxwriter/test/worksheet/test_write_col_breaks.py | Python | bsd-2-clause | 1,322 |
# Copyright (C) 2012 - 2014 EMC Corporation.
# 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
#
# Unle... | Akrog/cinder | cinder/tests/api/contrib/test_cgsnapshots.py | Python | apache-2.0 | 22,432 |
# Copyright 2020 Makani Technologies 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... | google/makani | config/oktoberkite/control/crosswind_controllers.py | Python | apache-2.0 | 3,107 |
"""calculator URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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... | mjiang-27/django_learn | form_basic/calculator/urls.py | Python | gpl-3.0 | 925 |
#
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | ened/scancode-toolkit | src/cluecode/copyrights.py | Python | apache-2.0 | 36,192 |
import os
import django
import pytest
# We manually designate which settings we will be using in
# an environment variable
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'conf')
# `pytest` automatically calls this function once when tests are run.
def pytest_configure():
# If you have any test specific settin... | tiagoprn/experiments | django/drf_veiculos_app/src/veiculos/tests/conftest.py | Python | mit | 1,137 |
# Copyright 2019 The Bazel 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 applicable law... | bazelbuild/bazel-bench | utils/values.py | Python | apache-2.0 | 2,517 |
import logging
from calaccess_raw import get_model_list
from calaccess_raw.annotations.filing_forms import all_filing_forms
from django.core.management.base import BaseCommand
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = 'Refresh the DocumentCloud cache'
def handle(self, *args, **... | california-civic-data-coalition/django-calaccess-downloads-website | toolbox/management/commands/refreshdccache.py | Python | mit | 791 |
import re
import hashlib
import base58
from pycoin.ecdsa import generator_secp256k1, public_pair_for_secret_exponent
def bytetohex(byteStr):
return ''.join( [ "%02X " % ord( x ) for x in byteStr ] ).strip()
addresstype = [b"\x61", b"\xBD"]
databaseHandler = open("wallet.dat", "rb")
dbDump = databaseHandler.r... | lionzeye/reddcovery | reddcovery.py | Python | mit | 737 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/jags/package.py | Python | lgpl-2.1 | 1,927 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2012-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | lucienfostier/gaffer | python/Gaffer/Application.py | Python | bsd-3-clause | 6,545 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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
## ... | labordoc/labordoc-next | modules/bibformat/lib/bibformat_engine_unit_tests.py | Python | gpl-2.0 | 41,180 |
""" Non-negative matrix factorization
"""
# Author: Vlad Niculae
# Lars Buitinck <L.J.Buitinck@uva.nl>
# Author: Chih-Jen Lin, National Taiwan University (original projected gradient
# NMF implementation)
# Author: Anthony Di Franco (original Python and NumPy port)
# License: BSD
from __future__ import di... | jmargeta/scikit-learn | sklearn/decomposition/nmf.py | Python | bsd-3-clause | 19,156 |
# TODO: Handle python files better
from control import ControlMainWindow
from PySide import QtGui
import sys
# Main functionality goes here.
if __name__ == "__main__":
# Setup the configuration
app = QtGui.QApplication(sys.argv)
mainWindowControler = ControlMainWindow()
mainWindowControler.show()
... | oddurk/scriptviewer | main.py | Python | mit | 344 |
#!/usr/bin/python
# (c) 2019, NetApp, Inc
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | amenonsen/ansible | lib/ansible/modules/storage/netapp/na_ontap_volume_autosize.py | Python | gpl-3.0 | 15,815 |
import operator
import sqlalchemy as sa
from sqlalchemy import and_
from sqlalchemy import case
from sqlalchemy import event
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import PickleType
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy import Text
from s... | zzzeek/sqlalchemy | test/orm/test_merge.py | Python | mit | 65,098 |
#!/usr/bin/env python
## \file Expandp3d.py
# \brief Python script for converting from plot3D to SU2
# \author _________
# \version 3.2.8 "eagle"
#
# SU2 Lead Developers: Dr. Francisco Palacios (fpalacios@stanford.edu).
# Dr. Thomas D. Economon (economon@stanford.edu).
#
# SU2 Developers: Prof.... | Heathckliff/MeshTools | Python/Expandp3d.py | Python | lgpl-2.1 | 2,183 |
# -*- coding: utf-8 -*-
"""
gitosis.access
~~~~~~~~~~~~~~
This module implements access control functions for :mod:`gitosis`.
:license: GPL
"""
import os
import logging
from gitosis import group as _group
def get_repository_prefix(config, group = None):
if group:
# do we have a specifi... | Necoro/gitosis | gitosis/access.py | Python | gpl-2.0 | 3,123 |
# -*- coding: utf-8 -*-
"""
Sanic implementation
"""
from sanic import response
from sanic import Blueprint
from random import getrandbits
class JobServer(object):
"""
A basic job server that will setup a couple routes.
The target usage is to encapsulate and expose a service that takes
some input a... | repodono/repodono.jobs | src/repodono/jobs/sanic.py | Python | gpl-2.0 | 5,298 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | ipagnn/datasets/control_flow_programs/control_flow_programs.py | Python | apache-2.0 | 14,062 |
# ===========================================================================
# Methods to validate edited quota info from form data and make changes
#
# (C) 2015 William Strecker-Kellogg <willsk@bnl.gov>
# ===========================================================================
from collections import defaultdict
f... | fubarwrangler/group-quota | gqweb/views/quota_edit.py | Python | gpl-2.0 | 2,087 |
__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2010 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from dolfin import *
from cbc.twist.kinematics import *
from sys import exit
class MaterialModel():
"""Base class for all hyperelastic materia... | hnarayanan/twist | cbc/twist/material_model_base.py | Python | gpl-3.0 | 6,009 |
# Lint as: python3
# 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 agr... | google/tf-quant-finance | tf_quant_finance/models/geometric_brownian_motion/univariate_geometric_brownian_motion.py | Python | apache-2.0 | 33,579 |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from parliament import views as pv
urlpatterns = [
url(r'^ajax/parliament-activity/$', pv.get_parliament_activity),
url(r'^ajax/mp-some-activity/$', pv.get_mp_some_acti... | kansanmuisti/kamu | urls.py | Python | agpl-3.0 | 2,166 |
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Tools.BoundFunction import boundFunction
from Components.Sources.StaticText import StaticText
from Components.ActionMap import ActionMap
from Components.ActionMap import NumberActionMap
from Components.Label import Label
from Components.co... | schleichdi2/openpli-e2 | lib/python/Screens/Ci.py | Python | gpl-2.0 | 24,266 |
# -*- coding: utf-8 -*-
from .models import Available_Veggie
| gitbenji/uru-crm | uru_crm/modules/veggies/__init__.py | Python | mit | 62 |
__author__ = 'msullivan'
from volt_modules import vagrant
vagrant.status('virtualbox')
vagrant.up('virtualbox')
vagrant.destroy('virtualbox') | MichaelSullivan/volt | volt.py | Python | apache-2.0 | 143 |
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ServicePosition import ServicePositionGauge
from Components.ActionMap import HelpableActionMap
from Components.MultiContent import MultiContentEntryText
from Components.ServiceEventTr... | kakunbsc/enigma2.1 | lib/python/Plugins/Extensions/CutListEditor/plugin.py | Python | gpl-2.0 | 13,349 |
# Copyright 2014 TellApart, 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 writi... | tellapart/taba | test/testing_bootstrap.py | Python | apache-2.0 | 763 |
import theano
from theano.tensor.signal.downsample import max_pool_2d
from .base import _dropout_from_layer_input
from .base import _make_images_from_vectors
from .base import _make_convolution_filters
from .base import _make_shared
class ConvolutionLayer(object):
def __init__(self,
rng = None,... | terkkila/cgml | cgml/layers/convolution_layer.py | Python | apache-2.0 | 2,699 |
# -*- coding: utf-8 -*-
#################################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under th... | litnimax/addons-yelizariev | project_description/__init__.py | Python | lgpl-3.0 | 1,062 |
import socket
import webbrowser
s = socket.socket()
host = 'localhost' # server address
port = 9010
s.connect((host, port))
url = s.recv(1024)
s.close
webbrowser.open_new(url)
s = socket.socket()
host = 'localhost'
port = 9010
s.bind((host, port))
s.listen(1)
c, addr = s.accept() # Establish connecti... | hackandcode/sniffnlearn | OAuth/client.py | Python | gpl-2.0 | 418 |
# Copyright 1999-2009 University of Chicago
#
# 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 t... | ellert/globus-toolkit | usage/python/tools/source/globus/usage/mpigpacket.py | Python | apache-2.0 | 2,485 |
from sunshine import create_app
app = create_app()
if __name__ == "__main__":
import sys
try:
port = int(sys.argv[1])
except (IndexError, ValueError):
port = 5000
app.run(debug=True, port=port)
| datamade/illinois-sunshine | runserver.py | Python | mit | 228 |
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License")... | alexryndin/ambari | ambari-agent/src/main/python/ambari_agent/Constants.py | Python | apache-2.0 | 831 |
# -*- coding: utf-8 -*-
# © 2012-2014 Guewen Baconnier (Camptocamp SA)
# © 2015 Roberto Lizana (Trey)
# © 2016 Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
from openerp.exceptions import Warning as UserError
import operator
import loggi... | rosenvladimirov/addons | partner_vat_search/models/res_partner.py | Python | agpl-3.0 | 1,819 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-23 08:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Restauran... | jojoriveraa/titulacion-NFCOW | NFCow/restaurants/migrations/0001_initial.py | Python | apache-2.0 | 656 |
from django.urls import path
from wagtail.snippets.views import chooser, snippets
app_name = 'wagtailsnippets'
urlpatterns = [
path('', snippets.index, name='index'),
path('choose/<slug:app_label>/<slug:model_name>/', chooser.ChooseView.as_view(), name='choose'),
path('choose/<slug:app_label>/<slug:mode... | gasman/wagtail | wagtail/snippets/urls.py | Python | bsd-3-clause | 1,648 |
#!/usr/bin/python
#
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | nearlyfreeapps/python-googleadwords | examples/adspygoogle/adwords/v201109/reporting/get_campaign_stats.py | Python | apache-2.0 | 3,041 |
# -*- 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-aiplatform | samples/generated_samples/aiplatform_v1beta1_generated_index_service_get_index_async.py | Python | apache-2.0 | 1,469 |
"""Remove organization.description.
Revision ID: 222b78a8508d
Revises: 6ebbe0cc8e19
Create Date: 2020-05-05 01:32:02.241787
"""
from alembic import op
from sqlalchemy.sql import column, table
import sqlalchemy as sa
from coaster.gfm import markdown
# revision identifiers, used by Alembic.
revision = '222b78a8508d'... | hasgeek/funnel | migrations/versions/222b78a8508d_remove_organization_description.py | Python | agpl-3.0 | 2,245 |
# Extensions of deuNet
| shenxudeu/deuNet | deuNet/nn_extensions/__init__.py | Python | mit | 23 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mosaic.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sema/django-2012 | website/manage.py | Python | mit | 249 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def inorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
... | yehzhang/RapidTest | examples/solutions/binary_tree_inorder_traversal.py | Python | mit | 604 |
"""
Invalidate cache manifest files every time they are requested.
"""
from time import time
MANIFEST_TYPE = 'text/cache-manifest'
class RepudiatorController(object):
"""
Invalidate a cache manifest file when it is loaded by
including a timestamp as a comment.
"""
def __init__(self, applicatio... | FND/tiddlyspace | tiddlywebplugins/tiddlyspace/repudiator.py | Python | bsd-3-clause | 2,047 |
# -*- coding: utf-8 -*-
"""
The "data" module provides several physical layers of data access to the wiki.
"""
#
# (C) Pywikipedia bot team, 2007
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id: 93e17a72eda3534f146c3d29c377dca1cde3e0d9 $'
# Import the classes exposed by this module:
# TODO
| wpoa/wiki-imports | lib/python2.7/site-packages/pywikibot-2.0b1-py2.7.egg/pywikibot/data/__init__.py | Python | gpl-3.0 | 318 |
# Copyright 2015, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.com>
#
# 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 requi... | docschick/tower-cli | lib/tower_cli/commands/config.py | Python | apache-2.0 | 6,352 |
from itertools import product
# Canada uses UPC too
from ..en_US import Provider as BarcodeProvider
class Provider(BarcodeProvider):
# Source of GS1 country codes: https://gs1.org/standards/id-keys/company-prefix
local_prefixes = (
# The source above doesn't specify prefixes 00~01, 06~09 to be used i... | danhuss/faker | faker/providers/barcode/en_CA/__init__.py | Python | mit | 536 |
###########################################################################
# (C) Vrije Universiteit, Amsterdam (the Netherlands) #
# #
# This file is part of AmCAT - The Amsterdam Content Analysis Toolkit #
# ... | amcat/amcat-scraping | amcatscraping/scrapers/newspapers/ad_rotterdam.py | Python | agpl-3.0 | 10,228 |
"""
This code is from MAD-X twiss.f90. It is used to allow comparisons between the MAD-X tensor and
the generated code for MAD8 or Transport style tensor computation.
"""
import numpy as np
from numpy import sqrt, cos, sin, cosh, sinh
zero = 0
one = 1
two = 2
three = 3
four = 4
six = 6
nine = 9
twelve = 12
fifteen = 1... | chernals/georges | georges/manzoni/maps/madx_combined_dipole.py | Python | gpl-3.0 | 11,408 |
class DuplicateProductInWishlist(Exception):
pass
| parisk/sockshop-wishlist | wishlist/wishlists/exceptions.py | Python | mit | 54 |
"""Support for Blinkstick lights."""
import logging
from blinkstick import blinkstick
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
LightEntity,
)
from homeassistant.const import CONF_NA... | tchellomello/home-assistant | homeassistant/components/blinksticklight/light.py | Python | apache-2.0 | 2,889 |
# Define here the link between the Name of the files and the classes
# Must be updated when a module is added
from PS.EA_PS_2042_06B import EA_PS204206B
from PS.EA_PSI_5080_10A import EA_PSI508010A
from PS.EA_PS_8360_10T import EA_PS836010T
# dict of the powersupplies names and their corresponding class
classDict = {
... | CerisicAsbl/pspsdaq | PS/__init__.py | Python | gpl-2.0 | 466 |
# -*- coding: utf-8 -*-
""" python-part of PythonCompleter
code/ideas taken from IPython, but IPython doesn't work with PythonQt...
Authors:
"Melven Zoellner" <melven@topen.org>
"""
# system imports
import sys
import rlcompleter
# adjust sys.path
dot_in_path = '.' in sys.path
if not dot_in_path:
sys.path.... | Orochimarufan/PythonQt | examples/NicePyConsole/PythonCompleter.py | Python | lgpl-2.1 | 4,878 |
#!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL
from youtube_dl.extractor import IqiyiIE
class IqiyiIEWithCredentials(IqiyiIE):... | israeltobias/DownMedia | youtube-dl/test/test_iqiyi_sdk_interpreter.py | Python | gpl-3.0 | 1,104 |
"""
verktyg.testsuite.test_http
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests for HTTP parsing utilities.
:copyright:
(c) 2015 Ben Mather, based on Werkzeug, see AUTHORS for more details.
:license:
BSD, see LICENSE for more details.
"""
import unittest
from datetime import datetime
from verk... | bwhmather/verktyg | verktyg/testsuite/test_http.py | Python | bsd-3-clause | 24,537 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2010 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from datetime import datetime
from getpass import getuser
from socket im... | alirizakeles/zato | code/zato-cli/src/zato/cli/create_odb.py | Python | gpl-3.0 | 1,843 |
# -*- coding: utf-8 -*-
__version__ = '0.2'
| bihealth/hlama | hlama/__init__.py | Python | mit | 45 |
""" Scapy extensions """
| troglobit/pyhacks | scapy_ext/__init__.py | Python | gpl-2.0 | 25 |
# flake8: noqa
import json
import logging
import os
logger = logging.getLogger(__name__)
CONFIG_FILE_PATH_ENV_PROPERTY_NAME = "REPOUR_CONFIG_FILE_PATH"
_cached_configuration = None
async def get_configuration():
return get_configuration_sync()
def get_configuration_sync():
global _cached_configuration
... | project-ncl/repour | repour/config/config.py | Python | apache-2.0 | 1,347 |
#
# Copyright 2015 Naver Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | naver/nbase-arc | smr/test/integrated/PgNew.py | Python | apache-2.0 | 5,494 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
def restart_program():
python = sys.executable
print python
os.execl(python, python, *sys.argv)
if __name__ == "__main__":
print 'start...'
print sys.argv
print "3秒后, 程序将结束..."
time.sleep(3)
restart_progra... | baixuexue123/note | python/others/restart_self.py | Python | bsd-2-clause | 338 |
import unittest
from opencog.type_constructors import *
from opencog.utilities import initialize_opencog, finalize_opencog
class LinkValueTest(unittest.TestCase):
def setUp(self):
self.space = AtomSpace()
initialize_opencog(self.space)
def tearDown(self):
finalize_opencog()
... | ngeiswei/atomspace | tests/cython/atomspace/test_linkvalue.py | Python | agpl-3.0 | 2,311 |
import pifacedigitalio as p
from flask import Flask
# initialisiere PiFace
p.init()
# initialisiere Flask server
app = Flask(__name__)
@app.route('/')
def info():
return 'PiFace HTTP-Schnittstelle'
@app.route('/<name>')
def hello(name):
return 'Hallo {}!'.format(name)
@app.route('/lampe1/ein')
def lampe1... | wichmann/RaspPI | http/piface_rest.py | Python | mit | 806 |
"""Test that sys.modules is used properly by import."""
from .. import util
from . import util as import_util
import sys
from types import MethodType
import unittest
class UseCache:
"""When it comes to sys.modules, import prefers it over anything else.
Once a name has been resolved, sys.modules is checked t... | michalliu/OpenWrt-Firefly-Libraries | staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/lib/python3.4/test/test_importlib/import_/test_caching.py | Python | gpl-2.0 | 3,643 |
from abc import ABCMeta, abstractmethod
class Component(object):
"""
Interface definition for a frontier component
The :class:`Component <frontera.core.components.Component>` object is the base class for frontier
:class:`Middleware <frontera.core.components.Middleware>` and
:class:`Backend <fronte... | sibiryakov/frontera | frontera/core/components.py | Python | bsd-3-clause | 3,506 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Sharing.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| XDSETeamA/XD_SE_TeamA | team9/1/Sharing/manage.py | Python | mit | 250 |
from unittest import TestCase
class FooTest(TestCase):
def setUp(self):
print(1)
@classmethod
def setUpClass(cls):
print(1)
def test_test(self):
print(3)
def test_2_test(self):
self.fail("D")
def tearDown(self):
print("A")
@classmethod
def t... | jwren/intellij-community | python/testData/testRunner/env/setup_teardown/test_test.py | Python | apache-2.0 | 361 |
""" Grades API URLs. """
from django.conf import settings
from django.conf.urls import (
patterns,
url,
)
from lms.djangoapps.grades.api import views
urlpatterns = patterns(
'',
url(
r'^v0/course_grade/{course_id}/users/$'.format(
course_id=settings.COURSE_ID_PATTERN
),
... | louyihua/edx-platform | lms/djangoapps/grades/api/urls.py | Python | agpl-3.0 | 390 |
"""empty message
Revision ID: 28ee28350b5
Revises: 24d412b2e3a
Create Date: 2015-03-22 13:38:11.471577
"""
# revision identifiers, used by Alembic.
revision = '28ee28350b5'
down_revision = '24d412b2e3a'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | PythonClutch/python-clutch | migrations/versions/28ee28350b5_.py | Python | mit | 1,324 |
# some modules use the old-style import: explicitly include
# the new module when the old one is referenced
hiddenimports = ["email.mime.text", "email.mime.multipart"]
| supercheetah/diceroller | pyinstaller/PyInstaller/hooks/hook-paste.exceptions.reporter.py | Python | artistic-2.0 | 169 |
#!/usr/bin/python2.7
#@Author: Aadesh Neupane
#Version: 0.0.1
##Program that implements Bayes Rule for spam filtering
import re
import math
#Simple Naive Bayes implementation for spam filtering
class BuildBayesModel():
#Variable defination for bayes model
def __init__(self,llist):
self.totalData=0
... | aadeshnpn/Naive-Bayes | bayesSpamFilter.py | Python | gpl-3.0 | 3,816 |
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "Lic... | sparkslabs/kamaelia_ | Sketches/TG/old_shard/partial/imfunctest.py | Python | apache-2.0 | 1,504 |
import heapq
import random
class myHeapContainer(list):
heap = None
is_max_heap = None
def _is_in_order(self, parent, child):
comp_val = parent > child
#print comp_val
if self.is_max_heap:
return comp_val
else:
return (not comp_val)
def __init__(self, arr = None, is_max = False):
self.is_max_heap... | mehmetg/python_scraps | heap_sort.py | Python | unlicense | 2,346 |
from rx.disposable import Disposable
from rx.observable import Producer
import rx.linq.sink
class Defer(Producer):
def __init__(self, observableFactory):
self.observableFactory = observableFactory
def run(self, observer, cancel, setSink):
sink = self.Sink(self, observer, cancel)
setSink(sink)
ret... | akuendig/RxPython | rx/linq/defer.py | Python | mit | 1,039 |
#/usr/bin/python python
# -*- coding: utf-8 -*-
import smtplib,random,os
fromaddr = os.environ.get('HR_SCRIPT_FROM_EMAIL')
frompasswd = os.environ.get('HR_SCRIPT_FROM_PASSWD')
toaddr = os.environ.get('HR_SCRIPT_TO_EMAIL')
msgs = [
"Hola! \n¿Podríais enviarme la nómina de este último mes? \n\nSaludos,\nRafa."... | relviratellez/my-scripts | hr_payroll_remember.py | Python | mit | 1,115 |
#!/usr/bin/env python2.7
import sys
import bitarray
import copy
from bitarray import bitarray
#Each fragment is simply two vectors of bits, for edges and boundary nodes
class AMRFragment(object):
def __init__(self, n_edges, n_nodes, graph):
self.edges = bitarray(n_edges)
if self.edges.count() != 0:
... | masterkeywikz/seq2graph | amr2seq/data_prep/amr_fragment.py | Python | mit | 18,785 |
def allLongestStrings(inputArray):
return [s for s in inputArray if len(s) == max([len(i) for i in inputArray])]
| gianimpronta/Codefights | Arcade/allLongestStrings.py | Python | mit | 117 |
import os
import matplotlib.pyplot as plt
import pytest
import pandas as pd
from plotnine import (ggplot, aes, geom_text, geom_point, facet_wrap,
ggsave, theme_xkcd)
from plotnine.data import mtcars
from plotnine.exceptions import PlotnineError, PlotnineWarning
p = (ggplot(aes(x='wt', y='mpg', ... | has2k1/plotnine | plotnine/tests/test_ggsave.py | Python | gpl-2.0 | 4,545 |
import cv2 as cv
import numpy as np
import logging
import os
from specularity_removal.homography import homography
RESULTS_DIR = 'results/'
DIFF_THRESHOLD = 20
def remove_specularity(img_files):
"""
Removes highlights/specularity in Images from multiple view points
:param img_files: File names of inpu... | gmichaeljaison/specularity-removal | specularity_removal/main.py | Python | gpl-3.0 | 3,017 |
from __future__ import unicode_literals
from datetime import date
import warnings
from django.test import override_settings
from django.utils.deprecation import RemovedInDjango20Warning
from .base import SitemapTestsBase
@override_settings(ROOT_URLCONF='django.contrib.sitemaps.tests.urls.https')
class HTTPSSitemap... | diegoguimaraes/django | django/contrib/sitemaps/tests/test_https.py | Python | bsd-3-clause | 3,224 |
#
# Copyright 2018 Analytics Zoo 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... | intel-analytics/analytics-zoo | pyzoo/test/zoo/orca/learn/ray/pytorch/conftest.py | Python | apache-2.0 | 1,280 |
import cpgintegrate
import random
import string
def test_ordering_sequence_unique():
items = {''.join(random.choices(string.ascii_letters, k=random.randrange(1, 10)))
for _ in range(20, random.randrange(200))}
sequences = [[] for _ in range(2, 20)]
for item in items:
random.choice(seq... | PointyShinyBurning/cpgintegrate | test/test_cpgintegrate.py | Python | agpl-3.0 | 497 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from erpnext.controllers.print_settings import print_settings_for_item_table
class DeliveryNo... | mahabuber/erpnext | erpnext/stock/doctype/delivery_note_item/delivery_note_item.py | Python | agpl-3.0 | 398 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
ASSET_STATUS = (
(str(1), u"使用中"),
(str(2), u"未使用"),
(str(3), u"故障"),
(str(4), u"其它"),
)
ASSET_TYPE = (
(str(1), u"物理机"),
(str(2), u"虚拟机"),
(str(3), u"容器"),
(str(4)... | cindywang0728/adminset | cmdb/models.py | Python | apache-2.0 | 4,038 |
"""
Constants used across the ORM in general.
"""
# Separator used to split filter strings apart.
LOOKUP_SEP = '__'
| ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/db/models/constants.py | Python | bsd-3-clause | 118 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Base class for RPC testing
# Add python-bitcoinrpc to module search path:
import os
import sys
import ... | BTCfork/hardfork_prototype_1_mvf-core | qa/rpc-tests/test_framework/test_framework.py | Python | mit | 7,360 |
from django.shortcuts import render
from index.models import Bulletin
# Create your views here.
def home(request):
bulletin_content = Bulletin.objects.all().order_by('-time')
return render(request, "base.html", {'bulletin': bulletin_content})
| ISeaTeL/ISeaTeL_Cup_Site | index/views.py | Python | mit | 255 |
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------------------------------... | ContinuumIO/ashiba | enaml/enaml/widgets/flow_item.py | Python | bsd-3-clause | 3,178 |
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozilla.org/MPL/
#
# Softwa... | archifix/settings | sublime/Packages/SublimeCodeIntel/libs/koXMLTreeService.py | Python | mit | 30,413 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Joel Grand-Guillaume. Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | charbeljc/account-financial-tools | account_constraints/__openerp__.py | Python | agpl-3.0 | 2,620 |
#! /usr/bin/env python3
import argparse
import json
import logging
import logging.config
import os
import sys
import time
from concurrent import futures
from datetime import datetime
# Add Generated folder to module path.
PARENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.... | qlik-oss/server-side-extension | examples/python/helloworld/__main__.py | Python | mit | 11,856 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2020, PyInstaller Development Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# The full license is in the file COPYING.txt, ... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_qt4plugins.py | Python | gpl-3.0 | 1,711 |
"""
Module contains paint application main tools.
"""
import os
import math
from gi.repository import GObject, Clutter
import cairo
import pisak
from pisak import res, widgets, layout, dirs, properties, utils, configurator
SAVE_FILE_BASENAME = "PISAK_paint_"
SAVE_DIR = dirs.get_user_dir("pictures")
class EaselTo... | BrainTech/pisak | pisak/paint/widgets.py | Python | gpl-3.0 | 30,426 |
# -*- coding: utf-8 -*-
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
from .encoding import Encoding
| endlessm/chromium-browser | third_party/chromite/lib/luci/prpc/__init__.py | Python | bsd-3-clause | 260 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.