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 |
|---|---|---|---|---|---|---|
"""Glyph-specific queries on font-files"""
from ttfquery import describe
try:
from OpenGLContext.debug.logs import text_log
except ImportError:
text_log = None
def hasGlyph( font, char, encoding=None ):
"""Check to see if font appears to have explicit glyph for char"""
glyfName = explicitGlyph( font, c... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/ttfquery/glyphquery.py | Python | lgpl-3.0 | 3,146 | 0.013986 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
SITE_ROOT = os.path.dirname(os.path.abspath(__file__))
DEBUG = True # 调试模式
TEMPLATE_DIR = os.path.join(SITE_ROOT, 'templates') # 模板目录
BASE_TEMPLATE = 'base' # 基础模板
# URL 映射
URLS = (
'/', 'Index',
'(/j)?/shorten', 'Shorten',
'/([0-9a-zA-Z]{5,})',... | mozillazg/ShortURL | shorturl/settings.py | Python | mit | 569 | 0 |
#!/usr/env python
class Flyable:
def fly(self):
pass
class Quackable(object):
def quack(self):
pass
class ReadHeadDuckFly(Flyable):
def fly(self):
print "I am a readheadduck, I can fly"
class ReadHeadDuckQack(Quackable):
def quack(self):
print "I am a readheadduck,Dc... | sahikaru/DP | chapter1/strategymode.py | Python | gpl-2.0 | 1,364 | 0.012463 |
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function, unicode_literals,
)
from builtins import * # noqa
from future.builtins.disabled import * # noqa
from future.utils import with_metaclass
from abc import ABCMeta
# collections.abc dosn't esist in Python 2.x.... | huntzhan/magic-constraints | magic_constraints/types.py | Python | mit | 15,147 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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
#... | thaim/ansible | lib/ansible/modules/cloud/ovirt/ovirt_vmpool_info.py | Python | mit | 4,023 | 0.002237 |
<<<<<<< HEAD
<<<<<<< HEAD
"""Extension to format a paragraph or selection to a max width.
Does basic, standard text formatting, and also understands Python
comment blocks. Thus, for editing Python source code, this
extension is really only suitable for reformatting these comment
blocks or triple-quoted strings.
Known... | ArcherSys/ArcherSys | Lib/idlelib/FormatParagraph.py | Python | mit | 22,001 | 0.003273 |
OK = 0
UNKNOWN_ERROR = 1
EVAL_FALSE = 2
OP_RETURN = 3
# Max sizes
SCRIPT_SIZE = 4
PUSH_SIZE = 5
OP_COUNT = 6
STACK_SIZE = 7
SIG_COUNT = 8
PUBKEY_COUNT = 9
# Failed verify operations
VERIFY = 10
EQUALVERIFY = 11
CHECKMULTISIGVERIFY = 12
CHECKSIGVERIFY = 13
NUMEQUALVERIFY = 14
# Logical/Format/Canonical errors
BAD_OPC... | cvegaj/ElectriCERT | venv3/lib/python3.6/site-packages/pycoin/tx/script/errno.py | Python | gpl-3.0 | 1,047 | 0 |
""" Module of mathematical array """
class Array(object):
"""
Multidimentionnal Array of Number
"""
def __init__(self):
self.data = []
def add(self, target):
""" Add another Array to self """
for (i, table) in enumerate(target.data):
for (j, val) in enumerate(tab... | SuliacLEGUILLOU/computor | srcs/Array.py | Python | mit | 575 | 0.001739 |
#@+leo-ver=5-thin
#@+node:2014fall.20141212095015.1775: * @file wsgi.py
# coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
#@@language python
#@@tabwidth -4
#@+<<declarations>>
#@+node:2014fall.20141212095015.1776: ** <<declar... | 40123148/2015cdb_40123148 | wsgi.py | Python | gpl-3.0 | 34,518 | 0.004126 |
from .qgalleroob import QGalleroob
__all__ = ['QGalleroob']
| vicnet/weboob | weboob/applications/qgalleroob/__init__.py | Python | lgpl-3.0 | 61 | 0 |
# -*- encoding: utf-8 -*-
'''
Created on: 2015
Author: Mizael Martinez
'''
from pyfann import libfann
from login import Login
from escribirArchivo import EscribirArchivo
import inspect, sys, os
sys.path.append("../model")
from baseDatos import BaseDatos
class CtrlEntrenarRNANormalizado:
def __init__(self):
... | martinezmizael/Escribir-con-la-mente | object/entrenarFannNormalizado.py | Python | mit | 5,218 | 0.043887 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/scripts/stop.py | Python | gpl-3.0 | 2,284 | 0.000876 |
# Copyright (c) 2001-2015, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | pbougue/navitia | source/eitri/ed_handler.py | Python | agpl-3.0 | 6,071 | 0.001812 |
../../../../../share/pyshared/checkbox/lib/__init__.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/checkbox/lib/__init__.py | Python | gpl-3.0 | 54 | 0.018519 |
"""
This module defines the database models for all in-game objects, that
is, all objects that has an actual existence in-game.
Each database object is 'decorated' with a 'typeclass', a normal
python class that implements all the various logics needed by the game
in question. Objects created of this class transparentl... | shollen/evennia | evennia/objects/models.py | Python | bsd-3-clause | 12,067 | 0.002818 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Doriancoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the wallet."""
from test_framework.test_framework import DoriancoinTestFramework
from test_fram... | doriancoins/doriancoin | test/functional/wallet_basic.py | Python | mit | 21,630 | 0.005457 |
from corehq.apps.app_manager.management.commands.helpers import (
AppMigrationCommandBase,
)
from corehq.apps.app_manager.models import Application
class Command(AppMigrationCommandBase):
help = "Migrate preload dict in advanced forms to " \
"allow loading the same case property into multiple quest... | dimagi/commcare-hq | corehq/apps/app_manager/management/commands/migrate_advanced_form_preload.py | Python | bsd-3-clause | 1,053 | 0.001899 |
#!/usr/bin/env python3
# JN 2015-07-29
"""
Log file parser for Cheetah by Johannes Niediek
This script reads out the reference settings
by sequentially following all crs, rbs, and gbd commands.
Please keep in mind that the following scenario is possible with Cheetah:
Start the recording
Stop the recording
Change the... | jniediek/combinato | tools/parse_cheetah_logfile.py | Python | mit | 19,113 | 0.000262 |
"""
This test case test the REST API
api/applications.py
"""
import json
from .base import MyApiTestCase
class APIApplicationsResolverTestCase(MyApiTestCase):
def test_get_applications(self):
with self.app.test_request_context('/application/',
method='GET',
... | privacyidea/privacyidea | tests/test_api_applications.py | Python | agpl-3.0 | 799 | 0 |
#!/usr/bin/env python2.6
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2010,2011,2012,2013 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... | stdweird/aquilon | tests/broker/test_del_10gig_hardware.py | Python | apache-2.0 | 2,595 | 0.000385 |
#
# main.py
# RegexAsYouType
#
# Created by Anders Hovmoller on 5/19/09.
# Copyright Calidris 2009. All rights reserved.
#
#import modules required by application
import objc
import Foundation
import AppKit
from PyObjCTools import AppHelper
# import modules containing classes required to start application and lo... | boxed/RegexAsYouType | main.py | Python | mit | 420 | 0.004762 |
# import sys
def check(answer, guess):
bulls = 0
cows = 0
answer = str(answer)
guess = str(guess)
for x in range(0, len(answer)):
# foundX = false;
for y in range(0, len(guess)):
if answer[x] == guess[y]:
if x == y:
bulls += 1
else:
cows += 1
retVal = {'bulls': bulls, 'cows': cows}
retu... | aninoy/cowsnbulls | checker.py | Python | mit | 432 | 0.032407 |
from freelancersdk.resources.users import delete_user_jobs
from freelancersdk.session import Session
from freelancersdk.exceptions import UserJobsNotDeletedException
import os
def sample_delete_user_jobs():
url = os.environ.get('FLN_URL')
oauth_token = os.environ.get('FLN_OAUTH_TOKEN')
session = Session... | freelancer/freelancer-sdk-python | examples/delete_user_jobs.py | Python | lgpl-3.0 | 794 | 0 |
__author__ = 'Bohdan Mushkevych'
import functools
from werkzeug.wrappers import Request
from synergy.mx.utils import jinja_env
def valid_action_request(method):
""" wraps method with verification for is_request_valid"""
@functools.wraps(method)
def _wrapper(self, *args, **kwargs):
assert isinst... | eggsandbeer/scheduler | synergy/mx/base_request_handler.py | Python | bsd-3-clause | 1,418 | 0.000705 |
#coding:utf8
from __future__ import absolute_import, unicode_literals
import msgpack
from .base import BaseSerializer
class MSGPackSerializer(BaseSerializer):
def dumps(self, value):
return msgpack.dumps(value)
def loads(self, value):
return msgpack.loads(value, encoding="utf-8")
| glumu/django-redis-cluster | django_redis_cluster/serializers/msgpack.py | Python | bsd-3-clause | 311 | 0.003215 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2011 Tim G L Lyons
#
# 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; eith... | arunkgupta/gramps | gramps/gui/editors/displaytabs/__init__.py | Python | gpl-2.0 | 2,332 | 0.013722 |
from tornado.web import RequestHandler
from homeweb.util import apply_template, write_return
class ChessBoardHandler(RequestHandler):
@write_return
@apply_template("demos/chess.html")
def get(self):
return {}
| fsufitch/homeweb | src/homeweb/handlers/demos/chess.py | Python | gpl-2.0 | 231 | 0.004329 |
from __future__ import print_function
f = open('inputs/input_01.txt')
contents = f.read()
print("Floor:", contents.count('(') - contents.count(')'))
# Part Two
change = {'(': 1, ')': -1}
floor = 0
position = 1
for c in contents:
if c in change:
floor += change[c]
if floor == -1:
print("Basemen... | jjhelmus/adventofcode | day01.py | Python | mit | 390 | 0.002564 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either ve... | chokribr/inveniotest | modules/websearch/lib/websearch_regression_tests.py | Python | gpl-2.0 | 256,725 | 0.003771 |
import os
import logging.config
class MyLogger(object):
# set logging to both file and screen
def __init__(self):
logging.config.fileConfig('../config/logging.conf')
self.logger = logging.getLogger('scrapeforum')
self.logger.addHandler(logging.StreamHandler())
self.errorIndicat... | stackingfunctions/scrapeforum | python/src/mylogger.py | Python | gpl-3.0 | 862 | 0.00232 |
# -*- coding: utf-8 -*-
# 2014-11-24 22:43
line_number = 0
with open('favorite-people.txt', encoding = 'utf-8') as a_file:
# To read a file one line at a time, use a for loop. That’s it.
# Besides having explicit methods like read() , the stream object
# is also an iterator which spits out a single line ev... | myd7349/DiveIntoPython3Practices | chapter_11_Files/read_line.py | Python | lgpl-3.0 | 804 | 0.003759 |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | karllessard/tensorflow | tensorflow/python/distribute/mirrored_run.py | Python | apache-2.0 | 19,404 | 0.005978 |
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2016 by the mediaTUM authors
:license: GPL3, see COPYING for details
"""
from __future__ import absolute_import
from sqlalchemy.orm import undefer, joinedload
from sqlalchemy.orm.exc import NoResultFound
from core import db as _db
from utils.lrucache import lru_cache... | mediatum/mediatum | core/nodecache.py | Python | gpl-3.0 | 1,485 | 0.006061 |
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
import numpy.linalg as la
import matplotlib.pyplot as plt
from procedural_city_generation.building_generation.cuts import *
from procedural_city_generation.building_generation.building_tools import *
from procedural_city_generation.buil... | josauder/procedural_city_generation | procedural_city_generation/building_generation/roofs.py | Python | mpl-2.0 | 6,492 | 0.008164 |
import logging
import os
from lib import exception
from lib import repository
from lib.constants import REPOSITORIES_DIR
LOG = logging.getLogger(__name__)
def get_versions_repository(config):
"""
Get the packages metadata Git repository, cloning it if does not
yet exist.
Args:
config (dict... | olavph/builds | lib/versions_repository.py | Python | gpl-3.0 | 2,326 | 0.00086 |
"""
Deployment file to facilitate releases of custodian.
"""
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Apr 29, 2012"
import glob
from invoke impor... | davidwaroquiers/custodian | tasks.py | Python | mit | 1,962 | 0.001529 |
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import sys
import subprocess
import logging
import shlex
from traceback import print_exc
from setuptools import setup, find_packages
CURRENT_DIR = os.path.abspath(os.pat... | lukw00/powerline | setup.py | Python | mit | 4,260 | 0.026069 |
"""Support for Switchbot devices."""
from asyncio import Lock
import switchbot # pylint: disable=import-error
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_SENSOR_TYPE, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNo... | home-assistant/home-assistant | homeassistant/components/switchbot/__init__.py | Python | apache-2.0 | 4,051 | 0.001234 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-08-01 07:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import proso.django.models
class Migration(migrations.Migration):
initial = True
dependencies = [... | adaptive-learning/proso-apps | proso_tasks/migrations/0001_initial.py | Python | mit | 4,601 | 0.003043 |
from heapq import *
from typing import List
class Solution:
def findMaximizedCapital(self, k: int, wealth: int, profits: List[int], capitals: List[int]) -> int:
minCapitalHeap, maxProfitHeap = [], []
for i in range(len(capitals)):
heappush(minCapitalHeap, (capitals[i], profits[i]))
... | shobhitmishra/CodingProblems | LeetCode/Session3/ipo.py | Python | mit | 880 | 0.023864 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2013 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of th... | CERNDocumentServer/invenio | modules/bibfield/lib/functions/check_field_existence.py | Python | gpl-2.0 | 4,158 | 0.004329 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | KhronosGroup/COLLADA-CTS | StandardDataSets/collada/library_lights/_reference/_reference_directional_white/_reference_directional_white.py | Python | mit | 3,987 | 0.006521 |
# Copyright (c) OpenMMLab. All rights reserved.
from ..builder import DETECTORS
from .two_stage import TwoStageDetector
@DETECTORS.register_module()
class FastRCNN(TwoStageDetector):
"""Implementation of `Fast R-CNN <https://arxiv.org/abs/1504.08083>`_"""
def __init__(self,
backbone,
... | open-mmlab/mmdetection | mmdet/models/detectors/fast_rcnn.py | Python | apache-2.0 | 2,164 | 0 |
from __future__ import unicode_literals
from .responses import APIGatewayResponse
url_bases = [
"https?://apigateway.(.+).amazonaws.com"
]
url_paths = {
'{0}/restapis$': APIGatewayResponse().restapis,
'{0}/restapis/(?P<function_id>[^/]+)/?$': APIGatewayResponse().restapis_individual,
'{0}/restapis/(?P... | Brett55/moto | moto/apigateway/urls.py | Python | apache-2.0 | 2,102 | 0.007612 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from email.header import decode_header
from email.utils import formataddr
from odoo import _, api, fields, models, SUPERUSER_ID, tools
from odoo.exceptions import UserError, AccessError
from odoo.osv imp... | ayepezv/GAD_ERP | addons/mail/models/mail_message.py | Python | gpl-3.0 | 38,977 | 0.003746 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | jmartinm/invenio-oauthclient | invenio_oauthclient/contrib/github.py | Python | gpl-2.0 | 3,966 | 0 |
def pitagoras_quad(coordenada):
return coordenada[0] ** 2 + coordenada[1] ** 2
def pitagoras(coordenada):
return pitagoras_quad(coordenada)**0.5
def coords_delta(coord_a, coord_b):
delta = []
delta.append(coord_a[0] - coord_b[0])
delta.append(coord_a[1] - coord_b[1])
return delta
def coord... | jeffque/circle-quest-squareland | elements/geometry.py | Python | unlicense | 969 | 0.001032 |
"""Per-repository configuration options."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdt_repooptions
#
# Public Classes:
# Data
#
# Public Functions:
# merge_override_into_data
# me... | valhallasw/phabricator-tools | py/abd/abdt_repooptions.py | Python | apache-2.0 | 6,892 | 0.000145 |
from utils.haversine import haversine
from utils.geo import llaToECEF
from utils.geo import ECEFTolla
from utils.median import getmedian
from utils.graph import draw_partitioned_graph
from utils.fancy_dendrogram import fancy_dendrogram | getsmarter/bda | utils/__init__.py | Python | mit | 235 | 0.004255 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.awards_list, name='list'),
]
| fgmacedo/django-awards | awards/urls.py | Python | mit | 121 | 0 |
from requests.auth import AuthBase
import hmac
import base64
import hashlib
import urlparse
import urllib
#add your custom auth handler class to this module
class MyCustomAuth(AuthBase):
def __init__(self,**args):
# setup any auth-related data here
#self.username = args['username']
#self.p... | d4rt/SplunkModularInputsPythonFramework | implementations/rest/bin/authhandlers.py | Python | apache-2.0 | 1,678 | 0.014303 |
# fit and predict with known line segment x locations
# import our libraries
import numpy as np
import matplotlib.pyplot as plt
import pwlf
# your data
y = np.array([0.00000000e+00, 9.69801700e-03, 2.94350340e-02,
4.39052750e-02, 5.45343950e-02, 6.74104940e-02,
8.34831790e-02, 1.02580042e-... | cjekel/piecewiseLinearFitPython | examples/fitWithKnownLineSegmentLocations.py | Python | mit | 3,127 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import configargparse
import os
import math
import json
import logging
import random
import time
import socket
import struct
import zipfile
import requests
from uuid import uuid4
from s2sphere import CellId, LatLng
from . import config
log = logging.getLogger(__na... | pgandev/RocketMap | pogom/utils.py | Python | agpl-3.0 | 43,916 | 0.000023 |
from cStringIO import StringIO
import unittest
import unittest2
from unittest2.test.support import resultFactory
class TestUnittest(unittest2.TestCase):
def assertIsSubclass(self, actual, klass):
self.assertTrue(issubclass(actual, klass), "Not a subclass.")
def testInheritance(self):
self.... | endlessm/chromium-browser | third_party/llvm/lldb/third_party/Python/module/unittest2/unittest2/test/test_new_tests.py | Python | bsd-3-clause | 1,677 | 0 |
# GUI object/properties browser.
# Copyright (C) 2011 Matiychuk D.
#
# This library 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.1
# of the License, or (at your option) any later ve... | moden-py/SWAPY-deleting | proxy.py | Python | lgpl-2.1 | 26,563 | 0.010014 |
from django.db.models import Q
from django.forms.fields import CharField, MultiValueField
from django.forms.widgets import MultiWidget, TextInput
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django_filters.filters import DateFilter, MethodFilter, ModelChoiceFilter
from ... | vitalti/sapl | sapl/api/forms.py | Python | gpl-3.0 | 7,717 | 0.00013 |
# -*- coding: utf-8 -*-
import base64
import inspect
import json
import logging
import requests
import types
from django.conf import settings
from django.core.management import call_command
from django_nose import FastFixtureTestCase
from functools import wraps
from mock import patch
from tastypie.test import Resource... | nk113/tastypie-rpc-proxy | rpc_proxy/test.py | Python | bsd-3-clause | 3,241 | 0.002468 |
# -*- coding: utf-8 -*-
import pytest
from .mocks import MockSocket
from pylyskom.errors import ReceiveError
from pylyskom.connection import ReceiveBuffer
from pylyskom.datatypes import ArrayInt32, Int32, String, ConfType, ExtendedConfType
def test_Array_can_parse_empty_array_with_star_format():
s = MockSocket(... | osks/pylyskom | tests/test_datatypes.py | Python | gpl-2.0 | 6,849 | 0.004672 |
# -*- coding: utf-8 -*-
import contour.contour as contour
from contour.contour import Contour
import py
def test_build_classes_card():
fn = contour.build_classes_card
assert fn(4) == [(4, 1, (0, 1, 2, 3), True), (4, 2, (0, 1, 3, 2), False),
(4, 3, (0, 2, 1, 3), True), (4, 4, (0, 2, 3, 1)... | mdsmus/MusiContour | tests/test_contour.py | Python | gpl-3.0 | 12,322 | 0.000487 |
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function, unicode_literals,
)
from builtins import * # noqa
from future.builtins.disabled import * # noqa
from magic_constraints.exception import MagicSyntaxError, MagicTypeError
def transform_to_slots(constraints... | huntzhan/magic-constraints | magic_constraints/argument.py | Python | mit | 2,768 | 0 |
"""
>>> sd = SliceDump()
>>> sd[1]
1
>>> sd[2:5]
slice(2, 5, None)
>>> sd[:2]
slice(None, 2, None)
>>> sd[7:]
slice(7, None, None)
>>> sd[:]
slice(None, None, None)
>>> sd[1:9:3]
slice(1, 9, 3)
>>> sd[1:9:3, 2:3]
(slice(1, 9, 3), slice(2, 3, N... | YuxuanLing/trunk | trunk/code/study/python/Fluent-Python-example-code/attic/sequences/slice_dump.py | Python | gpl-3.0 | 581 | 0.001721 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Examples for Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/areski/python-nvd3
"""
from nvd3 imp... | mgx2/python-nvd3 | examples/discreteBarChart.py | Python | mit | 899 | 0.003337 |
"""
Coroutine streaming module
==========================
.. note::
In a break with tradition, some classes in this module have lower case
names because they tend to be used as function decorators.
We use coroutines to communicate messages between different components
in the Noodles runtime. Coroutines can ha... | NLeSC/noodles | noodles/lib/__init__.py | Python | apache-2.0 | 3,960 | 0 |
import basepage
class NavigationBars(basepage.BasePage):
def expand_project_panel(self):
elm = self.driver.find_element_by_css_selector(
'a[data-target="#sidebar-accordion-project"]')
state = elm.get_attribute('class')
if 'collapsed' in state:
elm.click()
e... | rcbops-qe/horizon-selenium | pages/navigation_bars.py | Python | apache-2.0 | 9,234 | 0 |
#!/usr/bin/env python3
import argparse
from biocode import utils, gff
def main():
'''
This script reports statistics on the areas of a genome where features aren't - introns and
intergenic space. Pass a valid GFF3 file (along with FASTA data) and get a report like this:
Molecule count: 9
Gene... | jorvis/biocode | gff/report_gff_intron_and_intergenic_stats.py | Python | mit | 9,713 | 0.008545 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('let_me_app', '0007_auto_20150723_2238'),
]
operations = [
migrations.AlterField(
model_name='event',
... | oleg-chubin/let_me_play | let_me_app/migrations/0008_auto_20150809_1341.py | Python | apache-2.0 | 474 | 0.00211 |
# 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/.
import socket
import time
import sys
from Peach.publisher import Publisher
class RawEther(Publisher):
"""
A si... | MozillaSecurity/peach | Peach/Publishers/raw.py | Python | mpl-2.0 | 11,798 | 0.000424 |
# coding: utf-8
from django.db import models
from attach.models import ContentTypeModel
class Example(ContentTypeModel):
"""
Exemplos serão adicionados como pedaços de códigos
para ajudar no entendimento do usuário sobre algum item.
"""
name = models.CharField(u'Nome', max_length=150, bla... | LucasMagnum/pyexplain | pyexplain/attach/examples/models.py | Python | mit | 547 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from Http import Http
import logging
from sys import exit
from Utils import ErrorSQLRequest, checkOptionsGivenByTheUser
from Constants import *
class UtlHttp (Http):
'''
Allow the user to send HTTP request
'''
def __init__(self,args):
'''
Constructor
'''
logging.d... | quentinhardy/odat | UtlHttp.py | Python | lgpl-3.0 | 4,947 | 0.03679 |
#! /usr/bin/env python
from zope.interface import implements
from twisted.trial.itrial import IReporter
from twisted.plugin import IPlugin
# register a plugin that can create our CoverageReporter. The reporter itself
# lives separately, in trialcoverage/trialcoverage.py.
# note that this trialcoveragereporterplugin.... | simplegeo/trialcoverage | twisted/plugins/trialcoveragereporterplugin.py | Python | gpl-2.0 | 1,724 | 0.00174 |
import numpy as np
def add_vtarg_and_adv(seg, gamma, lam):
"""
Compute target value using TD(lambda) estimator, and advantage with GAE(lambda)
:param seg: (dict) the current segment of the trajectory (see traj_segment_generator return for more information)
:param gamma: (float) Discount factor
:p... | hill-a/stable-baselines | stable_baselines/trpo_mpi/utils.py | Python | mit | 1,008 | 0.00496 |
#!/usr/bin/env python
"""
Translation from a C code posted to a forum on the Internet.
@translator Thomas Schmid
"""
from array import array
def reflect(crc, bitnum):
# reflects the lower 'bitnum' bits of 'crc'
j=1
crcout=0
for b in range(bitnum):
i=1<<(bitnum-1-b)
i... | zitouni/ucla_zigbee_phy | src/python/crc16.py | Python | bsd-3-clause | 1,996 | 0.043587 |
import sys
import time
sys.stdout.write("stdout!")
sys.stderr.write("stderr!")
| leanrobot/contestsite | team/scripts/python/correct.py | Python | gpl-3.0 | 79 | 0 |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
from jnius import autoclass, JavaException
class Interface(unittest.TestCase):
def test_reflect_interface(self):
Interface = autoclass('org.jnius.InterfaceWithPublicEnum')
... | kivy/pyjnius | tests/test_interface.py | Python | mit | 620 | 0 |
import os
import mimetypes
import warnings
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.files.base import File
from django.core.files.storage import Storage
from django.core.exceptions import ImproperlyConfigured
try:
... | rnoldo/django-avatar | storages/backends/s3.py | Python | bsd-3-clause | 10,680 | 0.003839 |
import spacy
nlp = spacy.load('en')
text = open('customer_feedback_627.txt').read()
doc = nlp(text)
for entity in doc.ents:
print(entity.text, entity.label_)
# Determine semantic similarities
doc1 = nlp(u'the fries were gross')
doc2 = nlp(u'worst fries ever')
doc1.similarity(doc2)
# Hook in your own deep learni... | iwxfer/wikitten | library/nlp/semantic_simi.py | Python | mit | 376 | 0.00266 |
#
# Copyright (C) 2003-2022 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat.org.
#
# WeeChat.org 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
#... | weechat/weechat.org | weechat/doc/models.py | Python | gpl-3.0 | 9,804 | 0 |
import codecs
import sys
import setuptools
def read_requirements_file(req_name):
requirements = []
try:
with codecs.open(req_name, encoding='utf-8') as req_file:
for req_line in req_file:
if '#' in req_line:
req_line = req_line[0:req_line.find('#')].str... | sprockets/sprockets.mixins.redis | setup.py | Python | bsd-3-clause | 2,498 | 0.0004 |
# Copyright (c) 2012 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... | huntxu/neutron | neutron/cmd/ovs_cleanup.py | Python | apache-2.0 | 4,457 | 0 |
#/u/GoldenSights
import traceback
import praw # simple interface to the reddit API, also handles rate limiting of requests
import time
import sqlite3
'''USER CONFIGURATION'''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_to_make_your_bot_use_oauth2/
USERAGENT =... | TacticalGoat/reddit | SubDumpPost/subdumppost.py | Python | mit | 5,238 | 0.009927 |
import unittest
import numpy as np
import bayesnet as bn
class TestDeterminant(unittest.TestCase):
def test_determinant(self):
A = np.array([
[2., 1.],
[1., 3.]
])
detA = np.linalg.det(A)
self.assertTrue((detA == bn.linalg.det(A).value).all())
A = ... | ctgk/BayesianNetwork | test/linalg/test_det.py | Python | mit | 626 | 0 |
'''
SI 618 - HW 4: Map-Reduce Part 2
Uniqname: gracfu
'''
from mrjob.job import MRJob
from mrjob.step import MRStep
import re
WORD_RE = re.compile(r"\b[\w']+\b")
class MRMostUsedWord(MRJob):
def mapper_get_words(self, _, line):
for word in WORD_RE.findall(line):
yield (word.lower(), 1)
def combiner_count_wo... | gracfu/618_map_reduce | map_reduce_part2.py | Python | apache-2.0 | 802 | 0.03616 |
'''
Created by auto_sdk on 2014-12-17 17:22:51
'''
from top.api.base import RestApi
class ItemQuantityUpdateRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.num_iid = None
self.outer_id = None
self.quantity = None
self.sku_id = None
... | CooperLuan/devops.notes | taobao/top/api/rest/ItemQuantityUpdateRequest.py | Python | mit | 406 | 0.03202 |
"""
__MT_pre__match_contains.py_____________________________________________________
Automatically generated AToM3 syntactic object (DO NOT MODIFY DIRECTLY)
Author: gehan
Modified: Sun Feb 15 10:22:14 2015
________________________________________________________________________________
"""
from ASGNode import *
from ... | levilucio/SyVOLT | UMLRT2Kiltera_MM/MT_pre__match_contains.py | Python | mit | 4,951 | 0.029085 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
# mappings for table dumps
# "remember to add indexes!"
data_map = {
"Company": {
"columns": ["name"],
"conditions": ["docstatus < 2"]
},
"Fisc... | Zlash65/erpnext | erpnext/startup/report_data_map.py | Python | gpl-3.0 | 9,520 | 0.03771 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import uuid
from operator import attrgetter
from flask import flash, jsonify, redirect, request, session
... | ThiefMaster/indico | indico/modules/events/contributions/controllers/management.py | Python | mit | 34,546 | 0.003503 |
from __future__ import absolute_import
from sentry.models import OrganizationMember
from sentry.testutils import AcceptanceTestCase
class ListOrganizationMembersTest(AcceptanceTestCase):
def setUp(self):
super(ListOrganizationMembersTest, self).setUp()
self.user = self.create_user('foo@example.co... | looker/sentry | tests/acceptance/test_member_list.py | Python | bsd-3-clause | 1,244 | 0.000804 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, erpnext
from frappe.utils import cint, formatdate, flt, getdate
from frappe import _, throw
import frappe.defaults
from erpnext.controll... | emakis/erpnext | erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py | Python | gpl-3.0 | 26,853 | 0.025435 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yeison/Documentos/python/developing/pinguino/pinguino-ide/qtgui/frames/libraries_widget.ui'
#
# Created: Fri Dec 19 15:43:21 2014
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be l... | PinguinoIDE/pinguino-multilanguage | files/frames/libraries_widget.py | Python | gpl-2.0 | 14,604 | 0.003287 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "badguys.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mpirnat/lets-be-bad-guys | manage.py | Python | mit | 250 | 0 |
def printFileContents(myFile):
print(open(myFile).read().splitlines())
def writeFileContents(myFile, somethingToWrite):
f = open(myFile,'a')
f.write(somethingToWrite +'\n') # python will convert \n to os.linesep
f.close() # you can omit in most cases as the destructor will call if
printFileContents("alive.txt"... | Kakarot/PythonIO | FileManipulator.py | Python | mit | 696 | 0.025862 |
# coding=utf-8
"""
-
"""
from __future__ import division, unicode_literals, absolute_import
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
import argparse
from puf import cli_lib
def main(params=None):
"""
:param params:
:return:
"""
p... | erikdejonge/puffin | puf/cli.py | Python | mit | 3,395 | 0.003829 |
'''
WebIDL binder
http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html
'''
import os, sys
sys.path.append(sys.argv[3])
import shared
sys.path.append(shared.path_from_root('third_party'))
sys.path.append(shared.path_from_root('third_party', 'ply'))
import WebIDL
# ... | xpenatan/dragome-backend | extensions/gdx-bullet/gdx-bullet-build/jni/emscripten/webidl_binder.py | Python | apache-2.0 | 25,177 | 0.01267 |
from http import HTTPStatus
from json import loads
from unittest.mock import Mock, patch
from uuid import uuid4
from tornado.testing import gen_test
from pokerserver.database import PlayerState, UUIDsRelation
from pokerserver.models import InvalidTurnError, NotYourTurnError, Player, PositionOccupiedError
from tests.u... | MartinAltmayer/pokerserver | tests/integration/controllers/test_table.py | Python | gpl-3.0 | 14,923 | 0.000804 |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: testStream.py
# Purpose: tests for stream.py
#
# Authors: Michael Scott Cuthbert
# Christopher Ariza
#
# Copyright: Copyright © 2009-2014 Michael Scott Cuthbert and the mu... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/test/testStream.py | Python | mit | 284,928 | 0.006914 |
import os
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import color_style
from django.template.base import add_to_builtins
from django.template.loaders.filesystem import Loader
from django_extensions.utils import validatingtemplatet... | fusionbox/django-extensions | django_extensions/management/commands/validate_templates.py | Python | mit | 3,269 | 0.003059 |
#!/usr/bin/env python
import sys
import rospy
from crazyflie_rospy.srv import AddCrazyflie, AddCrazyflieRequest, AddCrazyflieResponse
def main(args):
rospy.init_node('crazyflie_add')
uri = rospy.get_param("~uri")
tf_prefix = rospy.get_param("~tf_prefix")
roll_trim = rospy.get_param("~roll_trim", 0.0)... | potix2/crazyflie_rospy | scripts/crazyflie_add.py | Python | mit | 1,867 | 0.002142 |
from django import template
from django.conf import settings
import json
from geotrek.outdoor.models import Practice, RatingScale, Site
register = template.Library()
@register.simple_tag
def is_outdoor_enabled():
return 'geotrek.outdoor' in settings.INSTALLED_APPS
@register.simple_tag
def site_practices():
... | makinacorpus/Geotrek | geotrek/outdoor/templatetags/outdoor_tags.py | Python | bsd-2-clause | 1,633 | 0 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import re
from builtins import open
INCLUDE_PARSER = re.compile(r'^\s*include... | twitter/pants | contrib/scrooge/src/python/pants/contrib/scrooge/tasks/thrift_util.py | Python | apache-2.0 | 2,327 | 0.011603 |
from __future__ import unicode_literals
from builtins import str
from builtins import object
import logging, os, os.path, shutil
from django.test import TestCase
from scrapy import signals
from scrapy.exceptions import DropItem
from scrapy.utils.project import get_project_settings
settings = get_project_settings()
... | DeanSherwin/django-dynamic-scraper | tests/scraper/scraper_test.py | Python | bsd-3-clause | 10,956 | 0.011044 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.