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 |
|---|---|---|---|---|---|
__doc__="""An experimental SVG renderer for the ReportLab graphics framework.
This will create SVG code from the ReportLab Graphics API (RLG).
To read existing SVG code and convert it into ReportLab graphics
objects download the svglib module here:
http://python.net/~gherman/#svglib
"""
import math, types, sys, os... | piMoll/SEILAPLAN | lib/reportlab/graphics/renderSVG.py | Python | gpl-2.0 | 37,905 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('statisticscore', '0004_merge'),
]
operations = [
migrations.AddField(
model_name='contentpoint',
name='point_type',
field=model... | eyp-developers/statistics | statisticscore/migrations/0005_contentpoint_point_type.py | Python | gpl-3.0 | 435 |
# -*- coding: UTF-8 -*-
import pprint
from xml.etree import ElementTree as ET
def import_xml(file):
tree = ET.parse(file)
root = tree.getroot()
data = root.find('Data')
all_data = []
for observation in data:
record = {}
for item in observation:
lookup_key = item.attrib.keys()[0]
if (lookup_key == ... | muzteka/jpyter_excercise | import_xml_to_python.py | Python | gpl-3.0 | 670 |
# Testing povray backend
import numpy as np
from chemview.render import render_povray
from chemview.scene import normalize_scene
from nose.tools import eq_, assert_raises
from nose.plugins.attrib import attr
# We need some scene normalization
coordinates = np.array([[0, 0, 0], [0, 0, 1], [0, 1, 2]], dtype='float32')
... | gabrielelanaro/chemview | tests/test_povray.py | Python | lgpl-2.1 | 1,791 |
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.http import *
from django.conf import settings
from django.template.loader import render_to_string
from django.db.models import get_model
from django.template.defaultfilters import slugify
from cmsk... | ozgurgunes/django-cmskit | cmskit/newsletter/views.py | Python | mit | 3,848 |
# -*- 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 'Language'
db.create_table(u'home_language', (
... | undocume/undocume | home/migrations/0001_initial.py | Python | mit | 12,954 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 17 07:30:53 2016
@author: Алена
"""
import numpy as np
import math
import Classes as hi
class SARG():
def __init__(self,n,number_bas,long_message,index_entanglement):
self.the_number_of_inspections = n
self.long_message = long_message
s... | DQE-Polytech-University/HI | examples/SARG.py | Python | mit | 1,021 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, 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
DOCUMENTATION = '''
---
module: proxysql_replication_hostg... | sestrella/ansible | lib/ansible/modules/database/proxysql/proxysql_replication_hostgroups.py | Python | gpl-3.0 | 13,353 |
import os
import csv
import time
import Adafruit_CharLCD as LCD
from menu import Menu
from bluetooth import *
def Transmit(lcd, doctor):
print "Transmit Function:"
lcd.clear()
lcd.message("Transmit\nFunction")
os.chdir('/home/pi/RPiCode/')
path = os.listdir('/home/pi/RPiCode/')
if(path.count(doctor) == 0):
l... | kms123/VAPMONPY | transmit.py | Python | gpl-3.0 | 939 |
#-*- coding: utf-8 -*-
import sys
import time
from stream_client import *
def watch(path, interval, client):
interval_sec = interval / 1000.
with open(path, "r") as file:
while 1:
fpos = file.tell()
line = file.readline()
if (not line) or (not "\n" in line):
... | bonprosoft/shellshare | client/bin/observer.py | Python | mit | 891 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2011-2012 Therp BV (<http://therp.nl>)
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or mod... | BorgERP/borg-erp-6of3 | base/base_base/ir/TODO/trp_encrypted_backup_rsync/__openerp__.py | Python | agpl-3.0 | 1,712 |
import boto
from boto.swf.exceptions import SWFResponseError
import sure # noqa
from moto import mock_swf_deprecated
# RegisterDomain endpoint
@mock_swf_deprecated
def test_register_domain():
conn = boto.connect_swf("the_key", "the_secret")
conn.register_domain("test-domain", "60", description="A test domai... | botify-labs/moto | tests/test_swf/responses/test_domains.py | Python | apache-2.0 | 3,834 |
# Copyright 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 requ... | maheshp/novatest | nova/api/openstack/compute/limits.py | Python | apache-2.0 | 15,804 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import mezzanine.core.fields
import mezzanine.pages.fields
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
]
operations = [
migrations.CreateModel(... | roberzguerra/scout_mez | scout_core/migrations/pages_migration/0001_initial.py | Python | gpl-2.0 | 4,644 |
# coding=utf-8
class NotEnabled(Exception):
"""
Not enabled.
"""
class UsageError(Exception):
"""
Command usage error.
"""
def __init__(self, *args, print_help=False, **kwargs):
self.print_help = print_help
super().__init__(*args, **kwargs)
class ClientError(Exception)... | jadbin/xpaw | xpaw/errors.py | Python | apache-2.0 | 783 |
#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gio
gi.require_version('Fcitx', '1.0')
from gi.repository import Fcitx
## https://lazka.github.io/pgi-docs/index.html#Fcitx-1.0/classes/InputMethod.html#Fcitx.InputMethod.new
im = Fcitx.InputMethod.new(Gio.BusType.SESSI... | foreachsam/book-lang-python | example/subject/gi/fcitx/prototype/demo-reload-config/main.py | Python | mit | 1,041 |
import os
import math
from director.timercallback import TimerCallback
from director.simpletimer import SimpleTimer
from director import robotstate
from director import getDRCBaseDir
from director import lcmUtils
import bot_core
import numpy as np
class JointController(object):
def __init__(self, models, poseCol... | RobotLocomotion/director | src/python/director/jointcontrol.py | Python | bsd-3-clause | 3,978 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
class TestListInterface(object):
config = """
templates:
global:
disable: [seen]
tasks:
list_get:
entry_li... | jawilson/Flexget | flexget/tests/test_list_interface.py | Python | mit | 10,930 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def load_rotinalogistica_from_fixture(apps, schema_editor):
from django.core.management import call_command
call_command("loaddata", "0016_rotinalogistica_loaddata")
def delete_rotinalogistica(apps, sch... | anselmobd/fo2 | src/logistica/migrations/0016_rotinalogistica_loaddata.py | Python | mit | 689 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='DNSRecord',
fields=[
('id', models.AutoField(ve... | ehooo/red_casa | red_casa/dns/migrations/0001_initial.py | Python | gpl-2.0 | 873 |
#!/usr/bin/env python3
"""
Created on 21 Sep 2020
@author: Jade Page ([email protected])
DESCRIPTION
The aws_group_setup utility is designed to automate the creation of AWS Greengrass groups using South
Coast Science's configurations.
The group must already exist and the ML lambdas must be associated ... | south-coast-science/scs_mfr | src/scs_mfr/aws_group_setup.py | Python | mit | 4,648 |
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
# Baruwa - Web 2.0 MailScanner front-end.
# Copyright (C) 2010-2015 Andrew Colin Kissa <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... | akissa/baruwa2 | baruwa/forms/lists.py | Python | gpl-3.0 | 5,391 |
# -*- coding: iso-8859-1 -*-
from Components.Language import language
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.MenuList import MenuList
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
fr... | libo/Enigma2 | lib/python/Screens/VirtualKeyBoard.py | Python | gpl-2.0 | 10,926 |
# 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 field 'DamageEvent.depth_slugs'
db.add_column('lizard_damage_damageevent', 'depth_slugs', self.gf... | lizardsystem/lizard-damage | lizard_damage/migrations/0006_auto__add_field_damageevent_depth_slugs.py | Python | gpl-3.0 | 9,749 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
Processing.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
****************************... | carolinux/QGIS | python/plugins/processing/core/Processing.py | Python | gpl-2.0 | 15,534 |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from .....extern.six.moves import range
from ..mle import design_matrix, periodic_fit
@pytest.fixture
def t():
rand = np.random.RandomState(42)
return 10 * rand.rand(10)
@pytest.mark.parametrize('freq', [1.0, 2])
@pytest.mark.paramet... | kelle/astropy | astropy/stats/lombscargle/implementations/tests/test_mle.py | Python | bsd-3-clause | 1,921 |
# -*- coding: UTF-8 -*-
# Copyright (C) 2006-2007 Nicolas Deram <[email protected]>
# Copyright (C) 2006-2008 Juan David Ibáñez Palomar <[email protected]>
# Copyright (C) 2007 Hervé Cauwelier <[email protected]>
# Copyright (C) 2008 Sylvain Taverne <[email protected]>
#
# This program is free software: you can redist... | nicolasderam/ikaaro | ikaaro/__init__.py | Python | gpl-3.0 | 1,887 |
import numpy as np
np.set_printoptions(linewidth=320)
from numpy import zeros, ones, mod, conj, array, c_, r_, linalg, Inf, complex128
from itertools import product
from numpy.linalg import solve, inv
from scipy.sparse.linalg import factorized
from scipy.sparse import issparse, csc_matrix as sparse
np.set_printoptions... | SanPen/GridCal | src/research/power_flow/ZPF.py | Python | lgpl-3.0 | 5,387 |
class NullObj:
def __init__(self):
print('NullObj.__init__')
| SELO77/seloPython | 3.X/FluentPython/1-datamodel/importTest.py | Python | mit | 73 |
"""
Reads:
- 2D prediction clusters from previous step
- location: see output from previous step
- format: see output from previous step
- 3D mesh
- location: defined in settings file
- format: ply or STL
- library: VTK
- Camera calibration parameters
Tasks:
- For each prediction cluster in each... | mmmatthew/raycast | code/s08__cast_rays_3d.py | Python | apache-2.0 | 5,904 |
import select
import socket
import sys
import time
import datetime
host = ''
port = 50003
if len(sys.argv) > 1:
port = int(sys.argv[1])
backlog = 5
size = 1024
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server.bind((host,port))
print ... | unice2345/uw_python | recho/echo_server_select.py | Python | gpl-3.0 | 1,139 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2016 Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a cop... | manthey/girder | plugins/authorized_upload/plugin_tests/upload_test.py | Python | apache-2.0 | 5,434 |
print sg
| grhawk/ASE | tools/doc/tutorials/spacegroup/spacegroup-sg2.py | Python | gpl-2.0 | 9 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import asyncio
import os
from azure.keyvault.secrets.aio import SecretClient
from azure.identity.aio import DefaultAzureCredential
from azure.core.exceptions import Http... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-secrets/samples/backup_restore_operations_async.py | Python | mit | 3,698 |
import os
import time
import logging
from autotest.client.shared import error
from autotest.client import utils
from virttest import data_dir, utils_misc
@error.context_aware
def run(test, params, env):
"""
Transfer a file back and forth between host and guest.
1) Boot up a VM.
2) Create a large file ... | ehabkost/tp-qemu | qemu/tests/file_copy_stress.py | Python | gpl-2.0 | 3,879 |
from PythonUtils.text_input import TextInput
class DateInput(TextInput):
def __init__(self, **kwargs):
kwargs["regex"] = "[0-3][0-9]\/[0-1][0-9]\/20[1-3][0-9]"
TextInput.__init__(self, **kwargs) | tiy1807/PythonUtils | PythonUtils/date_input.py | Python | apache-2.0 | 215 |
#!/usr/bin/env python
"""Application controllers for pfold application package
Run in the same order as the order in this file(instructions from pfold author)
[fasta2col,findphyl,mltree,scfg]
"""
import os
from cogent.app.util import CommandLineApplication,\
CommandLineAppResult, ResultPath
__author__ = "Shandy... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/cogent/app/pfold.py | Python | mit | 4,358 |
# Copyright 2013 Rackspace Hosting
# 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 require... | plumgrid/plumgrid-nova | nova/tests/api/openstack/compute/plugins/v3/test_instance_actions.py | Python | apache-2.0 | 12,710 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('a4projects', '0003_auto_20170130_0836'),
]
operations = [
migrations.AddField(
model_name='project',
... | liqd/adhocracy4 | adhocracy4/projects/migrations/0004_project_is_archived.py | Python | agpl-3.0 | 491 |
import re
import sys
from django.core.exceptions import FieldError, ValidationError
from django.db import models
try:
from django.utils.encoding import smart_text
except ImportError:
from django.utils.encoding import smart_unicode as smart_text
from collections import deque
PY2 = sys.version_info[0] == 2
if n... | ecometrica/django-dbarray | dbarray/fields.py | Python | bsd-3-clause | 6,203 |
from django.utils.decorators import method_decorator
import rest_framework.response
import rest_framework.views
from rest_framework import exceptions
from rest_framework import serializers
from rest_framework.authentication import SessionAuthentication
from fjord.base.api_utils import StrictArgumentsMixin
from fjord.... | hoosteeno/fjord | fjord/suggest/providers/trigger/api_views.py | Python | bsd-3-clause | 3,575 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server import util
class TapiTopologyForwardingRule(Model):
"""NOTE: This class is auto generated by Op... | karthik-sethuraman/ONFOpenTransport | RI/flask_server/tapi_server/models/tapi_topology_forwarding_rule.py | Python | apache-2.0 | 1,275 |
import unittest
from scrapy.http import Request, FormRequest
from scrapy.spiders import Spider
from scrapy.utils.reqser import request_to_dict, request_from_dict, _is_private_method, _mangle_private_name
class RequestSerializationTest(unittest.TestCase):
def setUp(self):
self.spider = TestSpider()
... | eLRuLL/scrapy | tests/test_utils_reqser.py | Python | bsd-3-clause | 5,535 |
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Screens.Console import Console
from Screens.ChoiceBox import ChoiceBox
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap, HelpableActionMap
from Components.Label import Label
from Components.La... | formiano/OPENDROID | src/ScriptRunner.py | Python | gpl-2.0 | 3,245 |
# function hash (str) {
# return crypto
# .createHash('sha1')
# .update(str, 'ascii')
# .digest('base64')
# .replace(PLUS_GLOBAL_REGEXP, '-')
# .replace(SLASH_GLOBAL_REGEXP, '_')
# .replace(EQUAL_GLOBAL_REGEXP, '')
# # }
# salt + '-' + hash(salt + '-' + secret)
secure = 'DjwennlKciQiTlxKmYtWq... | lcgong/alchemy | appserv/t.py | Python | gpl-3.0 | 470 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Flowroute LLC
# Written by Matthew Williams <[email protected]>
# Based on yum module written by Seth Vidal <skvidal at fedoraproject.org>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ ... | piffey/ansible | lib/ansible/modules/packaging/os/apt.py | Python | gpl-3.0 | 41,022 |
# Copyright (c) 2013 VMware, 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... | petrutlucian94/cinder | cinder/tests/unit/test_vmware_vmdk.py | Python | apache-2.0 | 132,621 |
from argparse import Namespace
from copy import deepcopy
from io import StringIO
from pathlib import Path
import shutil
from sqlalchemy.exc import OperationalError
import sys
import tempfile
from types import SimpleNamespace
import unittest
from unittest.mock import patch
import migrator
from migrator import main
cl... | RCOS-Grading-Server/HWserver | migration/tests/test_handle_migration.py | Python | bsd-3-clause | 15,772 |
'''
Entry point module (keep at root):
This module starts the debugger.
'''
import sys
if sys.version_info[:2] < (2, 6):
raise RuntimeError('The PyDev.Debugger requires Python 2.6 onwards to be run. If you need to use an older Python version, use an older version of the debugger.')
import atexit
import os
import... | ThiagoGarciaAlves/intellij-community | python/helpers/pydev/pydevd.py | Python | apache-2.0 | 69,138 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from distutils.core import setup
base_dir = os.path.dirname(__file__)
files = ['README.rst', 'CHANGELOG.rst', 'AUTHORS.rst']
long_description = '\n\n'.join(map(lambda fn: open(os.path.join(base_dir, fn)).read(), files))
setup(
name="django-filefieldtools",... | pkolt/django-filefieldtools | setup.py | Python | bsd-3-clause | 1,048 |
from support import BaseTest, reformat_code
from nolang.compiler import compile_module
from nolang.module import W_Module
from nolang.importer import Importer
class TestCompiler(BaseTest):
def test_compile_module(self):
code = reformat_code('''
def foo() {
return 3;
... | fijal/quill | tests/test_compiler.py | Python | mit | 608 |
class Argument(object):
"""
A command-line argument/flag.
:param name:
Syntactic sugar for ``names=[<name>]``. Giving both ``name`` and
``names`` is invalid.
:param names:
List of valid identifiers for this argument. For example, a "help"
argument may be defined with a n... | pfmoore/invoke | invoke/parser/argument.py | Python | bsd-2-clause | 3,278 |
import sys
import pyttsx
habla = None
x = None
uno = "esteestexto.txt"
dos = "esteotro.txt"
tres = "yotro.txt"
buscando = "buscando.txt"
def espeak():
print 'running speech-test.py...'
engine = pyttsx.init()
engine.setProperty("rate",40)
engine.setProperty("volume",1.0)
voices = engine.getPropert... | semillero-obsolescencia/criticon | misc/finaldos.py | Python | mit | 811 |
'''
Created on Jul 4, 2014
@author: lzrak47
'''
import os
import shutil
import unittest
from branch import Branch
from command import Command
from objects import Commit, Tree, Blob
from utils import write_to_file
class TestCommit(unittest.TestCase):
def setUp(self):
self.workspace = 'test_commit'
... | lizherui/git-in-python | src/tests/test_commit.py | Python | lgpl-2.1 | 1,708 |
class Account:
"""Abstract base class describing the API for an account."""
def __init__(self, balance: float) -> None:
self._balance = balance
def withdraw(self, ammount: float) -> float:
"""Withdraw some money from an account."""
# Error on the following line: Use `NotImplemented... | RyanDJLee/pyta | examples/pylint/E0711_notimplemented_raised.py | Python | gpl-3.0 | 364 |
# Lightshow Templates
# (c) 2016-2017 Simon Leiner, 2015 Martin Erzberger
# licensed under the GNU Public License, version 2
"""\
To make writing lightshows easy and convenient we introduced templates.
These provide the interfaces for the controller and generic functionalities.
*Basically: The templates are there so ... | Yottabits/102shows | server/lightshows/templates/__init__.py | Python | gpl-2.0 | 469 |
#!/bin/python3
import argparse
import code
import readline
import signal
import sys
import capstone
from load import ELF
def SigHandler_SIGINT(signum, frame):
print()
sys.exit(0)
class Argparser(object):
def __init__(self):
parser = argparse.ArgumentParser()
parser.add_argument("--arglist... | bloodstalker/mutator | bfd/codegen.py | Python | gpl-3.0 | 1,436 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Pavel Studenik
# Email: [email protected]
# Date: 24.9.2013
import logging
import xml.dom.minidom
from apps.core.models import (Arch, DistroTemplate, JobTemplate,
RecipeTemplate, TaskTemplate, Test)
logger = logging.getLogger(__name... | SatelliteQE/GreenTea | apps/core/utils/beaker_import.py | Python | gpl-2.0 | 6,528 |
from django import forms
from tower import ugettext_lazy as _lazy
import mkt
from mkt.constants import (CATEGORY_CHOICES, CATEGORY_CHOICES_DICT,
CATEGORY_REDIRECTS, TARAKO_CATEGORIES_MAPPING,
TARAKO_CATEGORY_CHOICES)
from mkt.constants.applications import DEVICE_L... | elysium001/zamboni | mkt/search/forms.py | Python | bsd-3-clause | 8,058 |
"""
Given an array nums, partition it into two (contiguous) subarrays left and right so that:
Every element in left is less than or equal to every element in right.
left and right are non-empty.
left has the smallest possible size.
Return the length of left after such a partitioning. It is guaranteed that such a part... | franklingu/leetcode-solutions | questions/partition-array-into-disjoint-intervals/Solution.py | Python | mit | 1,320 |
import sys, os
import pprint
try:
set
except NameError:
from sets import Set as set
def print_sys():
for arg in 'prefix', 'exec_prefix', 'executable':
print '%s: %s' % (arg, getattr(sys, arg))
def host_main():
print 'Hello from main executable (pid: %s)' % (os.getpid(),)
print_sys()
pr... | kamitchell/py2app | examples/embedded_interpreter/simple/hello.py | Python | mit | 1,244 |
"""Constants governing operation of txrudp package."""
# [bytes]
UDP_SAFE_SEGMENT_SIZE = 1000
# [length]
WINDOW_SIZE = 65535 // UDP_SAFE_SEGMENT_SIZE
# [seconds]
PACKET_TIMEOUT = 0.6
# [seconds]
BARE_ACK_TIMEOUT = 0.01
# [seconds]
MAX_PACKET_DELAY = 15
# If a packet is retransmitted more than that many times,
# t... | OpenBazaar/txrudp | txrudp/constants.py | Python | mit | 425 |
class PhoneDirectory(object):
def __init__(self, maxNumbers):
"""
Initialize your data structure here
@param maxNumbers - The maximum numbers that can be stored in the phone directory.
:type maxNumbers: int
"""
self.maxnum=maxNumbers
self.releasenum=[0]*maxNu... | Tanych/CodeTracking | 379-Design-Phone-Directory/solution.py | Python | mit | 1,763 |
# -*- coding: utf-8 -*-
"""Display detected objects and faces in output image files.
The aggregator functions here take as input detected faces and objects. It
draws bounding boxes over the repective frames and saves the png files
locally. Requires that the PNG annotator was run and the original images are
saved somew... | statsmaths/dtv-toolkit | dvt/aggregate/display.py | Python | gpl-3.0 | 5,703 |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from dataclasses import dataclass
from typing import Iterable, List, Type
from pants.backend.python.target_types import PythonSources
from pants.core.goals.fmt import FmtFieldSets, FmtRes... | tdyas/pants | src/python/pants/backend/python/lint/python_fmt.py | Python | apache-2.0 | 2,336 |
# Copyright 2017 Cloudbase Solutions Srl
#
# 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 l... | ader1990/cloudbase-init | cloudbaseinit/metadata/services/azureservice.py | Python | apache-2.0 | 18,702 |
# -*- mode: python -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distr... | Slezhuk/ansible | lib/ansible/modules/inventory/group_by.py | Python | gpl-3.0 | 1,483 |
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from github3.repos.repo import Repository as GithubRepository
from buildservice.models import Repository, Webhook
from buildservice.utils import views
class ViewsUtilsTestCase(TestCase... | m-vdb/github-buildservice-boilerplate | buildservice/tests/utils/test_views.py | Python | mit | 1,795 |
from ner import extract, info
def test_info():
res = info()
assert res is not None
def test_extract():
res = extract({
'tokens': [
'Несе',
'Галя',
'воду',
',',
'Коромисло',
'гнеться',
',',
'За',
... | chaliy/ner-ms | src/tests/test_ner.py | Python | mit | 1,685 |
"""sunlo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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-based... | michaelsnook/sunlo | sunlo/urls.py | Python | mit | 807 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/operations/_default_security_rules_operations.py | Python | mit | 8,972 |
#!/usr/bin/env python
from __future__ import print_function
import freenect
import matplotlib.pyplot as mp
import frame_convert
import signal
keep_running = True
def get_depth():
return frame_convert.pretty_depth(freenect.sync_get_depth()[0])
def get_video():
return freenect.sync_get_video()[0]
def handl... | tpltnt/SimpleCV | scripts/install/win/OpenKinect/freenect-examples/demo_mp_sync.py | Python | bsd-3-clause | 893 |
import unittest
import _foolib
class TestC(unittest.TestCase):
def test_c_lifecycle(self):
_foolib.c_set_verbosity(1)
model = _foolib.c_new()
print(model)
_foolib.c_operation(model)
_foolib.c_delete(model)
if __name__ == "__main__":
unittest.main()
| tomkraljevic/polyglot-to-cxx-examples | python/foolib/tests/test_c.py | Python | apache-2.0 | 301 |
# -*- coding: utf-8 -*-
# @Time : 2017/11/14 17:09
# @Author : play4fun
# @File : cc1.py
# @Software: PyCharm
"""
camera_calibration1.py:
参考:http://blog.csdn.net/dcrmg/article/details/52939318
有结果,但是摄像头分辨率太高,程序运行太慢了
所用棋盘来自
http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration?action=AttachFile... | makelove/OpenCV-Python-Tutorial | ch42-摄像机标定/camera_calibration.py | Python | mit | 2,047 |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext_lazy as _
from .models import SurveyListPlugin, SurveyUser
from apps.pollster.models import Survey as pollster_survey_model
# Oh well, this doesn't really belong in the survey apps, s... | hrpt-se/hrpt | apps/survey/cms_plugins.py | Python | agpl-3.0 | 2,111 |
# -*- coding: utf-8 -*-
###############################################################################
#
# CSW Client
# ---------------------------------------------------------
# QGIS Catalog Service client.
#
# Copyright (C) 2010 NextGIS (http://nextgis.org),
# Alexander Bruy (alexander.bruy@gmail... | mj10777/QGIS | python/plugins/MetaSearch/dialogs/newconnectiondialog.py | Python | gpl-2.0 | 3,791 |
# stockpredictr_utils.py
#
# Copyright (C) 2009-2017 Roger Allen ([email protected])
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any l... | rogerallen/stockpredictr | stockpredictr/stockpredictr_utils.py | Python | gpl-3.0 | 4,234 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, [email protected]
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jvrsantacruz/XlsxWriter | xlsxwriter/test/comparison/test_chart_gradient03.py | Python | bsd-2-clause | 1,772 |
"""
INPUT:
Hello World,World
Hello CodeEval,CodeEval
San Francisco,San Jose
"""
import sys
with open(sys.argv[1], "r") as f:
print("\n".join(map(str,[1 if x[0].strip().endswith(x[1].strip()) else 0 for x in [line.split(",") for line in f]]))) | tyop/CodeEval | trailing_string.py | Python | mit | 250 |
import sys
[_, ms, _, ns] = list(sys.stdin)
ms = set(int(m) for m in ms.split(' '))
ns = set(int(n) for n in ns.split(' '))
print(sep='\n', *sorted(ms.difference(ns).union(ns.difference(ms))))
| alexander-matsievsky/HackerRank | All_Domains/Python/Sets/symmetric-difference.py | Python | mit | 194 |
import os
import sys
import tempfile
import subprocess
PLATFORM = sys.platform
IS_WIN = (os.name == 'nt')
IS_DARWIN = (PLATFORM == 'darwin')
IS_LINUX = (PLATFORM == 'linux2')
def run(executable):
stderr = subprocess.PIPE
stdout = subprocess.PIPE
proc = subprocess.Popen(
executable,
stdout... | nir0s/serv | serv/utils.py | Python | apache-2.0 | 719 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-22 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wishes', '0001_squashed_0002_auto_20160522_1408'),
]
operations = [
migratio... | dvl/imagefy-web | imagefy/wishes/migrations/0002_auto_20160522_1447.py | Python | mit | 506 |
#!/usr/bin/env python3.5
import auth
| smartczm/python-learn | Old-day01-10/s13-day2/export-pyc.py | Python | gpl-2.0 | 38 |
from django.core.urlresolvers import reverse
from django.db import models
class UrlrTestModel(models.Model):
slug = models.SlugField()
def __unicode__(self):
return self.slug
def get_absolute_url(self):
return reverse('urlr_test_view', args=[self.slug])
| adamfast/django-urlr | urlr/tests/models.py | Python | bsd-3-clause | 294 |
import testlib
try:
from utils import *
except ImportError:
raise Exception("Add the SDK repository to your PYTHONPATH to run the examples "
"(e.g., export PYTHONPATH=~/splunk-sdk-python.")
TEST_DICT = {
'username':'admin',
'password':'changeme',
'port'... | lowtalker/splunk-sdk-python | tests/test_utils.py | Python | apache-2.0 | 2,253 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
""" This file defines the RoutingTree class wh... | SymbiFlow/python-fpga-interchange | fpga_interchange/route_stitching.py | Python | isc | 16,298 |
from django.db import models
from olc_webportalv2.users.models import User
from django.contrib.postgres.fields.jsonb import JSONField
import os
from django.core.exceptions import ValidationError
# Create your models here.
def validate_fastq(fieldfile):
filename = os.path.basename(fieldfile.name)
if filename.... | forestdussault/olc_webportalv2 | olc_webportalv2/new_multisample/models.py | Python | mit | 8,667 |
import os
import re
import sys
import logging
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.autoreload
from tornado.process import fork_processes, task_id
from tornado.log import app_log
from tornado.options import define, options, parse_command_line
from app.conf import Config
cfg ... | battlemidget/cage-cmf | app/system/interface.py | Python | mit | 2,396 |
#!/usr/bin/python
from datetime import *
import Adafruit_DHT
offset = 0
base = 62
schedule = {
'Weekend': {
6: base + 3,
20: base
},
'Weekday': {
6: base + 3,
8: base,
16: base + 3,
20: base
}
}
def getIndoor():
sensor = Adafruit_DHT.DHT22
... | csomerlot/RPiSmartThermostat | src/tempControl.py | Python | mit | 1,828 |
from myhvac_service.db import models
import logging
LOG = logging.getLogger(__name__)
def get_current_system_settings(session):
return session.query(models.SystemSettings)\
.filter_by(active=True)\
.order_by(models.SystemSettings.created_at.desc())\
.first()
| alanquillin/myhvac_service | myhvac_service/db/system.py | Python | apache-2.0 | 291 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module is an example of adding to a list."""
import data
DIRECTIONS = data.DIRECTIONS
DIRECTIONS = DIRECTIONS[:len(DIRECTIONS)-1] + ('West',)
| slb6968/is210-week-06-warmup | task_03.py | Python | mpl-2.0 | 199 |
def test_simple():
assert True
# A syntax error:
:
| DonJayamanne/pythonVSCode | pythonFiles/tests/testing_tools/adapter/.data/syntax-error/tests/test_spam.py | Python | mit | 58 |
import sys
from prettytable import PrettyTable
from mistcommand.helpers.login import authenticate
from mistcommand.helpers.clouds import return_cloud
def list_sizes(cloud, pretty):
sizes = cloud.sizes
if pretty:
x = PrettyTable(["Name", "ID"])
for size in sizes:
x.add_row([size['... | mistio/mist.client | src/mistcommand/helpers/sizes.py | Python | gpl-3.0 | 656 |
from django.test import TestCase
from datetime import date, datetime, timedelta
from restclients.util.date_formator import full_month_date_str
from restclients.util.date_formator import abbr_month_date_time_str
from restclients.util.date_formator import abbr_week_month_day_str
from restclients.util.date_formator import... | jeffFranklin/uw-restclients | restclients/test/util/date_formator.py | Python | apache-2.0 | 15,136 |
# Copyright (C) 2007-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 you... | trevor/mailman3 | src/mailman/chains/hold.py | Python | gpl-3.0 | 11,015 |
#!/usr/bin/python
# Copyright 2013
# Eyedarts Website Creations
# (http://eyedarts.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 3 of the License, or
# (at your option)... | eyedarts/WP-CLI-Python-Update | update_wp.py | Python | gpl-3.0 | 5,231 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', include('allauth.urls')),
url(r'^', include('core.urls')),
url(r'^', include('deck.urls')),
url(... | Thalesgm/speakerfight | speakerfight/urls.py | Python | mit | 391 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ProductionOrderDetails(Document):
pass | indictranstech/focal-erpnext | manufacturing/doctype/production_order_details/production_order_details.py | Python | agpl-3.0 | 266 |
# Copyright 2020 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 agreed to in writing, ... | google/dqm | backend/dqm/models.py | Python | apache-2.0 | 11,866 |
from hearthbreaker.engine import *
from projectfiles.feature_extract import *
import numpy as np
import random
from projectfiles.game_history_generator import *
from sklearn import linear_model
from sknn.mlp import Regressor, Layer
# from projectfiles.pear_extractor import *
#print("function_approximator.py is deprec... | jirenz/CS229_Project | learning/function_approximator.py | Python | mit | 4,891 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.