text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | bikeNomad/mbed | workspace_tools/synch.py | Python | apache-2.0 | 11,453 | 0.005413 |
#!/usr/bin/env python
#
#
"""Test harness for the logging module. Tests BufferingSMTPHandler, an alternative implementation
of SMTPHandler.
Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.
Modified to handle SMTP_SSL connections
"""
import string, logging, logging.handlers
from logging import Formatter
cl... | gary-dalton/Twenty47 | twenty47/logging.py | Python | mit | 3,990 | 0.003509 |
# -*- coding: utf-8 -*-
from django.test import TestCase
import mock
import datetime
from dateutil import tz
## Repository Test
from porchlightapi.models import Repository
# Constant values used for testing
UNDEPLOYED_VALUE_TUPLE = ('c9d2d5b79edd7d4acaf7172a98203bf3aee2586a',
datetime.dat... | cfpb/porchlight | porchlightapi/tests.py | Python | cc0-1.0 | 12,039 | 0.004902 |
"""
* Copyright (C) Caleb Marshall and others... - All Rights Reserved
* Written by Caleb Marshall <anythingtechpro@gmail.com>, May 27th, 2017
* Licensing information can found in 'LICENSE', which is part of this source code package.
"""
import struct
class Endianness(object):
"""
A enum that stores networ... | AnythingTechPro/curionet | curionet/io.py | Python | apache-2.0 | 3,368 | 0.001485 |
#!/usr/bin/python
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | GoogleCloudPlatform/datacatalog-connectors-bi | google-datacatalog-sisense-connector/tests/google/datacatalog_connectors/sisense/prepare/assembled_entry_factory_test.py | Python | apache-2.0 | 13,804 | 0 |
from django import forms
from django.contrib.auth.models import User
from django.forms import ModelForm
from django.db import models
# Create your models here.
#EDICION DE MODELO USER
User.add_to_class('usuario_sico', models.CharField(max_length=10, null=False, blank=False))
User.add_to_class('contrasenia_sico', mode... | Titulacion-Sistemas/PracticasDjango | usuarios_logueados/usuarios/models.py | Python | gpl-2.0 | 791 | 0.011378 |
"""pytest_needle.driver
.. codeauthor:: John Lane <jlane@fanthreesixty.com>
"""
import base64
from errno import EEXIST
import math
import os
import re
import sys
import pytest
from needle.cases import import_from_string
from needle.engines.pil_engine import ImageDiff
from PIL import Image, ImageDraw, ImageColor
from... | jlane9/pytest-needle | pytest_needle/driver.py | Python | mit | 13,087 | 0.00214 |
#!/usr/bin/env/ python
'''
Title - Create multi-signature address
'''
# Import bitcoin
from bitcoin import *
my_private_key1 = random_key()
my_private_key2 = random_key()
my_private_key3 = random_key()
print("Private Key1: %s\n" % my_private_key1)
print("Private Key2: %s\n" % my_private_key2)
print("Priv... | codevan/codevan | BitcoinPlay/multisig_address.py | Python | apache-2.0 | 911 | 0.004391 |
"""
@Author: Kiran Gurajala & Alex Lee
@Project: Project Automail
@Version: 1.0
"""
# Required imports
import struct
# Utils
def pack(fmt, *args):
return struct.pack('<' + fmt, *args)
def unpack(fmt, *args):
return struct.unpack('<' + fmt, *args)
def multichr(values):
return ''.join(map(chr, values))
def multi... | ThermoNuclearPanda/Project_Automail | Python Files/utilities.py | Python | mit | 358 | 0.022346 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""JabberHooky"""
__name__ = "jabberhooky"
__author__ = 'Shane R. Spencer'
__email__ = "shane@bogomip.com"
__license__ = 'MIT'
__copyright__ = '2012 Shane R. Spencer'
__version__ = '0.0.1'
__status__ = "Prototype"
| whardier/jabberhooky | jabberhooky/__init__.py | Python | mit | 263 | 0.003802 |
import sys, os
import vecrec
## General
project = u'vecrec'
copyright = u'2015, Kale Kundert'
version = vecrec.__version__
release = vecrec.__version__
master_doc = 'index'
source_suffix = '.rst'
templates_path = ['templates']
exclude_patterns = ['build']
default_role = 'any'
pygments_style = 'sphinx'
## Extensions... | kxgames/vecrec | docs/conf.py | Python | mit | 857 | 0.007001 |
import datetime
import re
import time
import urllib
from typing import Any, Dict, List, Optional, Sequence
from unittest.mock import MagicMock, patch
from urllib.parse import urlencode
import orjson
from django.conf import settings
from django.contrib.auth.views import PasswordResetConfirmView
from django.contrib.cont... | punchagan/zulip | zerver/tests/test_signup.py | Python | apache-2.0 | 225,136 | 0.002394 |
"""
WSGI config for billboards project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... | serefimov/billboards | billboards/billboards/wsgi.py | Python | mit | 1,568 | 0.001276 |
from django.db import models
from django.db.models import OuterRef, Subquery, Count
from django.db.models.functions import Coalesce
class GalleryManager(models.Manager):
def annotated_gallery(self):
"""Annotate gallery with
- ``linked_content``, which contains the pk of the associated content if ... | ChantyTaguan/zds-site | zds/gallery/managers.py | Python | gpl-3.0 | 1,665 | 0.003003 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgsrulebasedrenderer.py
---------------------
Date : September 2015
Copyright : (C) 2015 by Matthias Kuhn
Email : matthias at opengis dot ch
*******... | rduivenvoorde/QGIS | tests/src/python/test_qgsrulebasedrenderer.py | Python | gpl-2.0 | 23,130 | 0.002335 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0019_auto_20140909_1253'),
]
operations = [
migrations.AlterModelOptions(
name='donationitemcategory',
... | klpdotorg/dubdubdub | apps/users/migrations/0020_auto_20140925_1129.py | Python | mit | 905 | 0.00221 |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# 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... | huggingface/pytorch-transformers | utils/get_modified_files.py | Python | apache-2.0 | 1,484 | 0.003369 |
# ------------------------------------------------------------------------------
#
class Attributes (object) :
# FIXME: add method sigs
# --------------------------------------------------------------------------
#
def __init__ (self, vals={}) :
raise Exception ("%s is not implemented" % se... | JensTimmerman/radical.pilot | docs/architecture/api_draft/attributes.py | Python | mit | 430 | 0.011628 |
'''-------------------------------------------------------------------------
Copyright IBM Corp. 2015, 2015 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/... | hroumani/genericStorletStore | storletDeploy/sys_test_params.py | Python | apache-2.0 | 1,153 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('labman_setup', '0003_googlesearchscript'),
]
operations = [
migrations.AddField(
model_name='labmandeploygeneral... | morelab/labman_ud | labman_ud/labman_setup/migrations/0004_labmandeploygeneralsettings_background_color.py | Python | gpl-3.0 | 494 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | fogbow/fogbow-dashboard | horizon/templatetags/horizon.py | Python | apache-2.0 | 4,349 | 0.00046 |
"""Monitor the transaction log for changes that should be synced back to the
account backend.
TODO(emfree):
* Track syncback failure/success state, and implement retries
(syncback actions may be lost if the service restarts while actions are
still pending).
* Add better logging.
"""
import gevent
from sqlalche... | rmasters/inbox | inbox/transactions/actions.py | Python | agpl-3.0 | 3,454 | 0 |
# Copyright 2019 Google LLC 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 or ag... | GoogleCloudPlatform/python-docs-samples | datastore/cloud-ndb/flask_app.py | Python | apache-2.0 | 1,175 | 0 |
"""
Command.py
"""
from abc import ABCMeta, abstractmethod
class Command(object):
__metaclass__ = ABCMeta
@abstractmethod
def execute(self):
pass
@abstractmethod
def unexecute(self):
pass
| Sunhick/design-patterns | Behavioral/Command/Command.py | Python | gpl-3.0 | 230 | 0.008696 |
from __future__ import absolute_import, unicode_literals
from case import Mock
from celery.worker.heartbeat import Heart
class MockDispatcher(object):
heart = None
next_iter = 0
def __init__(self):
self.sent = []
self.on_enabled = set()
self.on_disabled = set()
self.enab... | kawamon/hue | desktop/core/ext-py/celery-4.2.1/t/unit/worker/test_heartbeat.py | Python | apache-2.0 | 1,829 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from xml.parsers.expat import ParserCreate
class DefaultSaxHandler(object):
def start_element(self, name, attrs):
print('sax:start_element: %s, attrs: %s' % (name, str(attrs)))
def end_element(self, name):
print('sax:end_element: %s' % name)
... | whyDK37/py_bootstrap | samples/commonlib/use_sax.py | Python | apache-2.0 | 739 | 0 |
# Copyright 2013 dotCloud 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 t... | shakamunyi/docker-py | docker/unixconn/unixconn.py | Python | apache-2.0 | 3,189 | 0 |
from six import string_types
from pypif.obj.common.pio import Pio
class Instrument(Pio):
"""
Information about an instrument used to take a measurement.
"""
def __init__(self, name=None, model=None, producer=None, url=None, tags=None, **kwargs):
"""
Constructor.
:param name: ... | CitrineInformatics/pypif | pypif/obj/common/instrument.py | Python | apache-2.0 | 2,048 | 0.000977 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2019-12-13 07:44
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | stvstnfrd/edx-platform | openedx/core/djangoapps/programs/migrations/0013_customprogramsconfig.py | Python | agpl-3.0 | 1,294 | 0.003864 |
#!Measurement
'''
baseline:
after: true
before: false
counts: 180
detector: H1
mass: 34.2
settling_time: 20.0
default_fits: nominal
equilibration:
eqtime: 1.0
inlet: R
inlet_delay: 3
outlet: O
use_extraction_eqtime: true
post_equilibration_delay: 5
multicollect:
counts: 600
detector: H1
is... | USGSDenverPychron/pychron | docs/user_guide/operation/scripts/examples/argus/measurement/jan_unknown_air_for_38Ar_600_180.py | Python | apache-2.0 | 2,496 | 0.014824 |
#
# author: Cosmin Basca
#
# Copyright 2010 University of Zurich
#
# 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 a... | cosminbasca/rdftools | rdftools/tools/jvmrdftools/__init__.py | Python | apache-2.0 | 3,224 | 0.001861 |
import json
from django import http
from django.conf import settings
from rmr.types import JsonDict
class RequestDecoder:
content_type = 'application/json'
allowed_methods = {
'POST', 'PUT', 'PATCH',
}
def process_request(self, request):
if request.method not in self.allowed_metho... | RedMadRobot/rmr_django | rmr/middleware/json.py | Python | mit | 1,109 | 0 |
#!/usr/bin/python
"""
Copyright 2012
Anton Zering <synth@lostprofile.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-2.0
Unless required by applicabl... | synthomat/irc_topology_drawer | irc_topology_drawer.py | Python | apache-2.0 | 2,147 | 0.01211 |
# -------------------------------------------------------------------------------
# mmc.py
#
# Customization of GnuHealth for the needs of Mercy Maternity Clinic, Inc.
# -------------------------------------------------------------------------------
from trytond.model import ModelView, ModelSingleton, ModelSQL, fields
... | kbsymanz/gnuhealth_mmc | mmc.py | Python | mit | 35,273 | 0.003714 |
from django.conf.urls import url
from django.core.exceptions import PermissionDenied
from django.template.response import TemplateResponse
from django.test import SimpleTestCase, override_settings
def template_response_error_handler(request, exception=None):
return TemplateResponse(request, 'test_handler.html', s... | jejimenez/django | tests/handlers/tests_custom_error_handlers.py | Python | bsd-3-clause | 888 | 0 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2005, 2006 Async Open Source
##
## This program 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 2
## of the Licen... | andrebellafronte/stoq | stoqlib/gui/base/slaves.py | Python | gpl-2.0 | 1,749 | 0.007433 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Johann Prieur <johann.prieur@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) an... | emesene/papyon | papyon/service/description/OIM/Store2.py | Python | gpl-2.0 | 3,213 | 0.009648 |
import smtplib
from decimal import Decimal
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
Group as DjangoGroup,
GroupManager as _GroupManager,
Permission,
PermissionsMixin,
)
from... | jwinzer/OpenSlides | server/openslides/users/models.py | Python | mit | 12,597 | 0.001111 |
from vsg.rules import token_prefix
from vsg import token
lTokens = []
lTokens.append(token.signal_declaration.identifier)
class rule_008(token_prefix):
'''
This rule checks for valid prefixes on signal identifiers.
Default signal prefix is *s\_*.
|configuring_prefix_and_suffix_rules_link|
**V... | jeremiah-c-leary/vhdl-style-guide | vsg/rules/signal/rule_008.py | Python | gpl-3.0 | 705 | 0.001418 |
#!/usr/bin/env python
# Copyright (C) 2009-2010:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the F... | xorpaul/shinken | test/test_parse_perfdata.py | Python | agpl-3.0 | 4,222 | 0.002842 |
#===========================================================================
# Copyright (c) 2011-2012, the PyFACT developers
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributio... | mraue/pyfact | pyfact/map.py | Python | bsd-3-clause | 11,616 | 0.008351 |
"""
pimpy.video.features.surf : enable to compute a video signature
.. module:: surf
:synopsis: Tools for video
:platform: Unix, Mac, Windows
.. moduleauthor:: Sebastien Campion <sebastien.campion@inria.fr>
"""
# pimpy
# Copyright (C) 2010 Sebastien Campion <sebastien.campion@inria.fr>
#
# pimpy is free soft... | scampion/pimpy | pimpy/video/features/surf.py | Python | agpl-3.0 | 2,428 | 0.011532 |
#!/usr/bin/python
###############################################################################
# NAME: new_graphics3.py
# VERSION: 2.0.0b15 (18SEPTEMBER2006)
# AUTHOR: John B. Cole, PhD (jcole@aipl.arsusda.gov)
# LICENSE: LGPL
###############################################################################
from PyP... | wintermind/pypedal | PyPedal/examples/new_graphics3.py | Python | gpl-2.0 | 1,123 | 0.007124 |
import django_filters
from django_filters import rest_framework as filters
from django_rv_apps.apps.believe_his_prophets.models.spirit_prophecy_chapter import SpiritProphecyChapter, SpiritProphecyChapterLanguage
from django_rv_apps.apps.believe_his_prophets.models.spirit_prophecy import SpiritProphecy
from django_rv_... | davrv93/creed-en-sus-profetas-backend | django_rv_apps/apps/believe_his_prophets_api/views/spirit_prophecy_chapter_language/filters.py | Python | apache-2.0 | 1,155 | 0.013853 |
# -*- coding: utf-8 -*-
"""Stdout, stderr and argv support for unicode."""
##############################################
# Support for unicode in windows cmd.exe
# Posted on Stack Overflow [1], available under CC-BY-SA 3.0 [2]
#
# Question: "Windows cmd encoding change causes Python crash" [3] by Alex [4],
# Answered... | icyflame/batman | pywikibot/userinterfaces/win32_unicode.py | Python | mit | 12,438 | 0.001769 |
"""The macros below aren't reliable (e.g., some fail if ``arg_string`` is `None`)
or safe (``include`` doesn't guard against circular reference). For a more complete example, see
`the code used in the sandbox <http://code.google.com/p/urlminer/source/browse/examples/wiki/macros.py>`_.
"""
import genshi.builder as... | hprid/creoleparser | creoleparser/test_cheat_sheet_plus.py | Python | mit | 2,923 | 0.021895 |
import unittest
from hwt.code import If, Switch
from hwt.synthesizer.rtlLevel.netlist import RtlNetlist
class AstNodeIoReplacingTC(unittest.TestCase):
def sigs_by_n(self, n):
nl = RtlNetlist()
sigs = [nl.sig(chr(ord("a") + i)) for i in range(n)]
for s in sigs:
s.hidden = Fals... | Nic30/hwtLib | hwtLib/tests/synthesizer/astNodeIoReplacing_test.py | Python | mit | 2,912 | 0.008242 |
from PIL import Image
import os.path,os
#import pickle
#import sqlite3
import hashlib
import time
import random
import logging
import copy
import threading
import itertools
from math import ceil
from enum import Enum
from copy import deepcopy
import itertools
from lipyc.utility import recursion_protect
from lipyc.Ver... | severus21/LiPyc | src/Album.py | Python | apache-2.0 | 4,909 | 0.020371 |
import math
import random
import operator
import traceback
from .titanic import ndarray
from .fpbench import fpcparser
from .arithmetic import mpmf, ieee754, posit, fixed, evalctx, analysis
from .arithmetic.mpmf import Interpreter
from .sweep import search
from .sweep.utils import *
dotprod_naive_template = '''(FPCo... | billzorn/fpunreal | titanfp/vec_sweep.py | Python | mit | 11,896 | 0.00269 |
# -*- coding: utf-8 -*-
#
# Cheroke-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2009-2010 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free So... | mdavid/cherokee-webserver-svnclone | admin/plugins/wildcard.py | Python | gpl-2.0 | 3,364 | 0.012485 |
import unittest
from test import support
import io # C implementation.
import _pyio as pyio # Python implementation.
# Simple test to ensure that optimizations in the IO library deliver the
# expected results. For best testing, run this under a debug-build Python too
# (to exercise asserts in the C code).
lengths =... | 837468220/python-for-android | python3-alpha/python3-src/Lib/test/test_bufio.py | Python | apache-2.0 | 2,654 | 0.002638 |
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.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 License,... | bram85/topydo | topydo/lib/Todo.py | Python | gpl-3.0 | 3,165 | 0 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
from __future__ import print_function
__author__ = 'gpanda'
"""References:
[1] easy thread-safe queque, http://pymotw.com/2/Queue/
"""
import argparse
import collections
import fileinput
import os
import pprint
import re
import string
import sys
import threading
import ... | gpanda/abrisk | fundlist.py | Python | gpl-2.0 | 8,887 | 0.000788 |
#
# Functions for interacting with the network_types table in the database
#
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
from PLC.Faults import *
from PLC.Parameter import Parameter
from PLC.Table import Row, Table
class NetworkType(Row):
"""
Representat... | dreibh/planetlab-lxc-plcapi | PLC/NetworkTypes.py | Python | bsd-3-clause | 1,417 | 0.008469 |
from setuptools import setup
setup(
name="example",
version="0.1",
py_modules=["readdir"],
setup_requires=["cffi>=1.0.dev0"],
cffi_modules=["readdir_build.py:ffi"],
install_requires=["cffi>=1.0.dev0"],
zip_safe=False,
)
| hipnusleo/laserjet | resource/pypi/cffi-1.9.1/demo/readdir_setup.py | Python | apache-2.0 | 260 | 0 |
from unittest.mock import patch
from django.http import HttpRequest
from django.test import override_settings
from django.utils.timezone import now
from axes.attempts import get_cool_off_threshold
from axes.models import AccessAttempt
from axes.utils import reset, reset_request
from tests.base import AxesTestCase
c... | jazzband/django-axes | tests/test_attempts.py | Python | mit | 5,846 | 0 |
from os.path import expanduser
######################
# Common project files
######################
# These are files, packages, and folders that will be copied from the
# development folder to the destination obfuscated project.
######################
# Python packages to obfuscate.
obfuscated_packages = [
'con... | rdevost/pymixup | common/settings.py | Python | mit | 4,238 | 0 |
from __future__ import print_function, division, absolute_import
from . import imgaug as ia
from .parameters import StochasticParameter, Deterministic, Binomial, Choice, DiscreteUniform, Normal, Uniform
from abc import ABCMeta, abstractmethod
import random
import numpy as np
import copy as copy_module
import re
import ... | CKboss/TheBauble | Tensorflow/CNN/ResNet/imgaug/augmenters.py | Python | gpl-3.0 | 129,266 | 0.003458 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : Dockable MirrorMap
Description : Creates a dockable map canvas
Date : February 1, 2011
copyright : (C) 2011 by Giuseppe Sucameli (Faunalia)
email ... | alfanugraha/LUMENS-repo | processing/DockableMirrorMap/dockableMirrorMapPlugin.py | Python | gpl-2.0 | 8,306 | 0.032145 |
"""
The command template for the default MUX-style command set. There
is also an Player/OOC version that makes sure caller is a Player object.
"""
from evennia.utils import utils
from evennia.commands.command import Command
# limit symbol import for API
__all__ = ("MuxCommand", "MuxPlayerCommand")
class MuxCommand(C... | emergebtc/muddery | evennia/evennia/commands/default/muxcommand.py | Python | bsd-3-clause | 8,473 | 0.002124 |
"""Helpers for components that manage entities."""
import asyncio
from datetime import timedelta
from itertools import chain
import logging
from homeassistant import config as conf_util
from homeassistant.setup import async_prepare_setup_platform
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_SCAN_INTERVAL... | tinloaf/home-assistant | homeassistant/helpers/entity_component.py | Python | apache-2.0 | 10,538 | 0 |
"""
Given a KVM machine description file, parse its XML
and change the contents of the nodes "name" and "disk/source.file".
Usage:
python restore_kvm_backup.py \
-x '/kvm/backups/centos7-06/kvm/backups/centos7-06/20180924.0850.23/config.xml' \
-b '/kvm/backups/centos7-06/kvm/backups/centos7-06/20180924.0850.23/centos... | tiagoprn/devops | shellscripts/kvm/restore_kvm_backup.py | Python | mit | 3,178 | 0.002203 |
from ralybot import hook
def mode_cmd(mode, text, text_inp, chan, conn, notice):
""" generic mode setting function """
split = text_inp.split(" ")
if split[0].startswith("#"):
channel = split[0]
target = split[1]
notice("Attempting to {} {} in {}...".format(text, target, channel))
... | Jakeable/Ralybot | plugins/admin_channel.py | Python | gpl-3.0 | 5,871 | 0.002555 |
# 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/.
def main(request, response):
headers = []
if 'Content-Type' in request.GET:
headers += [('Content-Type'... | benschulz/servo | tests/wpt/mozilla/tests/mozilla/resources/no_mime_type.py | Python | mpl-2.0 | 443 | 0 |
from persistence.models import Agent, BaseModel
from peewee import *
class Message(BaseModel):
"""description of class"""
correlationid = CharField()
category = IntegerField()
body = CharField(null=True)
sender = ForeignKeyField(Agent, related_name='send_messages')
receiver = ForeignKeyField(... | onnovalkering/sparql-over-sms | sos-service/src/persistence/models/message.py | Python | mit | 1,021 | 0.000979 |
"""
THIS MODULE IS DEPRECATED IN FAVOR OF https://github.com/edx/xblock-lti-consumer
Learning Tools Interoperability (LTI) module.
Resources
---------
Theoretical background and detailed specifications of LTI can be found on:
http://www.imsglobal.org/LTI/v1p1p1/ltiIMGv1p1p1.html
This module is based on the ve... | jolyonb/edx-platform | common/lib/xmodule/xmodule/lti_module.py | Python | agpl-3.0 | 37,872 | 0.002905 |
import time
import cgi
import json
import os
import BaseHTTPServer
HOST_NAME = 'localhost'
PORT_NUMBER = 9400
class PlayerService(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
self.send_response(200)
self.send_header("Content-type", "application/json")
self.end_headers()
... | rolandkakonyi/poker-player-objc | player_service.py | Python | mit | 1,447 | 0.002073 |
#!/usr/bin/env python
"""
@file HybridVAControl.py
@author Craig Rafter
@date 19/08/2016
class for fixed time signal control
"""
import signalControl, readJunctionData, traci
from math import atan2, degrees, hypot
import numpy as np
from collections import defaultdict
class HybridVAControl(signalControl.signa... | cbrafter/TRB18_GPSVA | codes/sumoAPI/HybridVAControl.py | Python | mit | 15,253 | 0.005704 |
# -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Partner Contact Birthdate Age",
'version': '8.0.1.1.0',
'license': "AGPL-3",
'author': "AvanzOSC",
'website': "http://www.avanzosc.es",
'contributors': [... | alfredoavanzosc/odoo-addons | partner_contact_birthdate_age/__openerp__.py | Python | agpl-3.0 | 640 | 0 |
#!/usr/bin/python
# (c) 2017, Red Hat 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.0',
'status': ['preview'],
'supported_b... | jbenden/ansible | lib/ansible/modules/monitoring/sensu_client.py | Python | gpl-3.0 | 9,506 | 0.002525 |
import subprocess
subprocess.call("""
adb -d shell am start -n com.android.gallery/com.android.camera.GalleryPicker
""")
| carabri/carabri | test_script/open_gallery.py | Python | apache-2.0 | 123 | 0 |
# encoding: utf-8
import 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 'Page'
db.create_table('wiki_page', (
('id', self.gf('django.db.models.fields.A... | kylef/lithium | lithium/wiki/migrations/0001_initial.py | Python | bsd-2-clause | 7,245 | 0.008144 |
# Copyright 2015 OpenStack Foundation
#
# 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 ... | noironetworks/neutron | neutron/db/migration/alembic_migrations/versions/liberty/expand/45f955889773_quota_usage.py | Python | apache-2.0 | 1,496 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 PolyBeacon, 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... | kickstandproject/ripcord | ripcord/db/sqlalchemy/migrate_repo/versions/006_add_quota_support.py | Python | apache-2.0 | 2,465 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 18 20:53:35 2017
@author: sitibanc
"""
import numpy as np
import random
from sklearn import datasets
from scipy import stats
def kmeans(sample, K, max_iter):
N = sample.shape[0] # N็ญ่ณๆ
D = sample.shape[1] # ... | SitiBanc/1061_NCTU_IOMDS | 1018/Course Material/1018_2.py | Python | apache-2.0 | 2,416 | 0.003714 |
from .taxii.exceptions import UnauthorizedStatus
class UnauthorizedException(UnauthorizedStatus):
pass
class InvalidAuthHeader(Exception):
pass
| Intelworks/OpenTAXII | opentaxii/exceptions.py | Python | bsd-3-clause | 157 | 0 |
from magpie.utils import get_logger
LOGGER = get_logger(__name__)
def includeme(config):
LOGGER.info("Adding API routes...")
# Add all the admin ui routes
config.include("magpie.api.home")
config.include("magpie.api.login")
config.include("magpie.api.management")
config.include("magpie.api.s... | Ouranosinc/Magpie | magpie/api/__init__.py | Python | apache-2.0 | 329 | 0 |
class User:
def __init__(self, name):
self.name = name
| syncloud/platform | src/syncloud_platform/rest/model/user.py | Python | gpl-3.0 | 67 | 0 |
"""
datetimelike delegation
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import warnings
import numpy as np
from pandas.core.dtypes.common import (
is_categorical_dtype,
is_datetime64_dtype,
is_datetime64tz_dtype,
is_integer_dtype,
is_list_like,
is_period_dtype,
... | dsm054/pandas | pandas/core/indexes/accessors.py | Python | bsd-3-clause | 14,627 | 0.001641 |
# coding=utf-8
from keras.layers.advanced_activations import PReLU
from keras.layers.convolutional import Conv2D, ZeroPadding2D
from keras.layers.core import SpatialDropout2D, Permute
from keras.layers.merge import add, concatenate
from keras.layers.normalization import BatchNormalization
from ..layers.pooling import M... | PavlosMelissinos/enet-keras | src/models/enet_unpooling/encoder.py | Python | mit | 4,098 | 0.00366 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
# Copyright 2013 NTT corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file exc... | saeki-masaki/cinder | cinder/common/config.py | Python | apache-2.0 | 9,037 | 0 |
import sys
## Make sure pyqtgraph is importable
p = os.path.dirname(os.path.abspath(__file__))
p = os.path.join(p, '..', '..')
sys.path.insert(0, p)
from pyqtgraph.Qt import QtCore, QtGui
from DockArea import *
from Dock import *
app = QtGui.QApplication([])
win = QtGui.QMainWindow()
area = DockArea()
win.setCentra... | robertsj/poropy | pyqtgraph/dockarea/__main__.py | Python | mit | 1,587 | 0.018904 |
import socket
import json
import sys, traceback
import redis
class http_parser:
def __init__(self, sfhttp, is_client = True):
self.__METHOD = 0
self.__RESP = 1
self.__HEADER = 2
self.__BODY = 3
self.__TRAILER = 4
self.__CHUNK_LEN = 5
self.__CHUNK_BOD... | 7senses/shaka | shaka.py | Python | gpl-2.0 | 15,841 | 0.003283 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
js_to_json,
parse_duration,
unescapeHTML,
)
class DRBonanzaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?dr\.dk/bonanza/[^/]+/\d+/[^/]+/(?P<id>\d+)/(?P<display_id>[^/?#&]+)'
_TEST = {
'url': 'http... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/drbonanza.py | Python | gpl-3.0 | 1,678 | 0.026222 |
from nose.tools import assert_equal, assert_raises
import mock
import xmlrpc
from src.writers import FileWriter, LavaWriter
from src.writers import UnavailableError
class TestFileWriter(object):
OUTPUT_DIR = 'foo'
CONTENT = 'test'
NAME = 'test-job-name'
def test_fail_open(self):
cfg = {
... | free-electrons/custom_tests_tool | tests/test_writers.py | Python | gpl-2.0 | 4,332 | 0.000462 |
##### ํ
์ ๋ฅ๋ฌ๋ 1์ฅ
import tensorflow as tf
hello = tf.constant('Hello, Tensorflow')
sess = tf.Session()
print(sess.run(hello))
# 'b'๋ bytes literals๋ผ๋ ๋ป์ด๋ค.
node1 = tf.constant(3.0, tf.float32) # ์ซ์, ๋ฐ์ดํฐํ์
node2 = tf.constant(4.0) # ์ซ์, ๋ฐ์ดํฐํ์
node3 = tf.add(node1, node2) # ์ซ์, ๋ฐ์ดํฐํ์
# node3 = node1 + node2 # ์ด๋ ๊ฒ๋ ์ฌ์ฉ๊ฐ... | ghost9023/DeepLearningPythonStudy | DeepLearning/DeepLearning/02_Deep_ChoTH/tensorflow_prac.py | Python | mit | 18,788 | 0.011447 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import url
from . import feeds, views
urlpatterns = [
url(r'^$', views.PostListView.as_view(), name='list'),
url(
r'^category/(?P<slug>[-\w]+)/$',
views.PostListCategoryView.... | blancltd/glitter-news | glitter_news/urls.py | Python | bsd-2-clause | 849 | 0.002356 |
# Copyright (c) 2020, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | djaodjin/djaodjin-survey | survey/api/campaigns.py | Python | bsd-2-clause | 3,013 | 0.000332 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-14 01:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import storage.models.labels
class Migration(migrations.Migration):
dependencies = [
('storage', '0014_auto_20170914_... | MartinPaulo/resplat | storage/migrations/0015_auto_20170914_0154.py | Python | lgpl-3.0 | 1,300 | 0.000769 |
"""effcalculator URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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')
Cl... | alvcarmona/efficiencycalculatorweb | effcalculator/effcalculator/urls.py | Python | gpl-3.0 | 915 | 0.001093 |
# -*- coding: utf-8 -*-
import 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 'GroupSeen'
db.create_table(u'sentry_groupseen', (
('id', self.gf('sentry.db.mode... | zenefits/sentry | src/sentry/south_migrations/0104_auto__add_groupseen__add_unique_groupseen_group_user.py | Python | bsd-3-clause | 28,081 | 0.008048 |
# Copyright (c) 2011 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | rickerc/cinder_audit | cinder/openstack/common/scheduler/weights/__init__.py | Python | apache-2.0 | 1,305 | 0 |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | kidaa/kythe | third_party/grpc/src/python/src/grpc/framework/foundation/_timer_future.py | Python | apache-2.0 | 6,903 | 0.01101 |
# Copyright 2010 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | CloudServer/cinder | cinder/tests/unit/api/test_common.py | Python | apache-2.0 | 24,477 | 0 |
# -*-coding: utf-8-*-
from celery import Celery
from op import utils
import celeryconfig
worker = Celery('Regular-Ticket-Task')
worker.config_from_object(celeryconfig)
worker.conf.BROKER_URL = utils.get_config('celery', 'BROKER_URL')
worker.conf.CELERY_RESULT_BACKEND = utils.get_config('celery', 'CELERY_RESULT_BACKE... | EthanGuo/regular-ticket-task | worker.py | Python | mit | 325 | 0.003077 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
#~#######################################################################
#~ Copyright (c) 2008 Burdakov Daniel <kreved@kreved.org> #
#~ #
#~ This file is part of FreQ-bot. ... | TLemur/freq-bot | src/plugins/help/help_handler.py | Python | gpl-3.0 | 2,586 | 0.023975 |
#!/usr/bin/env python
# by Chris Truncer
# Script to attempt to forge a packet that will inject a new value
# for a dns record. Check nessus plugin #35372
# Some great documentation and sample code came from:
# http://bb.secdev.org/scapy/src/46e0b3e619547631d704c133a0247cf4683c0784/scapy/layers/dns.py
import argpar... | ChrisTruncer/PenTestScripts | HostScripts/DNSInject.py | Python | gpl-3.0 | 4,615 | 0.002384 |
from django import forms
from empresas.models import Usuario, Pessoa, Empresa
class LoginForm(forms.Form):
username = forms.CharField(max_length='200', required=True)
password = forms.CharField(widget=forms.PasswordInput, required=True)
class UsuarioForm(forms.ModelForm):
password = forms.CharField(widget... | mateusportal/portalconta | empresas/forms.py | Python | gpl-2.0 | 537 | 0.007449 |
__source__ = ''
# https://github.com/kamyu104/LeetCode/blob/master/Python/convert-a-number-to-hexadecimal.py
# Time: O(logn)
# Space: O(1)
#
# Description:
#
# Given an integer, write an algorithm to convert it to hexadecimal.
# For negative integer, two's complement method is used.
#
# IMPORTANT:
# You must not use a... | JulyKikuAkita/PythonPrac | cs15211/ConvertANumberToHexadecimal.py | Python | apache-2.0 | 4,592 | 0.004138 |
# ***************************************************************************
# * *
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
# * *
# * Th... | bblacey/FreeCAD-MacOS-CI | src/Mod/Fem/PyGui/_CommandFemMeshNetgenFromShape.py | Python | lgpl-2.1 | 3,519 | 0.002273 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.