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 |
|---|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding:utf-8 -*-
# Powered By KK Studio
from sqlalchemy import Column, Integer, SmallInteger, VARCHAR, or_, and_
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = 'users'
id = Column(Integer,primary_key=True,autoincrem... | kkstu/DNStack | model/models.py | Python | mit | 3,358 | 0.014627 |
from pylm.servers import Worker
from uuid import uuid4
import sys
class MyWorker(Worker):
def foo(self, message):
return self.name.encode('utf-8') + b' processed ' + message
server = MyWorker(str(uuid4()), 'tcp://127.0.0.1:5559')
if __name__ == '__main__':
server.start()
| nfqsolutions/pylm | examples/parallel/worker.py | Python | agpl-3.0 | 297 | 0.006734 |
import time
from datetime import datetime
from pytz import timezone
from dateutil.relativedelta import relativedelta
import openerp
from openerp.report.interface import report_rml
from openerp.tools import to_xml
from openerp.report import report_sxw
from datetime import datetime
from openerp.tools.translate import _
f... | davidsetiyadi/draft_python | new_edukits/edukits_total_retail_report.py | Python | gpl-3.0 | 24,578 | 0.033282 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'yángfǔ'
CN=u'阳辅'
NAME=u'yangfu23'
CHANNEL='gallbladder'
CHANNEL_FULLNAME='GallbladderChannelofFoot-Shaoyang'
SEQ='GB38'
if __name__ == '__main__':
pass
| sinotradition/meridian | meridian/acupoints/yangfu23.py | Python | apache-2.0 | 242 | 0.033898 |
def is_tl(data):
return isinstance(data, tuple) or isinstance(data, list)
def get_depth(data):
'''
:type data: list or tuple
get the depth of nested list
'x' is 0
['x', 'y'] is 1
['x', ['y', 'z'] is 2
'''
if is_tl(data):
depths = []
for i in data:... | Revolution1/ID_generator | generator.py | Python | mit | 1,559 | 0 |
from django.db.models import Count
from ordered_model.models import OrderedModelManager
from django.db.models import Q, Subquery
from django.db.models.query import QuerySet
from django.utils import timezone
from polymorphic.query import PolymorphicQuerySet
class SponsorshipQuerySet(QuerySet):
def in_progress(self... | python/pythondotorg | sponsors/models/managers.py | Python | apache-2.0 | 4,837 | 0.002067 |
# 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/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_private_endpoint_connections_operations.py | Python | mit | 21,872 | 0.004618 |
from django.contrib import admin
from modeltranslation.admin import TabbedTranslationAdmin
from .models import Person, Office, Tag
class PersonAdmin(TabbedTranslationAdmin):
list_display = ('name', 'surname', 'security_level', 'gender')
list_filter = ('security_level', 'tags', 'office', 'name', 'gender')
... | mtrgroup/django-mtr-utils | tests/app/admin.py | Python | mit | 908 | 0 |
# Copyright (c) 2017 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.
import os
import posixpath
import re
from collections import defaultdict
def uniform_path_format(native_path):
"""Alters the path if needed to be se... | nwjs/chromium.src | tools/checkteamtags/owners_file_tags.py | Python | bsd-3-clause | 7,900 | 0.010633 |
# Copyright 2016, 2017 Richard Rodrigues, Nyle Rodgers, Mark Williams,
# Virginia Tech
#
# This file is part of Coremic.
#
# Coremic 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 Lice... | richrr/coremicro | src/core/process_data.py | Python | gpl-2.0 | 2,807 | 0 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.tonic.to/status_available
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import parse... | huyphan/pyyawhois | test/record/parser/test_response_whois_tonic_to_status_available.py | Python | mit | 2,350 | 0.007234 |
#!/usr/bin/env python
#
# ChaseTracker 2.0 No GUI Version
#
# Copyright 2015 Mark Jessop <vk5qi@rfhead.net>
#
# 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/licen... | projecthorus/chasetracker | ChaseTrackerNoGUI.py | Python | apache-2.0 | 6,363 | 0.006129 |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 19 17:08:36 2015
@author: jgimenez
"""
from PyQt4 import QtGui, QtCore
import os
import time
import subprocess
types = {}
types['p'] = 'scalar'
types['U'] = 'vector'
types['p_rgh'] = 'scalar'
types['k'] = 'scalar'
types['epsilon'] = 'scalar'
types['omega'] = 'scalar'
ty... | jmarcelogimenez/petroSym | petroSym/utils.py | Python | gpl-2.0 | 11,739 | 0.007837 |
import bpy
from fashion_project.modules.draw.detail_tool.detail_tool import ToolDetail
class FP_DetailTool(bpy.types.Operator):
'''
Инструмент деталь:
создает замкнутый контур
'''
bl_idname = "fp.detail_tool"
bl_label = "FP_DetailTool"
@classmethod
def poll(cls, context):
return ToolDetail().poll... | TriumphLLC/FashionProject | modules/operators/tools/detail_tool/detail_tool.py | Python | gpl-3.0 | 579 | 0.02403 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | rcbops/nova-buildpackage | nova/tests/rpc/test_carrot.py | Python | apache-2.0 | 1,534 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Red Hat, 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
#
... | beagles/neutron_hacking | neutron/tests/unit/linuxbridge/test_rpcapi.py | Python | apache-2.0 | 5,482 | 0 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Compass demo package
:author: Thomas Calmant
:copyright: Copyright 2013, isandlaTech
:license: GPLv2
:version: 0.1
:status: Alpha
"""
# Module version
__version_info__ = (0, 1, 0)
__version__ = ".".join(map(str, __version_info__))
# Documentation strings format
_... | tcalmant/demo-ipopo-qt | android/compass/__init__.py | Python | gpl-2.0 | 439 | 0 |
#! /usr/bin/python
# Module:
# Author: Maxim Borisyak, 2014
import functools
partial = functools.partial
from pattern import MatchError
from pattern import case
from pattern import to_pattern
# Type patterns
from pattern import a_class
from pattern import a_str
from pattern import a_float
from pattern import an_in... | ZloVechno/dummy-agent | functial/__init__.py | Python | gpl-3.0 | 621 | 0.030596 |
# Given the list values = [] , write code that fills the list with each set of numbers below.
# a.1 2 3 4 5 6 7 8 9 10
list = []
for i in range(11):
list.append(i)
print(list) | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter6-Lists/R6.1A.py | Python | mit | 203 | 0.009852 |
from ebooklib import epub
from bs4 import BeautifulSoup
from nltk.tokenize import RegexpTokenizer
from langtools.translator.TextTranslation import TextTranslation
class EPUB(object):
"""docstring for EPUB"""
def __init__(self, book_location):
book = epub.read_epub(book_location)
# Filter out... | peterFran/LanguageListCreator | langtools/translator/EPUBTranslation.py | Python | mit | 1,136 | 0.001761 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#/*
# This file is part of ddprint - a 3D printer firmware.
#
# Copyright 2020 erwin.rieger@ibrieger.de
#
# ddprint 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, e... | ErwinRieger/ddprint | host/ddtool.py | Python | gpl-2.0 | 2,998 | 0.004671 |
"""Helper methods for Plex tests."""
from plexwebsocket import SIGNAL_DATA
def trigger_plex_update(mock_websocket):
"""Call the websocket callback method."""
callback = mock_websocket.call_args[0][1]
callback(SIGNAL_DATA, None, None)
| sdague/home-assistant | tests/components/plex/helpers.py | Python | apache-2.0 | 248 | 0 |
#!/usr/bin/env python2.7
'''
RSD: The reciprocal smallest distance algorithm.
Wall, D.P., Fraser, H.B. and Hirsh, A.E. (2003) Detecting putative orthologs, Bioinformatics, 19, 1710-1711.
Original author: Dennis P. Wall, Department of Biological Sciences, Stanford University.
Contributors: I-Hsien Wu, Computational B... | todddeluca/reciprocal_smallest_distance | rsd/rsd.py | Python | mit | 32,578 | 0.005556 |
from .virtual_create import *
__all__ = ["VirtualCreate"]
| USC-ACTLab/pyCreate2 | pyCreate2/visualization/__init__.py | Python | mit | 59 | 0 |
# Copyright 2012 Andreev Alexander <carzil@yandex.ru>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import struct
from .server.exceptions import Disconnect
import math
PACK_HEADER = ">l" # pack_size
PACK_HEADER_SIZE = struct.ca... | carzil/bowman | bowman/utils.py | Python | gpl-2.0 | 1,151 | 0.004344 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | diogocs1/comps | web/openerp/report/common.py | Python | apache-2.0 | 3,337 | 0.013785 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | reuk/wayverb | .ycm_extra_conf.py | Python | gpl-2.0 | 5,675 | 0.021498 |
# -*- coding: utf-8 -*-
from rest_framework.test import APIRequestFactory
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.activity.serializers import ActivityLogSerializer
from olympia.amo.tests import TestCase, addon_factory, user_factory
class LogMixin(object):
def log(self... | eviljeff/olympia | src/olympia/activity/tests/test_serializers.py | Python | bsd-3-clause | 4,454 | 0 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=line-too-long, invalid-name... | mganeva/mantid | scripts/PyChop/PyChop2.py | Python | gpl-3.0 | 10,393 | 0.003464 |
#
# Copyright 2017 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | opencord/voltha | voltha/northbound/rpc_dispatcher.py | Python | apache-2.0 | 803 | 0 |
#!/usr/bin/env python
"""This is the GRR class registry.
A central place responsible for registring plugins. Any class can have plugins
if it defines __metaclass__ = MetaclassRegistry. Any derived class from this
baseclass will have the member classes as a dict containing class name by key
and class as value.
"""
#... | MiniSEC/GRR_clone | lib/registry.py | Python | apache-2.0 | 5,555 | 0.009541 |
import platform
import pytest
import math
import numpy as np
import dartpy as dart
def test_solve_for_free_joint():
'''
Very simple test of InverseKinematics module, applied to a FreeJoint to
ensure that the target is reachable
'''
skel = dart.dynamics.Skeleton()
[joint0, body0] = skel.create... | dartsim/dart | python/tests/unit/dynamics/test_inverse_kinematics.py | Python | bsd-2-clause | 2,669 | 0.000749 |
from django.apps import AppConfig
class CasesConfig(AppConfig):
name = 'cases'
| antonow/concept-to-clinic | interface/backend/cases/apps.py | Python | mit | 85 | 0 |
#!/usr/bin/env python
"""Test the flow_management interface."""
import os
from grr.gui import gui_test_lib
from grr.gui import runtests_test
from grr.lib import action_mocks
from grr.lib import aff4
from grr.lib import flags
from grr.lib import flow
from grr.lib import hunts
from grr.lib import test_lib
from grr.l... | destijl/grr | grr/gui/plugins/flow_management_test.py | Python | apache-2.0 | 14,194 | 0.003382 |
from django.shortcuts import render
# Create your views here.
def proindex(request):
return render(request, 'example/probase.html' )
def index(request):
return render(request, 'e_index.html' )
def badges_labels(request):
return render(request, 'badges_labels.html' )
def four(requ... | chenqi123/ipaas | example/views.py | Python | apache-2.0 | 6,131 | 0.047953 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.9.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x07\x27\
\x00\
\x00\x1a\x8b\x78\x9c\xe5\x58\xdd\x8f\xdb\x36\x12\x7f\xdf\xbf\x82\
\x55\x1f\xd2\x4... | splotz90/urh | src/urh/ui/urh_rc.py | Python | gpl-3.0 | 463,208 | 0.000011 |
#!/usr/bin/env python2.5
#
# Copyright 2008 the Melange 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 applic... | MatthewWilkes/mw4068-packaging | src/melange/src/soc/logic/models/role.py | Python | apache-2.0 | 4,706 | 0.006587 |
from JumpScale.portal.macrolib import div_base
def main(j, args, params, *other_args):
return div_base.macro(j, args, params, self_closing=True, tag='input',
additional_tag_params={'type': 'email',
'pattern': r"^[a-zA-Z0-9.!#$%&'*+/=... | Jumpscale/jumpscale_portal8 | apps/portalbase/macros/page/email/1_main.py | Python | apache-2.0 | 436 | 0.002294 |
import sys
import json
import importlib
import http.client
import traceback
from netrackclient import broker
from netrackclient import errors
class HTTPClient(object):
def __init__(self, *args, **kwargs):
super(HTTPClient, self).__init__()
self._broker = broker.RequestBroker()
self.serv... | netrack/python-netrackclient | netrackclient/client.py | Python | lgpl-3.0 | 2,454 | 0 |
from flask import current_app
from ..core import Service, db
from .models import Component
class ComponentsService(Service):
__model__ = Component
| mcflugen/wmt-rest | wmt/flask/components/__init__.py | Python | mit | 155 | 0.006452 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutHashes in the Ruby Koans
#
from runner.koan import *
class AboutDictionaries(Koan):
def test_creating_dictionaries(self):
empty_dict = dict()
self.assertEqual(dict, type(empty_dict))
self.assertEqual(dict(), empty_dict)
... | DarthStrom/python_koans | python2/koans/about_dictionaries.py | Python | mit | 1,970 | 0 |
#!/usr/bin/env python
# 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
#
# U... | gkc1000/pyscf | pyscf/tddft/__init__.py | Python | apache-2.0 | 660 | 0 |
import datetime
import queue
import multiprocessing
import pytest
from honcho.printer import Message
from honcho.manager import Manager
from honcho.manager import SYSTEM_PRINTER_NAME
HISTORIES = {
'one': {
'processes': {'foo': {}},
'messages': (('foo', 'start', {'pid': 123}),
... | nickstenning/honcho | tests/test_manager.py | Python | mit | 8,625 | 0.000116 |
import subprocess
import pytest
from ..helpers import BaseWFC3
class TestUVIS13Single(BaseWFC3):
"""
Test pos UVIS2 DARK images
"""
detector = 'uvis'
def _single_raw_calib(self, rootname):
raw_file = '{}_raw.fits'.format(rootname)
# Prepare input file.
self.get_inpu... | jhunkeler/hstcal | tests/wfc3/test_uvis_13single.py | Python | bsd-3-clause | 864 | 0.003472 |
from django import forms
from rango.models import Page, Category
from rango.models import UserProfile
from django.contrib.auth.models import User
class CategoryForm(forms.ModelForm):
name = forms.CharField(max_length=128, help_text="Please enter the category name.")
views = forms.IntegerField(widget=forms.HiddenInpu... | Kentoseth/rangoapp | tango_with_django_project/rango/forms.py | Python | mit | 1,390 | 0.035971 |
# !/bin/env/ python
from flask import Flask
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('config.default')
app.config.from_pyfile('config.py')
#app.config.from_envvar('APP_CONFIG_FILE')
| gitgitcode/myflask | maomew/__init__.py | Python | mit | 219 | 0.004566 |
# -*- coding: utf-8 -*-
import re
import datetime
import logging
from urlparse import parse_qsl
from mamchecker.model import depth_1st, problemCtxObjs, keysOmit, table_entry, ctxkey
from mamchecker.hlp import datefmt, last
from mamchecker.util import PageBase
from google.appengine.ext import ndb
def prepare(
... | mamchecker/mamchecker | mamchecker/done/__init__.py | Python | gpl-3.0 | 3,545 | 0.001975 |
#!/usr/bin/python
#
# Copyright 2016 Red Hat | Ansible
#
# 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 la... | ColOfAbRiX/ansible | lib/ansible/modules/cloud/docker/docker_image.py | Python | gpl-3.0 | 21,614 | 0.003007 |
# Copyright (c) 2012 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 or agreed to... | openstack/tacker | tacker/common/constants.py | Python | apache-2.0 | 813 | 0 |
from django.contrib import admin
from django.apps import apps
### register all models in this app in the admin
for model in apps.get_app_config('tykurllog').get_models():
admin.site.register(model)
| tykling/tykurllog | src/tykurllog/admin.py | Python | bsd-3-clause | 204 | 0.009804 |
# -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requi... | prmtl/fuel-web | nailgun/nailgun/test/unit/test_objects.py | Python | apache-2.0 | 27,637 | 0 |
"""
Redis Blueprint
===============
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.redis
settings:
redis:
# bind: 0.0.0.0 # Set the bind address specifically (Default: 127.0.0.1)
"""
from fabric.decorators import task
from refabric.context_managers import sudo
from r... | jocke-l/blues | blues/redis.py | Python | mit | 1,054 | 0.000949 |
#!/usr/bin/python
#
# Copyright (C) 2013 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... | youtube/cobalt | third_party/blink/Source/bindings/scripts/compute_interfaces_info_individual.py | Python | bsd-3-clause | 17,799 | 0.002472 |
from textwrap import dedent
from pprint import pformat
from collections import OrderedDict
import attr
from . import sentinel
from .ordering import Ordering
# adapted from https://stackoverflow.com/a/47663099/1615465
def no_default_vals_in_repr(cls):
"""Class decorator on top of attr.s that omits attributes from... | ricklupton/sankeyview | floweaver/sankey_definition.py | Python | mit | 9,779 | 0.001636 |
# -*- coding: utf-8 -*-
"""Configure batch3dfier with the input data."""
import os.path
from subprocess import call
from shapely.geometry import shape
from shapely import geos
from psycopg2 import sql
import fiona
def call_3dfier(db, tile, schema_tiles,
pc_file_name, pc_tile_case, pc_dir,
... | balazsdukai/batch3dfier | batch3dfier/config.py | Python | gpl-3.0 | 20,894 | 0.000814 |
#!/usr/bin/env python
# Copyright (C) 2006-2017 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 Free
# Software Foundation (FSF), e... | MTG/essentia | test/src/unittests/highlevel/test_coversongsimilarity.py | Python | agpl-3.0 | 3,115 | 0.004815 |
#!/usr/bin/env python3
from thesis import Submit
import time
import logging
import signal
import threading
import boto.ec2
import multiprocessing as mp
import subprocess as sp
from pprint import pprint
from thesis import Propagator
from thesis import Pattern
from thesis import Parser
from thesis import Console
__au... | jtian0/project-platform | conduct.py | Python | mit | 5,372 | 0.001303 |
class BaseRequest(object):
def __init__(self, raw_request_dict):
self.body = raw_request_dict
if not self.body:
self.body ={}
def validate_scheme(self, scheme):
scheme.validate(self.body)
def get_value(self,key):
return self.body[key] | nottimbergling/isREAL-ui | backend/entities/base_request.py | Python | mit | 292 | 0.010274 |
from click.testing import CliRunner
from contextlib import contextmanager
from metapkg import main as metapkg_main
from unittest import TestCase, main
import os
import metapkg as mp
class TestBuilds(TestCase):
def setUp(self):
self.maxDiff = None
def assertValidPKGBUILD(self, directory):
meta... | Undeterminant/archlinux-metapkg | run_tests.py | Python | cc0-1.0 | 5,479 | 0.000183 |
import datetime
from uuid import uuid4
import ekklesia_portal.lib.vvvote.schema as vvvote_schema
def ballot_to_vvvote_question(ballot, question_id=1):
options = []
voting_scheme_yes_no = vvvote_schema.YesNoScheme(
name='yesNo', abstention=True, abstentionAsNo=False, quorum=2, mode=vvvote_schema.Schem... | dpausp/arguments | src/ekklesia_portal/lib/vvvote/election_config.py | Python | agpl-3.0 | 2,273 | 0.00264 |
#-*- coding:utf-8 -*-
class EventThrower:
def __init__(self):
self.events = {}
def on(self, name, callback, priority=99):
if name in self.events:
self.events[name].append({
'fct': callback,
'priority': priority
})
self.events[name] = sorted(self.events[name], key=lambda x: x['priority'], rever... | Choko256/pysfmlengine | util.py | Python | gpl-3.0 | 528 | 0.035985 |
#!/usr/bin/python
# Modified 30-Oct-2013
# tng@chegwin.org
# Retrieve:
# 1: current temperature from a TMP102 sensor
# 2: Send to redis
import sys,time
from sys import path
import datetime
from time import sleep
import re
import redis
time_to_live = 3600
###### IMPORTANT #############
###### How close to comfortable ... | tommybobbins/velpi | utilities/redis_sensor.py | Python | gpl-2.0 | 2,563 | 0.017948 |
#/usr/bin/env python
from fsm import Machine
states = ["q1", "q2", "q3"]
alphabet = ["0","1"]
transitions = {
"q1": {"0": "q1", "1": "q2"},
"q2": {"0": "q3", "1": "q2"},
"q3": {"0": "q2", "1": "q2"},
}
start = "q1"
end = ["q2"]
machine = Machine.from_arguments(states, alphabet, transitions, start, end)... | bnookala/fsm | example.py | Python | mit | 448 | 0.015625 |
# -*- mode: python; coding: utf-8 -*-
#
# Copyright 2011 Andrej A Antonov <polymorphm@qmail.com>
#
# 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 3 of the License, or
# (a... | polymorphm/scgi-wsgi-daemon | lib_scgi_wsgi_daemon__2011_08_06/daemonize.py | Python | gpl-3.0 | 1,222 | 0.003273 |
# coding: utf-8
#!/usr/bin/env python
from __future__ import division, unicode_literals
"""
#TODO: Write module doc.
"""
__author__ = 'Shyue Ping Ong'
__copyright__ = 'Copyright 2013, The Materials Virtual Lab'
__version__ = '0.1'
__maintainer__ = 'Shyue Ping Ong'
__email__ = 'ongsp@ucsd.edu'
__date__ = '8/1/15'
i... | rousseab/pymatgen | pymatgen/io/vaspio/vasp_output.py | Python | mit | 539 | 0.003711 |
# Copyright 2013-2020 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)
import sys
import os
import llnl.util.tty as tty
import spack.config
import spack.cmd
import spack.cmd.common.arguments ... | rspavel/spack | lib/spack/spack/cmd/dev_build.py | Python | lgpl-2.1 | 3,928 | 0 |
import mapnik
import subprocess,PIL.Image,cStringIO as StringIO
import time,sys,os
ew = 20037508.3428
tz = 8
def make_mapnik(fn, tabpp = None, scale=None, srs=None, mp=None, avoidEdges=False, abspath=True):
cc=[l for l in subprocess.check_output(['carto',fn]).split("\n") if not l.startswith('[mills... | jharris2268/osmquadtreeutils | osmquadtreeutils/rendertiles.py | Python | gpl-3.0 | 3,227 | 0.047412 |
"""Define constants for the SimpliSafe component."""
from datetime import timedelta
DOMAIN = "simplisafe"
DATA_CLIENT = "client"
DEFAULT_SCAN_INTERVAL = timedelta(seconds=30)
TOPIC_UPDATE = "update"
| fbradyirl/home-assistant | homeassistant/components/simplisafe/const.py | Python | apache-2.0 | 203 | 0 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainWindow.ui'
#
# Created: Fri Sep 25 14:24:01 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.1
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_mainWindow(object):
def setupU... | JeffHoogland/mtg-totals | Qt/ui_mainWindow.py | Python | bsd-3-clause | 13,255 | 0.001283 |
"""Base test class for nbconvert"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import io
import os
import glob
import shlex
import shutil
import sys
import unittest
import nbconvert
from subprocess import Popen, PIPE
import nose.tools as nt
from nbformat imp... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/nbconvert/tests/base.py | Python | bsd-2-clause | 5,773 | 0.003811 |
"""
Statistics for astronomy
"""
import numpy as np
from scipy.stats.distributions import rv_continuous
def bivariate_normal(mu=[0, 0], sigma_1=1, sigma_2=1, alpha=0,
size=None, return_cov=False):
"""Sample points from a 2D normal distribution
Parameters
----------
mu : array-lik... | nhuntwalker/astroML | astroML/stats/random.py | Python | bsd-2-clause | 3,890 | 0.000771 |
from toontown.toonbase import TTLocalizer
ValidChoices = [0,
1,
2,
3,
4]
NumberToWin = 14
InputTimeout = 20
ChanceRewards = (((1, 0), TTLocalizer.RaceGameForwardOneSpace, 0),
((1, 0), TTLocalizer.RaceGameForwardOneSpace, 0),
((1, 0), TTLocalizer.RaceGameForwardOneSpace, 0),
((2, 0), TTLocalizer.RaceGameForwardTw... | ksmit799/Toontown-Source | toontown/minigame/RaceGameGlobals.py | Python | mit | 1,615 | 0.003096 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2016 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the righ... | Diti24/python-ivi | ivi/tektronix/tektronixMDO3012.py | Python | mit | 1,724 | 0.00116 |
from .base import ScrollWindow
from settings_inspector.gui import keys
class VariablesWindow(ScrollWindow):
def __init__(self, settings, *args, **kwargs):
super(VariablesWindow, self).__init__(*args, **kwargs)
self.root_settings = settings
self.reset()
self.render()
return ... | fcurella/django-settings_inspector | settings_inspector/gui/windows/variables.py | Python | mit | 1,500 | 0.000667 |
from enum import Enum
class LogLevel(Enum):
"""Represent different log levels by their verbose codes."""
TRACE = 'TRC'
DEBUG = 'DBG'
INFO = 'INF'
WARNING = 'WRN'
WARN = 'WRN'
ERROR = 'ERR'
FATAL = 'FTL'
UNKNOWN = 'UKN'
class LogLevelInt(Enum):
"""Represent different log leve... | jmluy/xpython | exercises/concept/log-levels/.meta/exemplar.py | Python | mit | 1,610 | 0.001242 |
# 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... | eharney/nova | nova/tests/api/openstack/compute/plugins/v3/test_multinic.py | Python | apache-2.0 | 5,154 | 0 |
# -*- encoding: utf-8 -*-
#
# Copyright 2013 IBM Corp
#
# Author: Tong Li <litong01@us.ibm.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | rickerc/ceilometer_audit | ceilometer/publisher/file.py | Python | apache-2.0 | 3,579 | 0 |
# Plot histogram
import os
import numpy as np
from plantcv.plantcv.threshold import binary as binary_threshold
from plantcv.plantcv import params
from plantcv.plantcv import fatal_error
from plantcv.plantcv._debug import _debug
import pandas as pd
from plotnine import ggplot, aes, geom_line, labels, scale_color_manual... | stiphyMT/plantcv | plantcv/plantcv/visualize/histogram.py | Python | mit | 6,304 | 0.002855 |
# -*- coding: utf-8 -*-
from operator import itemgetter
import time
from openerp import api, fields, models, _
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.exceptions import ValidationError
class AccountFiscalPosition(models.Model):
_name = 'account.fiscal.position'
_description = '... | orchidinfosys/odoo | addons/account/models/partner.py | Python | gpl-3.0 | 22,069 | 0.006434 |
# Copyright (c) 2012 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 req... | fajoy/nova | nova/cells/manager.py | Python | apache-2.0 | 9,098 | 0.000879 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | sanjeevtripurari/hue | desktop/core/src/desktop/lib/metrics/file_reporter.py | Python | apache-2.0 | 2,100 | 0.007619 |
#!/usr/bin/env python
#
# Copyright 2011,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest, vocoder, blocks
class test_g723_24_vocoder (gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_bl... | mrjacobagilbert/gnuradio | gr-vocoder/python/vocoder/qa_g723_24_vocoder.py | Python | gpl-3.0 | 858 | 0 |
#!/usr/bin/env python
# coding=utf-8
"""
Site: http://www.beebeeto.com/
Framework: https://github.com/n0tr00t/Beebeeto-framework
"""
import time
import struct
import random
import socket
import select
import urlparse
from baseframe import BaseFrame
from utils.common.str import hex_dump
class MyPoc(BaseFrame):
... | forbidden-ali/Beebeeto-framework | demo/openssl_man_in_middle.py | Python | gpl-2.0 | 9,009 | 0.002612 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. 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 requir... | huggingface/transformers | tests/mobilebert/test_modeling_mobilebert.py | Python | apache-2.0 | 15,383 | 0.00351 |
"""Tests for the auth store."""
import asyncio
from unittest.mock import patch
from homeassistant.auth import auth_store
async def test_loading_no_group_data_format(hass, hass_storage):
"""Test we correctly load old data without any groups."""
hass_storage[auth_store.STORAGE_KEY] = {
"version": 1,
... | Danielhiversen/home-assistant | tests/auth/test_auth_store.py | Python | apache-2.0 | 9,513 | 0.00021 |
from django.conf.urls import patterns, url
from rolodex import views
urlpatterns = [
# Default view if the user have not navigated yet
url(r'^$', views.index, name='index'),
# company related urls
url(r'^company/add/$', views.company_add, name... | CCBG/django-rolodex | rolodex/urls.py | Python | mit | 1,436 | 0.009053 |
try:
import uzlib as zlib
import uio as io
except ImportError:
print("SKIP")
raise SystemExit
# Raw DEFLATE bitstream
buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00')
inp = zlib.DecompIO(buf, -8)
print(buf.seek(0, 1))
print(inp.read(1))
print(buf.seek(0, 1))
print(inp.read(2))
print(inp.read())
print(bu... | AriZuu/micropython | tests/extmod/uzlib_decompio.py | Python | mit | 691 | 0 |
__author__ = 'j'
import ConfigParser
class ParseConfig:
config = ConfigParser.ConfigParser()
def __init__(self):
pass
def sumSection(self, filePath):
'''
Counts the row amounts in the config file.
:param file: path to the file.
:return: Int with the amount of rows ... | Frenesius/CrawlerProject56 | crawler/ConfigManager.py | Python | gpl-3.0 | 4,164 | 0.005764 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gramfuzz.fields import *
import names
TOP_CAT = "postal"
# Adapted from https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form
# The name rules have been modified and placed into names.py
class PDef(Def):
cat = "postal_def"
class PRef(Ref):
cat = "pos... | d0c-s4vage/gramfuzz | examples/grams/postal.py | Python | mit | 2,381 | 0.009244 |
import numpy as _n
import time as _t
import spinmob.egg as egg
##### GUI DESIGN
# create the main window
w = egg.gui.Window(autosettings_path="example_sweeper_w.cfg")
# add the "go" button
b_sweep = w.place_object(egg.gui.Button("Sweep!", checkable=True)).set_width(50)
b_select = w.place_object(egg.gui.B... | ejetzer/spinmob | egg/examples/example_sweeper.py | Python | gpl-3.0 | 5,048 | 0.008122 |
"""
Test mock script that installs a test method provider for CIM method
AllTypesMethod() in CIM class PyWBEM_AllTypes, using the old setup approach
with global variables.
Note: This script and its method provider perform checks because their purpose
is to test the provider dispatcher. A real mock script with a real m... | pywbem/pywbemtools | tests/unit/pywbemcli/all_types_method_mock_v1old.py | Python | apache-2.0 | 2,630 | 0 |
"""
Module to detect a functional Powershell installation on a host or host list.
TODO: implement parts of https://github.com/DiabloHorn/DiabloHorn/blob/master/remote_appinitdlls/rapini.py
for remote registry modifications?
Module built by @harmj0y
"""
from lib import command_methods
class Module:
... | Exploit-install/Veil-Pillage | modules/enumeration/host/detect_powershell.py | Python | gpl-3.0 | 2,043 | 0.007832 |
import sys
import glob
#import sets
import re
def openSpec(fname, mode="r"):
""" open and return filehandle, open stdin if fname=="stdin", do nothing if none """
if fname=="stdin":
return sys.stdin
elif fname=="stdout":
return sys.stdout
elif fname=="none" or fname==None:
return... | maximilianh/maxtools | lib/tabfile.py | Python | gpl-2.0 | 15,316 | 0.012471 |
# 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 later version.
# This program is distributed in the hope that it will be useful,
# but... | pierg75/pier-sosreport | sos/plugins/tomcat.py | Python | gpl-2.0 | 2,298 | 0 |
class LIException(Exception):
"""There was an ambiguous exception that occurred while handling your
request."""
class DocTypeException(LIException):
"""The provided document type is invalid.
"""
class DocIDException(LIException):
"""The provided document ID is invalid.
"""
| AxisPhilly/py-li | li/exceptions.py | Python | mit | 302 | 0 |
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | aljim/deploymentmanager-samples | examples/v2/saltstack/python/minion.py | Python | apache-2.0 | 3,271 | 0.003057 |
from django.conf import settings
from django.utils import translation, six
try:
from django.contrib.gis import gdal, geos
except ImportError:
"""GDAL / GEOS not installed"""
import floppyforms as forms
__all__ = ('GeometryWidget', 'GeometryCollectionWidget',
'PointWidget', 'MultiPointWidget',
... | agconti/njode | env/lib/python2.7/site-packages/floppyforms/gis/widgets.py | Python | bsd-3-clause | 5,019 | 0 |
# -*- coding: utf-8 -*-
__params__ = {'la': 32, 'lb': 32, 'da': 10}
def protocol(client, server, params):
la = params['la']
lb = params['lb']
da = params["da"]
server.a = UnsignedVec(bitlen=la, dim=da).input(src=driver, desc="a")
server.b = Unsigned(bitlen=lb).input(src=driver, desc="b")
clie... | tastyproject/tasty | tasty/tests/functional/protocols/mul/unsignedvec_server_server_client/protocol.py | Python | gpl-3.0 | 442 | 0.004525 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | felixbb/forseti-security | google/cloud/security/scanner/audit/buckets_rules_engine.py | Python | apache-2.0 | 8,802 | 0.000227 |
# -*- coding: utf-8 -*-
""""
Folium Features Tests
---------------------
"""
import os
from branca.six import text_type
from branca.element import Element
from folium import Map, Popup
from folium import features
tmpl = """
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /... | talespaiva/folium | tests/test_features.py | Python | mit | 3,684 | 0.000272 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.