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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
__author__ = "bt3"
from binary_search_tree import BST, Node
def find_ancestor(path, low_item, high_item):
while path:
current_item = path[0]
if current_item < low_item:
try:
path = path[2:]
except:
return current_item... | switchkiller/Python-and-Algorithms-and-Data-Structures | src/trees/check_ancestor.py | Python | mit | 1,369 |
# populator.py
# Backend code for populating a DeviceTree.
#
# Copyright (C) 2009-2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU Lesser General Public License v.2, or (at your option) any l... | kellinm/blivet | blivet/populator.py | Python | gpl-2.0 | 70,277 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# test_client modeltest urls
(r'^test_client/', include('modeltests.test_client.urls')),
(r'^test_client_regress/', include('regressiontests.test_client_regress.urls')),
# Always provide the auth system login and logout views
(r'^a... | jonaustin/advisoryscan | django/tests/urls.py | Python | mit | 584 |
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... | olt/mapproxy | mapproxy/util/lib.py | Python | apache-2.0 | 3,274 |
from collections import Counter
__author__ = 'pfeijao'
class DupGenome:
def __init__(self, name="", chr_list=None):
if not chr_list:
chr_list = []
self.name = name
self.chromosomes = list()
for gene_order in chr_list:
if isinstance(gene_order, DupChromosome... | pedrofeijao/RINGO | src/dcjdupindel/model.py | Python | mit | 2,083 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import os
import random
from modules.baseDrawClass import *
class DrawPicture(BaseDrawClass):
# noinspection PyUnusedLocal
def __init__(self, config, event_types, x1_y1, x2_y2, inner_offset, frame, h_align, v_align, narrow):
super(DrawPict... | denk-mal/tft-display | modules/drawPicture.py | Python | gpl-3.0 | 4,512 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/PyInstaller/hooks/hook-PyQt5.Qt.py | Python | gpl-3.0 | 1,274 |
# coding: utf-8
# Copyright (C) USC Information Sciences Institute
# Author: Vladimir M. Zaytsev <zaytsev@usc.edu>
# URL: <http://nlg.isi.edu/>
# For more information, see README.md
# For license information, see LICENSE
import collections
from mokujin.logicalform import POS
class AbsDependencyRelation(object):
... | zaycev/mokujin | mokujin/triples.py | Python | apache-2.0 | 23,551 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2013 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import omero
import omero.gateway
class TestHelperObjects (object):
def testColorHolder (self):
ColorHolder = omero.gateway.Color... | bramalingam/openmicroscopy | components/tools/OmeroPy/test/gatewaytest/test_helpers.py | Python | gpl-2.0 | 1,813 |
#!/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.
"""Generator for C++ structs from api json files.
The purpose of this tool is to remove the need for hand-written code that
convert... | AndroidOpenDevelopment/android_external_chromium_org | tools/json_schema_compiler/compiler.py | Python | bsd-3-clause | 6,642 |
from datetime import datetime
from sqlalchemy.orm import relationship, backref
from sqlalchemy.schema import Column, ForeignKey
from sqlalchemy.types import Integer, Unicode, DateTime
from openspending.model import meta as db
from openspending.model.dataset import Dataset
from openspending.model.source import Source
... | mxabierto/openspending | openspending/model/run.py | Python | agpl-3.0 | 2,667 |
import math
def isPrime(n):
if n <= 1:
return False
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
return False
return True
| ActiveState/code | recipes/Python/577079_Prime_detect/recipe-577079.py | Python | mit | 181 |
"""
Tests for export
"""
from __future__ import unicode_literals
from tempfile import mkdtemp, TemporaryFile
from shutil import rmtree
import os
from archive import Archive
from django.core.files import File
from django.core.files.storage import default_storage
from django.utils.text import slugify
from learningreso... | amir-qayyum-khan/lore | exporter/tests/test_export.py | Python | agpl-3.0 | 9,761 |
# -*- coding: utf-8 -*-
"""
Django antispam module aimed at Django with an invisible fake comment/contact form,
cookie based middleware and Akismet verification.
Djangospam is compatible with both Python 2 and 3.
See https://github.com/leandroarndt/djangospam for development versions..
Quick start
===========
These ... | leandroarndt/djangospam | djangospam/__init__.py | Python | bsd-2-clause | 6,779 |
import wx
import vtk
import time
import numpy
from vtk.util import numpy_support
from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor
from invesalius.pubsub import pub as Publisher
import invesalius.constants as const
import invesalius.data.vtk_utils as vtku
import invesalius.data.converters as... | paulojamorim/invesalius3 | invesalius/gui/bitmap_preview_panel.py | Python | gpl-2.0 | 21,360 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import leveldb
from scrapy.conf import settings
import logging
import json
from unqlite import UnQLite
class LeveldbPipeline(o... | steny138/PTTCrawler | ptt_crawler/pipelines.py | Python | apache-2.0 | 2,051 |
import os
import shutil
import codecs
import os.path
import traceback
from functools import partial
from carcade.conf import settings
from carcade.i18n import get_translations
from carcade.environments import create_jinja2_env, create_assets_env
from carcade.utils import sort, paginate, read_context
from carcade.excep... | aromanovich/carcade | carcade/core.py | Python | bsd-3-clause | 11,081 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-29 18:51
from __future__ import unicode_literals
import django.contrib.sites.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0002_set_site_domain_and_name'),
]
opera... | mekkagodzilla/mycollections | mycollections/contrib/sites/migrations/0003_auto_20160529_2051.py | Python | bsd-3-clause | 786 |
"""The tests for google-assistant init."""
import asyncio
from homeassistant.components import google_assistant as ga
from homeassistant.core import Context
from homeassistant.setup import async_setup_component
GA_API_KEY = "Agdgjsj399sdfkosd932ksd"
@asyncio.coroutine
def test_request_sync_service(aioclient_mock, h... | leppa/home-assistant | tests/components/google_assistant/test_init.py | Python | apache-2.0 | 880 |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | roadmapper/ansible | lib/ansible/modules/cloud/amazon/efs.py | Python | gpl-3.0 | 27,429 |
# OpenStreetMap URL views
from flask import Blueprint, Response
import os
from osmtile import TileSet, meta_load_one
from config import config
blueprint = Blueprint('map_views', __name__,
template_folder='templates', static_folder='static')
@blueprint.route('/tile/<int:z>/<int:x>/<int:y>.png')... | braddockcg/internet-in-a-box | iiab/map_views.py | Python | bsd-2-clause | 582 |
from typing import (Any, Dict, Tuple, List, NamedTuple, Union, Set, TypeVar,
Generic, Optional)
import numpy as np
import tensorflow as tf
from neuralmonkey.logging import notice
from neuralmonkey.model.model_part import ModelPart
# pylint: disable=invalid-name
FeedDict = Dict[tf.Tensor, Union[int,... | juliakreutzer/bandit-neuralmonkey | neuralmonkey/runners/base_runner.py | Python | bsd-3-clause | 2,727 |
# Copyright 2011 Nicholas Bray
#
# 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... | ncbray/pystream | bin/decompiler/flowblocks.py | Python | apache-2.0 | 14,412 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Aircraft.slug'
db.add_column(u'core_aircraft', 'slug',
... | WillsB3/Sim-Checklist | simchecklist/core/migrations/0008_auto__add_field_aircraft_slug__chg_field_checklistphase_slug.py | Python | mit | 2,870 |
# -*- coding: utf-8 -*-
"""
Tests date parsing functionality for all of the
parsers defined in parsers.py
"""
from distutils.version import LooseVersion
from datetime import datetime, date
import pytest
import numpy as np
from pandas._libs.tslibs import parsing
from pandas._libs.tslib import Timestamp
import pytz
i... | cython-testbed/pandas | pandas/tests/io/parser/parse_dates.py | Python | bsd-3-clause | 28,029 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | vthorsteinsson/tensor2tensor | tensor2tensor/models/shake_shake.py | Python | apache-2.0 | 7,998 |
#
# Copyright (c) 2008--2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | hustodemon/spacewalk | backend/common/rhnMail.py | Python | gpl-2.0 | 2,026 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | test/test_v1_project.py | Python | apache-2.0 | 1,236 |
# -*- coding: utf-8 -*-
# Copyright 2009,2014 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''This module contains helper classes for running external applications.
See L{zim.gui.applications} for classes with desktop integration for
applications defined in desktop entry files.
'''
import sys
import os
import logg... | Osndok/zim-desktop-wiki | zim/applications.py | Python | gpl-2.0 | 11,848 |
# Copyright 2014-2018 The PySCF Developers. 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 appl... | gkc1000/pyscf | pyscf/nao/m_vnucele_coo_subtract.py | Python | apache-2.0 | 1,215 |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer that transforms `xyzzy` into repr(xyzzy)."""
# Local imports
from .. import fixer_base
from ..fixer_util import Call, Name, parenthesize
class FixRepr(fixer_base.BaseFix):
BM_compatible = True
PATTE... | teeple/pns_server | work/install/Python-2.7.4/Lib/lib2to3/fixes/fix_repr.py | Python | gpl-2.0 | 614 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-monitor/azure/monitor/models/metric.py | Python | mit | 1,923 |
import pytest
import PIL
@pytest.fixture
def image():
return PIL.Image.new('RGBA', (200, 200))
| sacherjj/simple_zpl2 | tests/conftest.py | Python | mit | 101 |
# run python freetests.py while server is running
import urllib2
import unittest
BASEURL = "http://cmput410project15.herokuapp.com"
class TestYourWebserver(unittest.TestCase):
"""
Tests some the responses from the server with urllib2
"""
def setUp(self,baseurl=BASEURL):
self.baseurl = baseurl... | TeamUACS1/410Project | tests/testResponse.py | Python | apache-2.0 | 1,144 |
"""
PyColourChooser
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
This file is part of PyColourChooser.
This version of PyColourChooser is open source; you can redistribute it
and/or modify it under the licensed terms.
This program is distributed in the hope that it will be useful,
but WITHOUT... | ktan2020/legacy-automation | win/Lib/site-packages/wx-3.0-msw/wx/lib/colourchooser/canvas.py | Python | mit | 4,778 |
#!/usr/bin/python3
# File: owm.py
# Reading weather data from openweathermap network and compare with temperature local measured by DS18B20 sensor
# Install library: pip3 install w1thermsensor
# Data will be saved at Google spreadsheet
# Claus Kuehnel 2019-04-14 info@ckuehnel.ch
import urllib.request
import urllib.p... | ckuehnel/Omega2 | Openweathermap/owm.py | Python | gpl-2.0 | 2,991 |
from vsg.vhdlFile import utils
from vsg.vhdlFile.classify import entity_declarative_part
from vsg.vhdlFile.classify import entity_header
from vsg.vhdlFile.classify import entity_statement_part
from vsg.token import entity_declaration as token
def detect(iToken, lObjects):
'''
entity_declaration ::=
... | jeremiah-c-leary/vhdl-style-guide | vsg/vhdlFile/classify/entity_declaration.py | Python | gpl-3.0 | 1,973 |
# # 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/test_be_retry.py | Python | apache-2.0 | 3,504 |
# Copyright 2021 Leire Martinez de Santos - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': "Website Event Slides",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "http://www.avanzosc.es",
'category': 'website',
'version': '14.0.1.0.0',
'depend... | avanzosc/odoo-addons | website_event_slides/__manifest__.py | Python | agpl-3.0 | 467 |
from distutils.core import setup
setup(name='libzmx',
version='0.1.0',
package_dir={'libzmx': ''},
packages=['libzmx'],
)
| dariussullivan/libzmx | setup.py | Python | bsd-3-clause | 147 |
from datetime import datetime, timedelta
from flask import current_app
from flask_wtf import Form
import requests
from wtforms import HiddenField, StringField, IntegerField, BooleanField, \
SelectField, SelectMultipleField, TextAreaField, SubmitField, DateTimeField, validators
from .models import db, get_count, ... | ianzimmerman/gifoff | gifoff/forms.py | Python | mit | 3,325 |
"""Element family definitions."""
from siriuspy.namesys import join_name as _join_name
import pyaccel as _pyaccel
_family_segmentation = {
'B': 16, 'CH': 1, 'CV': 1, 'CHV': 1,
'QF2L': 1, 'QD2L': 1, 'QF3L': 1,
'Spect': 2,
'QD1': 1, 'QF1': 1, 'QD2A': 1, 'QF2A': 1, 'QF2B': 1, 'QD2B': 1,
'QF3': 1, 'QD... | lnls-fac/sirius | pymodels/TB_V03_02/families.py | Python | mit | 5,716 |
#!/usr/bin/python
#
# Copyright 2015 John Kendrick
#
# This file is part of PDielec
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied wa... | JohnKendrick/PDielec | PDielec/VaspOutputReader.py | Python | mit | 15,876 |
"""Support for MQTT lights."""
import logging
import voluptuous as vol
from homeassistant.components import mqtt
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_HS_COLOR,
ATTR_WHITE_VALUE,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR... | titilambert/home-assistant | homeassistant/components/mqtt/light/schema_basic.py | Python | apache-2.0 | 32,866 |
import os
import sys
import cPickle as pickle
import interface_umls
import time
import nltk
metamap = None
def umls_semantic_type_word( umls_string_cache , sentence ):
# Already cached?
if False and umls_string_cache.has_key( sentence ):
mapping = umls_string_cache.get_map( sentence )
else:
... | text-machine-lab/CliNER | code/feature_extraction/umls_dir/interpret_umls.py | Python | apache-2.0 | 11,714 |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | nijel/weblate | weblate/formats/tests/test_convert.py | Python | gpl-3.0 | 4,423 |
# with reverence, a port of http://codeforces.com/contest/478/submission/9123332
import fileinput, collections
### ###
# utility func #
### ###
dbug = True
def stoi(s):
return([ int(x) for x in s.split() ])
def pd(s, label=''):
global dbug
if dbug:
header = 'debug:'
if label != '':
head... | cripplet/practice | codeforces/478/attempt/d_towers.py | Python | mit | 1,526 |
import random
import json
from django.db import connection
from django.conf import settings
from sitemodel.interface import SiteInterface, SiteModel, random_str
from django.core.files import File
from server.models import Site, TextUpload, BinaryUpload
from sitemodel.frp.model import FRP_Category, FRP_Contact, FRP... | davidbarkhuizen/sdmm | django_web_server/sitemodel/frp/interface.py | Python | gpl-2.0 | 7,900 |
#!/usr/bin/env python
# copyright: B1 Systems GmbH <info@b1-systems.de>, 2013.
# 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
#
# Unl... | savinash47/openstack-doc-tools | cleanup/remove_unnecessary_spaces.py | Python | apache-2.0 | 2,062 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'OrganizationAward'
db.create_table(u'awards_organizationa... | us-ignite/us_ignite | us_ignite/awards/migrations/0004_auto__add_organizationaward.py | Python | bsd-3-clause | 21,697 |
"""Simple library for posting to Rocket.Chat via webhooks a.k.a. integrations.
The idea behind this library is to create Webhook object and then
post Messages with it. You can create Message object and fulfill it
with content (text and/or attachments) later.
Or you can just Webhook.quick_post('Your message') without ... | gevial/rockethook | rockethook/__init__.py | Python | mit | 5,214 |
#-*- coding: utf-8 -*-
from django.contrib.auth.models import User, AnonymousUser
from django.core.exceptions import FieldError
from django.core.servers.basehttp import FileWrapper
from django.http import StreamingHttpResponse
from rest_framework import viewsets, status, permissions, parsers, mixins
from rest_framewo... | gustavomazevedo/tbackup-server | server/views.py | Python | mit | 6,625 |
# encoding: utf8
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("auth", "__first__"),
]
operations = [
migrations.CreateModel(
"Book",
[
("id", models.Auto... | liavkoren/djangoDev | tests/migrations/test_migrations_unmigdep/0001_initial.py | Python | bsd-3-clause | 447 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Fasttransforms(MakefilePackage):
"""FastTransforms provides computational kernels and driv... | LLNL/spack | var/spack/repos/builtin/packages/fasttransforms/package.py | Python | lgpl-2.1 | 1,634 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2019 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | snapcore/snapcraft | tests/unit/meta/test_snap_packaging.py | Python | gpl-3.0 | 7,213 |
"""Linear inverse solvers based on L2 Minimum Norm Estimates (MNE)"""
from .inverse import (InverseOperator, read_inverse_operator, apply_inverse,
apply_inverse_raw, make_inverse_operator,
apply_inverse_epochs, write_inverse_operator,
compute_rank_inver... | effigies/mne-python | mne/minimum_norm/__init__.py | Python | bsd-3-clause | 568 |
# Copyright 2012, Nachi Ueno, NTT MCL, 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
#
# Unles... | CingHu/neutron-ustack | neutron/tests/unit/test_iptables_firewall.py | Python | apache-2.0 | 53,251 |
import pytest
import requests
class TestRemoveBuilds(object):
def test_builds_url(self, monkeypatch, mock_post, advisory):
monkeypatch.setattr(requests, 'post', mock_post)
advisory.removeBuilds(['ceph-12.2.5-42.el7cp'])
assert mock_post.response.url == 'https://errata.devel.redhat.com/api... | ktdreyer/errata-tool | errata_tool/tests/test_remove_builds.py | Python | mit | 3,321 |
# -*- coding: utf-8 -*-
import itsdangerous
class Faculty(object):
def __init__(self, mentors=None):
if not mentors:
self.mentors = []
else:
self.mentors = mentors
def __iter__(self):
return self.mentors.__iter__()
def __str__(self):
return str(map... | willprice/mentor-finder | mentor_finder/models/faculty.py | Python | gpl-3.0 | 964 |
import functools
import logging
import unittest
from unittest import mock
import pytest
from socketio import base_manager
from socketio import pubsub_manager
class TestPubSubManager(unittest.TestCase):
def setUp(self):
id = 0
def generate_id():
nonlocal id
id += 1
... | miguelgrinberg/python-socketio | tests/common/test_pubsub_manager.py | Python | mit | 13,469 |
from . import base
import threading
import uuid
import mmstats
from mmstats import _mmap
class TestMmStats(base.MmstatsTestCase):
def test_class_instances(self):
"""You can have 2 instances of an MmStats model without shared state"""
class LaserStats(mmstats.MmStats):
blue = mmstats.... | schmichael/mmstats | tests/test_mmstats.py | Python | bsd-3-clause | 5,893 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import traceback
import datetime
import os
import werkzeug
import werkzeug.routing
import werkzeug.utils
import odoo
from odoo import api, models
from odoo import SUPERUSER_ID
from odoo.http import reque... | richard-willowit/odoo | addons/website/models/ir_http.py | Python | gpl-3.0 | 8,811 |
#
# This file is part of Dragonfly.
# (c) Copyright 2018 by Dane Finlay
# Licensed under the LGPL.
#
# Dragonfly 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 3 of the License, or... | tylercal/dragonfly | dragonfly/test/test_contexts.py | Python | lgpl-3.0 | 4,426 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
from frappe import _
from frappe.utils import cstr, flt, get_link_to_form
import erpnext
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
... | mhbu50/erpnext | erpnext/hr/doctype/expense_claim/expense_claim.py | Python | gpl-3.0 | 13,124 |
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Speaker(models.Model):
full_name = models.CharField(max_length=200)
bio = models.TextField()
keynote = models.Boo... | pyvec/cz.pycon.org-2017 | pyconcz_2017/speakers/models.py | Python | mit | 3,969 |
# -*- coding: utf-8 -*-
from .nota import NotaFiscal
from pysignfe.cte import ProcessadorCTe
from pysignfe.cte.v300 import *
'''
Serviços:
-Recepção de CT-e
-Inutilização de Numeração de CT-e
-Consulta da situação atual do CT-e
-Registro de Evento de CT-e
*Cancelamento e Carta correção
*Faltam eventos: EPEC,... | thiagopena/PySIGNFe | pysignfe/ct_e.py | Python | lgpl-2.1 | 7,524 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/synapse/azure-synapse/azure/synapse/aio/operations_async/__init__.py | Python | mit | 862 |
#!/usr/bin/env python3
import json
import argparse
import requests
parser = argparse.ArgumentParser()
parser.add_argument("project_number", help="number of the HOT-OSM project")
args = parser.parse_args()
url = 'https://tasks.hotosm.org/api/v1/project/' + args.project_number
response = requests.get(url)
data = resp... | ernoma/ernoma.github.io | mapathon/YOUNITE_April2018/get_project_data.py | Python | mit | 492 |
#!/usr/bin/env python
# Media Dragon - the modular media manager
# Copyright (C) 2012 Brian Hrebec
#
# 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 y... | bhrebec/mediadragon | src/lib/ui/qt.py | Python | gpl-3.0 | 767 |
# ROI functions
import os
import cv2
import numpy as np
from plantcv.plantcv._debug import _debug
from plantcv.plantcv import fatal_error
from plantcv.plantcv import params
# Create an ROI from a binary mask
def from_binary_image(img, bin_img):
"""
Create an ROI from a binary image
Inputs:
img ... | danforthcenter/plantcv | plantcv/plantcv/roi/roi_methods.py | Python | mit | 12,658 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright 2013 Canonical Corp.
# 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
#
# htt... | openstack/nova | nova/tests/unit/virt/vmwareapi/test_vm_util.py | Python | apache-2.0 | 94,431 |
# If Statements
print("#If Statements")
a = 25
if a >= 25:
print("a is greater than 25")
elif a <= 25:
print("a is less than 25")
else:
print("ERROR")
print() | Guthans/Python-Beginnings | IFStatement.py | Python | gpl-3.0 | 170 |
# Copyright (c) 2018 PaddlePaddle 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 app... | jacquesqiao/Paddle | python/paddle/fluid/tests/book/high-level-api/recommender_system/test_recommender_system_newapi.py | Python | apache-2.0 | 8,507 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2012 Pexego Sistemas Informáticos All Rights Reserved
# $Marta Vázquez Rodríguez$ <marta@pexego.es>
#
# This program is free software: you can redistribute it and/or modify
# it unde... | Comunitea/CMNT_00040_2016_ELN_addons | performance_calculation/models/mrp_indicators.py | Python | agpl-3.0 | 7,917 |
import os
BASE_DIR = os.path.abspath(os.path.curdir)
BOTS_DIR = os.path.join(BASE_DIR, 'bots')
LOGS_DIR = os.path.join(BASE_DIR, 'logs')
CHECKPOINTS_DIR = os.path.join(BASE_DIR, '.checkpoints', '{}')
PATH_TO_CONFIG = os.path.abspath(os.path.join(BASE_DIR, 'config.yaml'))
| jumpman24/leela-analysis-36 | settings.py | Python | gpl-3.0 | 274 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-08-11 02:44
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("issuetracker", "0007_add_issue_report_initial_data"),
]
operations = [
migrations.Alt... | Nitrate/Nitrate | src/tcms/issuetracker/migrations/0008_add_validator_to_issue_tracker_name.py | Python | gpl-2.0 | 1,033 |
"""
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
from __future__ import unicode_literals
import mimetypes
import os
import posixpath
import re
import stat
from django.http import (
FileResponse, Http404, HttpRespons... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/django/views/static.py | Python | mit | 4,655 |
import glob
import six
import os
from keras.layers import concatenate, Conv2D, MaxPooling2D, Flatten, Dense
from keras import backend as K
from keras.applications import vgg16
from keras.callbacks import ModelCheckpoint, TensorBoard
from keras.engine import Input
from keras.engine import Model
from keras.layers.convolu... | andrewv587/pycharm-project | myFCN/myRegularizers.py | Python | apache-2.0 | 8,027 |
# Python test set -- built-in functions
import ast
import builtins
import collections
import io
import locale
import os
import pickle
import platform
import random
import sys
import traceback
import types
import unittest
import warnings
from operator import neg
from test.support import TESTFN, unlink, run_unittest, c... | michalliu/OpenWrt-Firefly-Libraries | staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/lib/python3.4/test/test_builtin.py | Python | gpl-2.0 | 58,758 |
import stub_webserver
import cherrypy
import json
"""
Stub webserver to emulate the acquisition server
Client -> Server (Register UID=nnnnnn)
"""
cherrypy.server.socket_host = '0.0.0.0'
tests=[]
tests.append({"test":"reboot","validator":"Endvalidator"})
if __name__ == '__main__':
stub_webserver.tests=tests
c... | raqet/acquisition-client | testing/stub_webserver_reboot.py | Python | gpl-3.0 | 371 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'imagebrowser.ui'
#
# Created: Tue Mar 27 15:10:12 2012
# by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUt... | jromang/retina-old | ui_imagebrowser.py | Python | gpl-3.0 | 5,560 |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import os
class Plot:
"Set all parameters needed to print burndown charts"
def __init__ (self, data):
self.data = data
figure_width = 11
figure_height = 6
self.plot_count = 0
self.setXKCD()
self.createFigure(figure_width, figure_heig... | openSUSE/trollolo | scripts/plot.py | Python | gpl-3.0 | 5,342 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pant... | qma/pants | contrib/go/tests/python/pants_test/contrib/go/tasks/test_go_compile_integration.py | Python | apache-2.0 | 1,553 |
"""Support for VeSync fans."""
import logging
from homeassistant.components.fan import (
SPEED_HIGH,
SPEED_LOW,
SPEED_MEDIUM,
SPEED_OFF,
SUPPORT_SET_SPEED,
FanEntity,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .common im... | tchellomello/home-assistant | homeassistant/components/vesync/fan.py | Python | apache-2.0 | 3,397 |
<<<<<<< HEAD
<<<<<<< HEAD
import unittest
from test import support
import collections, random, string
import collections.abc
import gc, weakref
import pickle
class DictTest(unittest.TestCase):
def test_invalid_keyword_arguments(self):
class Custom(dict):
pass
for invalid in {1 : 2}, ... | ArcherSys/ArcherSys | Lib/test/test_dict.py | Python | mit | 91,142 |
# -*- coding: utf-8 -*-
"""Common interface for show media content services"""
#
# Author: Andrea Stagi (aka 4ndreaSt4gi)
# 2010-08-01
import re
import logging
import requests
from libturpial.lib.interfaces.service import GenericService
class PreviewMediaService(GenericService):
def __init__(self):
sel... | satanas/libturpial | libturpial/lib/services/media/preview/base.py | Python | gpl-3.0 | 815 |
# Check the basic discovery process, including a sub-suite.
#
# RUN: %{lit} %{inputs}/discovery \
# RUN: -j 1 --debug --show-tests --show-suites \
# RUN: -v > %t.out 2> %t.err
# RUN: FileCheck --check-prefix=CHECK-BASIC-OUT < %t.out %s
# RUN: FileCheck --check-prefix=CHECK-BASIC-ERR < %t.err %s
#
# CHECK-BASIC-ERR:... | sabel83/metashell | 3rd/templight/llvm/utils/lit/tests/discovery.py | Python | gpl-3.0 | 8,236 |
from django.conf import settings
from django.contrib import auth
from django.contrib.admin import AdminSite
from django.contrib.admin.models import LogEntry
from downtime.models import Period
from eultheme.models import Banner
from logentry_admin.admin import LogEntryAdmin
import sequences
class PidmanAdminSite(Admi... | emory-libraries/pidman | pidman/admin.py | Python | apache-2.0 | 1,266 |
from models import am2, am2_reyoi, dargan, dargan_T42, idealized_moist_rad
| spencerkclark/aospy-obj-lib | aospy_user/models/__init__.py | Python | gpl-3.0 | 75 |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.monitoring_v3.proto import (
alert_pb2 as google_dot_cloud_dot_monitoring__v3_dot_proto_dot_alert__pb2,
)
from google.cloud.monitoring_v3.proto import (
alert_service_pb2 as google_dot_cloud_dot_monitoring__v3_d... | dhermes/gcloud-python | monitoring/google/cloud/monitoring_v3/proto/alert_service_pb2_grpc.py | Python | apache-2.0 | 7,568 |
'''
Created on 23 Jul 2009
@author: charanpal
'''
from exp.sandbox.data.ExamplesList import ExamplesList
from apgl.graph.DictGraph import DictGraph
from apgl.graph.SparseGraph import SparseGraph
from sandbox.util.Parameter import Parameter
import numpy
class EgoSimulator:
"""
A class which simula... | charanpald/wallhack | wallhack/egograph/EgoSimulator.py | Python | gpl-3.0 | 7,289 |
#!/usr/bin/env python
# Copyright (c) 2012-2013 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implement... | yb-kim/gemV | util/cpt_upgrader.py | Python | bsd-3-clause | 13,812 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Soldeva, SRL and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestLoanApplication(unittest.TestCase):
pass
| YefriTavarez/finance_manager | fm/finance_manager/doctype/loan_application/test_loan_application.py | Python | gpl-3.0 | 218 |
# Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test maasserver account views."""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all__ ... | cloudbase/maas | src/maasserver/tests/test_views_account.py | Python | agpl-3.0 | 1,625 |
from django import forms
from django.forms.models import ModelForm
from .models import Alert, AlertType, AlertUpdate, AlertEmailTemplate
from django.template import Template, TemplateSyntaxError
class AlertTypeForm(ModelForm):
class Meta:
model = AlertType
exclude = ('hidden', 'config')
class Ema... | sfu-fas/coursys | oldcode/alerts/forms.py | Python | gpl-3.0 | 1,401 |
from django.core.exceptions import ObjectDoesNotExist
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_required,
webapi_request_fields,
webapi_response_errors)
from djblets.webapi.err... | reviewboard/reviewboard | reviewboard/webapi/resources/draft_filediff.py | Python | mit | 6,324 |
import sys
tagging_filepath = sys.argv[1]
following_filepath = sys.argv[2]
delim = '\t'
if len(sys.argv) > 3:
delim = sys.argv[3]
graph = {}
for line in open(tagging_filepath):
entry = line.rstrip().split('\t')
src = entry[0]
dst = entry[1]
if not src in graph: graph[src] = {}
graph[src][dst]... | yamaguchiyuto/icwsm15 | tag_follow_disagreement.py | Python | mit | 857 |
from django.conf.urls import url
from .views import (
CommentCreateAPIView,
CommentListAPIView,
CommentDetailAPIView
)
app_name = 'comments'
urlpatterns = [
url(r'^$', CommentListAPIView.as_view(), name='list'),
url(r'^create/$', CommentCreateAPIView.as_view(), name='create'),
url(... | shawon922/django-blog-api | comments/api/urls.py | Python | mit | 393 |
# PyBigPixel Creator software converts your digital images to pixel patterns.
#
# PyBigPixel Creator 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 l... | SWE-JSAM/PyBigPixel-creator | pybigpixel/prepare.py | Python | gpl-3.0 | 2,683 |
from __future__ import absolute_import
from sqlalchemy import types
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.dialects.postgresql.base import ischema_names, PGTypeCompiler
from sqlalchemy.sql import expression
from ..primitives import Ltree
from .scalar_coercible import ScalarCoercible
class ... | konstantinoskostis/sqlalchemy-utils | sqlalchemy_utils/types/ltree.py | Python | bsd-3-clause | 3,375 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.