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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 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
## ... | EUDAT-B2SHARE/invenio-old | modules/miscutil/lib/mailutils.py | Python | gpl-2.0 | 17,746 | 0.00231 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'sign_in.ui'
#
# Created: Mon Jun 22 00:34:42 2015
# by: PyQt5 UI code generator 5.2.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_sign_inDialog(object):
def setupUi... | dita-programming/dita-access | view/ui_sign_in.py | Python | gpl-2.0 | 6,113 | 0.014068 |
"""Tests for the widgets of the ``django_libs`` app."""
from django.test import TestCase
from ..widgets import ColorPickerWidget
class ColorPickerWidgetTestCase(TestCase):
"""Tests for the ``ColorPickerWidget`` widget."""
longMessage = True
def setUp(self):
self.widget = ColorPickerWidget()
... | bitmazk/django-libs | django_libs/tests/widget_tests.py | Python | mit | 488 | 0 |
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from django.utils import timezone
from django.http import HttpResponse, HttpRequest
from zilencer.models import Deployment, RemotePushDeviceToken, RemoteZulipServer
from zerver.decorator import has_request_variables, REQ
from z... | vabs22/zulip | zilencer/views.py | Python | apache-2.0 | 4,479 | 0.003572 |
# -*-mode: python; py-indent-offset: 4; tab-width: 8; coding: iso-8859-1 -*-
# DLLM (non-linear Differentiated Lifting Line Model, open source software)
#
# Copyright (C) 2013-2015 Airbus Group SAS
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Pub... | matthieu-meaux/DLLM | modules/DLLM/DLLMKernel/DLLMMesh.py | Python | gpl-2.0 | 3,858 | 0.023587 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import time... | Azure/azure-sdk-for-python | sdk/eventhub/azure-eventhub/tests/livetest/synctests/test_reconnect.py | Python | mit | 4,935 | 0.003647 |
from pymongo import MongoClient
import multiprocessing
import threading
import datetime
import time
cache = MongoClient(host='10.8.8.111', port=27017, connect=False)['cache25']
db30 = MongoClient(host='10.8.8.111', port=27017, connect=False)['onionsBackupOnline']
events = db30['events']
userAttr = cache['userAttr']
d... | summer-liu/events_cache_scripts | report/cache10.py | Python | mit | 9,568 | 0.000941 |
# coding:utf-8
# 测试多线程
import threading
import time
from utils import fn_timer
from multiprocessing.dummy import Pool
import requests
from utils import urls
# 耗时任务:听音乐
def music(name):
print 'I am listening to music {0}'.format(name)
time.sleep(1)
# 耗时任务:看电影
def movie(name):
print 'I am wa... | dnxbjyj/python-basic | concurrence/multi_threading.py | Python | mit | 4,446 | 0.007172 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sample_app.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that t... | bianchimro/django-search-views | sample_app/manage.py | Python | mit | 808 | 0 |
from collections import namedtuple
from django.core.management.base import BaseCommand
from tqdm import tqdm
Progress = namedtuple(
'Progress',
[
'progress_fraction',
'message',
'extra_data',
'level',
]
)
class ProgressTracker():
def __init__(self, total=100, level=0... | jamalex/kolibri | kolibri/tasks/management/commands/base.py | Python | mit | 2,905 | 0.000688 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ava.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| benhoff/ava | src/manage.py | Python | gpl-3.0 | 246 | 0 |
META = [{
'lookup': 'city',
'tag': 'city',
'path': ['names','en'],
},{
'lookup': 'continent',
'tag': 'continent',
'path': ['names','en'],
},{
'lookup': 'continent_code',
'tag': 'continent',
'path': ['code'],
},{
'loo... | ovcrash/geoip-attack-map | DataServer/const.py | Python | gpl-3.0 | 1,888 | 0.039725 |
#!/usr/bin/python
import os
# With the addition of Keystone, to use an openstack cloud you should
# authenticate against keystone, which returns a **Token** and **Service
# Catalog**. The catalog contains the endpoint for all services the
# user/tenant has access to - including nova, glance, keystone, swift.
#
# *NO... | wettenhj/mytardis-swift-uploader | openrc.py | Python | bsd-3-clause | 994 | 0.001006 |
# ~*~ coding: utf-8 ~*~
from collections import namedtuple
from rest_framework import status
from rest_framework.serializers import ValidationError
from rest_framework.response import Response
from django.utils.translation import ugettext_lazy as _
from django.shortcuts import get_object_or_404, Http404
from common.u... | zsjohny/jumpserver | apps/assets/api/node.py | Python | gpl-2.0 | 8,992 | 0.00045 |
import parser
import unittest
import sys
class TestVideoParser(unittest.TestCase):
def test_parse_video(self):
if sys.platform.startswith('win'):
path = '\\server\\Movies\\Brave (2007)\\Brave (2006).mkv'
else:
path = '/server/Movies/Brave (2007)/Brave (2006).mkv'
vi... | tickbg/skaer | naming/test_parser.py | Python | gpl-3.0 | 2,913 | 0.00309 |
from django.core import checks
from feincms import extensions
class Extension(extensions.Extension):
def handle_model(self):
cls = self.model
def render_json(self, request):
"""Render the feincms regions into a dictionary."""
def region_data(region):
conte... | incuna/feincms-extensions | feincms_extensions/render_json.py | Python | bsd-2-clause | 1,559 | 0.000641 |
"""Support for getting statistical data from a Pi-hole system."""
import logging
from homeassistant.helpers.entity import Entity
from .const import (
ATTR_BLOCKED_DOMAINS,
DOMAIN as PIHOLE_DOMAIN,
SENSOR_DICT,
SENSOR_LIST,
)
LOGGER = logging.getLogger(__name__)
async def async_setup_platform(hass, ... | leppa/home-assistant | homeassistant/components/pi_hole/sensor.py | Python | apache-2.0 | 2,321 | 0.000431 |
# -*- coding: utf-8 -*-
"""
Test cases to cover Accounts-related behaviors of the User API application
"""
import datetime
import hashlib
import json
from copy import deepcopy
import unittest
import ddt
import mock
import pytz
import six
from django.conf import settings
from django.test.testcases import TransactionT... | appsembler/edx-platform | openedx/core/djangoapps/user_api/accounts/tests/test_views.py | Python | agpl-3.0 | 46,567 | 0.002966 |
import distutils.dir_util
import os
from django.shortcuts import render
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
### Rest API setup
import rest_framework.routers
import rest_framework.viewsets
import rest_framework.filters
import... | andyneff/voxel-globe | voxel_globe/ingest/views.py | Python | mit | 4,787 | 0.022143 |
import asyncio
import re
from operator import attrgetter
from stratus.loader import hook
plugin_info = {
"plugin_category": "core",
"command_category_name": "Informational"
}
@asyncio.coroutine
@hook.command("help", autohelp=False)
def help_command(text, conn, bot, notice, has_permission):
"""[command] ... | lukeroge/CloudbotX | plugins/help.py | Python | gpl-3.0 | 2,905 | 0.002754 |
import unittest
import os
import numpy as np
from pyresample import plot, geometry, utils, kd_tree
try:
import matplotlib
matplotlib.use('Agg')
except ImportError:
pass # Postpone fail to individual tests
def tmp(f):
f.tmp = True
return f
class Test(unittest.TestCase):
filename = os.pat... | jhamman/pyresample | pyresample/test/test_plot.py | Python | lgpl-3.0 | 3,440 | 0.002907 |
import sys
sys.path = ['.'] + sys.path
from test.test_support import verbose, run_unittest
import re
from re import Scanner
import sys, os, traceback
from weakref import proxy
# Misc tests from Tim Peters' re.doc
# WARNING: Don't change details in these tests if you don't know
# what you're doing. Some of these test... | mancoast/CPythonPyc_test | crash/265_test_re.py | Python | gpl-3.0 | 37,806 | 0.003095 |
# pylint: skip-file
from __future__ import print_function
import mxnet as mx
from mxnet import gluon
from mxnet.gluon import nn
import numpy as np
import logging
from common import get_data
from mxnet import autograd
logging.basicConfig(level=logging.DEBUG)
# define network
def get_net():
net = nn.Sequential()
... | hotpxl/mxnet | tests/python/train/test_autograd.py | Python | apache-2.0 | 2,949 | 0.00373 |
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ... | Yelp/kafka-utils | tests/util/zookeeper_test.py | Python | apache-2.0 | 15,746 | 0.000889 |
import copy
import unittest
import warnings
import mock
import numpy
import chainer
from chainer.backends import cuda
from chainer.backends import intel64
from chainer import initializers
from chainer import testing
from chainer.testing import attr
class TestLink(unittest.TestCase):
def setUp(self):
x_... | ronekko/chainer | tests/chainer_tests/test_link.py | Python | mit | 71,956 | 0.00025 |
from setuptools import setup, find_packages
setup(
name='hk_glazer',
version='0.0.8',
description='Convert compatible JSON configs to DeBAM/DeTIM config.dat files',
url='https://github.com/fmuzf/python_hk_glazer',
author='Lyman Gillispie',
author_email='lyman.gillispie@gmail.com',
packages=... | fmuzf/python_hk_glazer | setup.py | Python | mit | 566 | 0.008834 |
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/perl-font-ttf/package.py | Python | lgpl-2.1 | 1,567 | 0.001914 |
# vim: set fileencoding=utf-8 :
#
# (C) 2014 Guido Günther <agx@sigxcpu.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) an... | agx/git-buildpackage | gbp/format.py | Python | gpl-2.0 | 2,429 | 0.000824 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... | AnshulYADAV007/Lean | Algorithm.Python/OptionDataNullReferenceRegressionAlgorithm.py | Python | apache-2.0 | 1,485 | 0.007417 |
#*-coding:Utf-8 -*
#!/usr/bin/python3.2
"""Fichier contenant la classe generale d'objet algébriques contenant + * et eventuellement /"""
class arith(object):
"""Classe generique contenant les methodes redondantes"""
def __ne__(self,autre):
"""Definition de !="""
return not(self == autre)
def __radd__(self,au... | kalaspa/mc-eliece | src/arith.py | Python | gpl-3.0 | 891 | 0.042745 |
# coding: utf-8
from common import base
class Plugin(base.BASE):
__name__ = 'csdn'
__title__ = 'CSDN'
__url__ = 'http://www.csdn.net/'
def register(self, target):
self.information = {
'email': {
'url': 'http://passport.csdn.net/account/register',
... | tonybreak/Registered | plugins/csdn.py | Python | gpl-3.0 | 675 | 0.001481 |
from awards.forms import AwardForm
from awards.models import JudgeAllowance
from awards.models import Award
from challenges.decorators import judge_required
from challenges.models import Submission
from django.contrib import messages
from django.http import Http404, HttpResponseRedirect
from django.views.decorators.htt... | mozilla/mozilla-ignite | apps/awards/views.py | Python | bsd-3-clause | 2,471 | 0 |
#!/usr/bin/python
# Copyright (c) 2016, Pierre Jodouin <pjodouin@virtualcomputing.solutions>
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/amazon/lambda_policy.py | Python | bsd-3-clause | 13,776 | 0.00363 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
SpatialDecision
A QGIS plugin
This is a SDSS template for the GEO1005 course
-------------------
begin : 2015-11-02
git... | VagosAplas/GEO1005-Fire | SpatialDecision/utility_functions.py | Python | gpl-2.0 | 32,661 | 0.003827 |
"""Demo platform that has a couple of fake sensors."""
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
PERCENTAGE,
TEMP_CELSIUS,
)
from homeassistant.helpers.entity import Entity
from . import DOMAIN
async def async_setup_platform(hass, confi... | tchellomello/home-assistant | homeassistant/components/demo/sensor.py | Python | apache-2.0 | 2,682 | 0.001119 |
#
# Copyright (c) 2021 Project CHIP 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 agreed to i... | project-chip/connectedhomeip | scripts/tools/memory/memdf/util/pretty.py | Python | apache-2.0 | 957 | 0 |
from flask import render_template
from pyflipdot.plugins import get_pluginmanager
from pyflipdot.web.view import MenuFlaskView
__author__ = 'teddydestodes'
class AdminView(MenuFlaskView):
route_base = "admin"
menu_name = "Admin"
def index(self):
return render_template('base.html')
class Plugin... | TeddyDesTodes/pyflipdot | pyflipdot/web/admin/__init__.py | Python | bsd-3-clause | 559 | 0.003578 |
# Copyright 2015 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... | u-engine/UIforETW | bin/ETWPackSymbols.py | Python | apache-2.0 | 4,627 | 0.016425 |
import json
from datetime import datetime
import re
from .utils import date_to_str, str_to_date
def _is_datestring(s):
return isinstance(s, str) and \
re.match(r"(\d{4})-(\d{2})-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})", s)
def _encode_datetime(obj):
if isinstance(obj, datetime):
return date_to_str... | uezo/minette-python | minette/serializer.py | Python | apache-2.0 | 6,581 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from ..lib.decorators import json
from . import api
@api.route("/test", methods=["GET"])
@json
def test():
return {}
@api.route("/auth/register", ... | ee-book/api | api/v1/users.py | Python | apache-2.0 | 416 | 0.004808 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | chanceraine/nupic.research | tests/classification/test_sensor_data_classification.py | Python | agpl-3.0 | 7,592 | 0.004478 |
import os
# We'll render HTML templates and access data sent by POST
# using the request object from flask. Redirect and url_for
# will be used to redirect the user once the upload is done
# and send_from_directory will help us to send/show on the
# browser the file that the user just uploaded
from flask import Flask, ... | duaraghav8/Corque | demo.py | Python | mit | 2,535 | 0.013807 |
from django.contrib.auth import get_user_model
from rest_framework.fields import CharField
from rest_framework.serializers import ModelSerializer
from grandchallenge.challenges.models import Challenge
from grandchallenge.components.serializers import (
ComponentInterfaceValueSerializer,
)
from grandchallenge.evalu... | comic/comic-django | app/grandchallenge/evaluation/serializers.py | Python | apache-2.0 | 1,856 | 0 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Delivery Costs',
'version': '1.0',
'category': 'Stock',
'description': """
Allows you to add delivery methods in sale orders and picking.
======================================================... | vileopratama/vitech | src/addons/delivery/__openerp__.py | Python | mit | 886 | 0 |
import unittest
from PyFoam.Basics.TemplateFile import TemplateFile,TemplateFileOldFormat,PyratempPreprocessor
from PyFoam.Error import FatalErrorPyFoamException
from tempfile import mktemp
from PyFoam.ThirdParty.six import PY3
import sys
theSuite=unittest.TestSuite()
template1="""$$ y = 3+x
This should be $x+y$"... | Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | unittests/Basics/test_TemplateFile.py | Python | gpl-2.0 | 7,289 | 0.019207 |
"""JVPN netstats libraries
"""
__author__ = 'e@dscp.org (Ebben Aries)'
import socket
import struct
def GetNetstats(device):
device = device + ':'
for line in open('/proc/net/dev', 'r'):
data = filter(None, line.split(' '))
if data[0] == device:
return (data[1], data[2], data[9], data[10])
def Get... | earies/jvpn | jvpn/netstats.py | Python | apache-2.0 | 1,247 | 0.020048 |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is een SQL-expressie zoals "field1=\'newvalue\'". U kunt de resultaten van een JOIN niet updaten of wissen',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S'... | danisuke0781/instant-press | languages/nl.py | Python | gpl-2.0 | 14,840 | 0.021972 |
# Aspect ratio
# create mesh
from SMESH_mechanic import *
# get faces with aspect ratio > 1.5
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 1.5)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with aspect ratio > 1.5:", len(ids)
# copy the faces with aspect ratio > 1.5 to a... | FedoraScientific/salome-smesh | doc/salome/examples/filters_ex01.py | Python | lgpl-2.1 | 1,332 | 0.016517 |
# -*- coding: utf-8 -*-
'''
Created on Oct 2, 2010
@author: dimitry (zavlab1)
'''
from gi.repository import Gtk
from gi.repository import Gdk
from foobnix.gui.service.path_service import get_foobnix_resourse_path_by_name
from foobnix.util.const import ICON_FOOBNIX
from foobnix.version import FOOBNIX_VERSION
class Ab... | kagel/foobnix | foobnix/gui/about/about.py | Python | gpl-3.0 | 1,313 | 0.008397 |
#! /usr/bin/env python
###############################################################################
#
# simulavr - A simulator for the Atmel AVR family of microcontrollers.
# Copyright (C) 2001, 2002 Theodore A. Roth
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... | simark/simulavr | regress/test_opcodes/test_SUB.py | Python | gpl-2.0 | 3,851 | 0.027266 |
# The Craftr build system
# Copyright (C) 2016 Niklas Rosenstein
#
# 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) any later version.
#
# ... | winksaville/craftr | craftr/defaults.py | Python | gpl-3.0 | 10,759 | 0.008458 |
# -*- coding: UTF-8 -*-
#
"""css3make tester"""
class GnrCustomWebPage(object):
py_requires = "gnrcomponents/testhandler:TestHandlerBase"
dojo_theme = 'tundra'
def test_1_rounded(self, pane):
sl = pane.slotBar('k,*,test,*')
sl.k.verticalSlider(value='^.k',minimum=0,maximum='30',intermedi... | poppogbr/genropy | packages/test15/webpages/tools/css3make.py | Python | lgpl-2.1 | 5,203 | 0.032866 |
# -*- coding: utf-8 -*-
# TEST_UNICODE_LITERALS
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
import pytest
import numpy as np
from ...extern import six
from ..data_info import dtype_info_name
STRING_TYPE_NAMES = {(False, 'S'): 'str... | AustereCuriosity/astropy | astropy/utils/tests/test_data_info.py | Python | bsd-3-clause | 1,575 | 0.00127 |
print("Greetings Earth! We come in peace.")
| morepj/numerical-mooc | working/HelloWorld.py | Python | mit | 44 | 0 |
from __future__ import print_function
from __future__ import absolute_import
import re
from pyingest.config.utils import u2asc
from .default import DefaultParser
from .author_names import AuthorNames
from .entity_convert import EntityConverter
head_dict = {'TITLE:': 'journal', 'NUMBER:': 'volume', 'SUBJECT:': 'title',... | adsabs/adsabs-pyingest | pyingest/parsers/gcncirc.py | Python | mit | 4,888 | 0.000818 |
#!/usr/bin/env python
# Author: Richard Bradshaw, R.T.Bradshaw@soton.ac.uk
# Module to fit various curves to provided x/y data
# Current available curves: Linear, Gaussian, Lorentzian, Voigt
# Requirements: lmfit, numpy, matplotlib (as dependencies of lmfit)
from lmfit.models import LinearModel,GaussianModel,Lorent... | rtb1c13/scripts | IR_lineshapes/lmcurvefit.py | Python | gpl-2.0 | 5,749 | 0.003131 |
# Copyright (c) 2014 Red Hat, 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 require... | cloudbase/neutron-virtualbox | neutron/db/migration/migrate_to_ml2.py | Python | apache-2.0 | 19,607 | 0.000102 |
import nltk.data
from nltk.tokenize import word_tokenize, sent_tokenize
from util import errors, cleaning
def tokenize(**kwargs):
"""Tokenize text using nltk's tokenizer."""
if 'text' in kwargs.keys():
return word_tokenize(kwargs['text'])
raise errors.CustomAPIError('No text argument found.', status_code=400,... | 904labs/ctTrakr | nlp/simple.py | Python | mit | 764 | 0.024869 |
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests of the branch interface."""
__metaclass__ = type
from bzrlib.branch import format_registry as branch_format_registry
from bzrlib.bzrdir import BzrProber
from bzrlib... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/code/interfaces/tests/test_branch.py | Python | agpl-3.0 | 2,218 | 0 |
# This script gives an example of how to scrape a webpage
import requests
from BeautifulSoup import BeautifulSoup
url = "http://chicagofoodtruckfinder.com/weekly-schedule"
truck_data_list = []
soup = BeautifulSoup(requests.post(url).text)
table = soup.find("table").findAll("tr")
days = [d.text for d in table[0].find... | lbybee/Python-for-Econ | Chap_4/scraper_example.py | Python | gpl-2.0 | 1,393 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-20 18:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posgradmin', '0034_auto_20190620_1333'),
]
operations = [
migrations.Remov... | sostenibilidad-unam/posgrado | posgradmin/posgradmin/migrations/0035_auto_20190620_1343.py | Python | gpl-3.0 | 1,049 | 0.001907 |
__author__ = 'Vitalii K'
from itertools import groupby
SEQ_LENGTH = 4
def is_in_matrix(m):
len_list = [[len(list(group)) for key, group in groupby(j)] for j in m]
if any(map(lambda x: [i for i in x if i >= SEQ_LENGTH], len_list)):
return True
return False
def get_diagonals(m):
d = []
f... | tivaliy/empire-of-code | find_sequence.py | Python | gpl-2.0 | 1,551 | 0.000645 |
from django.contrib import admin
from models import *
admin.site.register(Section) | igudym/twango | twango/template/default/src/apps/twango_dashboard/admin.py | Python | bsd-3-clause | 83 | 0.012048 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for parser and parser plugin presets."""
from __future__ import unicode_literals
import unittest
from plaso.containers import artifacts
from plaso.parsers import presets
from tests import test_lib as shared_test_lib
class ParserPresetTest(shared_test_lib.Bas... | rgayon/plaso | tests/parsers/presets.py | Python | apache-2.0 | 4,926 | 0.003045 |
# -*- coding: utf-8 -*- pylint: disable-msg=R0801
#
# Copyright (c) 2013 Rodolphe Quiédeville <rodolphe@quiedeville.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ver... | rodo/cotetra | cotetra/survey/api.py | Python | agpl-3.0 | 1,782 | 0 |
lines = int(input("How many lines of text? "))
lineText = input("What is the line of text? ")
for i in range(lines):
print(lineText) | ZachOhara/OCSTA-Programming-Contest-2015 | python/TestPrintLines.py | Python | gpl-3.0 | 134 | 0.014925 |
"""
Copyright (c) 2012 Philip Schliehauf (uniphil@gmail.com) and the
Queen's University Applied Sustainability Centre
This project is hosted on github; for up-to-date code and contacts:
https://github.com/Queens-Applied-Sustainability/PyRTM
This file is part of PyRTM.
PyRTM is free so... | Queens-Applied-Sustainability/PyRTM | rtm/test/test_cache.py | Python | gpl-3.0 | 2,536 | 0.001577 |
# http://stackoverflow.com/questions/1477294/generate-random-utf-8-string-in-python
import random
def get_random_unicode(length):
try:
get_char = unichr
except NameError:
get_char = chr
# Update this to include code point ranges to be sampled
include_ranges = [
(0x0021, ... | gouthambs/Flask-Blogging | test/utils.py | Python | mit | 948 | 0 |
# -*- coding: utf-8 -*-
# Minio Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015, 2016, 2017 Minio, 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.ap... | donatello/minio-py | tests/unit/minio_test.py | Python | apache-2.0 | 3,851 | 0.000519 |
from .StateBase import StateBase
from neo.Core.Fixed8 import Fixed8
from neo.Core.IO.BinaryReader import BinaryReader
from neo.IO.MemoryStream import StreamManager
from neo.Core.AssetType import AssetType
from neo.Core.UInt160 import UInt160
from neo.Core.Cryptography.Crypto import Crypto
from neo.Core.Cryptography.ECC... | hal0x2328/neo-python | neo/Core/State/AssetState.py | Python | mit | 6,477 | 0.000926 |
# 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, software
# distribu... | quantumlib/OpenFermion | src/openfermion/measurements/qubit_partitioning.py | Python | apache-2.0 | 9,586 | 0.000104 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Osmo Salomaa
#
# 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) any later version.
#
# This pr... | otsaloma/poor-maps | guides/foursquare.py | Python | gpl-3.0 | 4,437 | 0.001129 |
#!/usr/bin/env python
# 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 ... | narasimhan-v/avocado-misc-tests-1 | io/net/multicast.py | Python | gpl-2.0 | 5,757 | 0 |
from django.conf.urls import url
from . import views
urlpatterns = [
# ex: /polls/
url(r'^$', views.index, name='index'),
# ex: /polls/5/
url(r'^(?P<question_id>[0-9]+)/$', views.detail, name='detail'),
# ex: /polls/5/results/
url(r'^(?P<question_id>[0-9]+)/results/$', views.results, name='results'),
# ex: /pol... | druss16/danslist | polls/urls.py | Python | mit | 400 | 0.02 |
"""useful context managers"""
from contextlib import suppress
with suppress(ModuleNotFoundError):
from lag import *
import os
import contextlib
def clog(*args, condition=True, log_func=print, **kwargs):
if condition:
return log_func(*args, **kwargs)
@contextlib.contextmanager
def cd(newdir, verbos... | thorwhalen/ut | util/context_managers.py | Python | mit | 908 | 0.001101 |
"""
Script to evaluate intermodal forward Brillouin scattering in a cylindrical SiO2 waveguide
"""
# Import the necessary packages
import time
import datetime
import numpy as np
import sys
import copy
from matplotlib.ticker import AutoMinorLocator
import math
sys.path.append("../backend/")
import material... | bjornsturmberg/NumBAT | JOSAB_tutorial/simo-josab-IFSBS-1umcylwg-SiO2.py | Python | gpl-3.0 | 7,020 | 0.010684 |
from copy import copy
import silk.utils.six as six
from silk.singleton import Singleton
def default_permissions(user):
if user:
return user.is_staff
return False
class SilkyConfig(six.with_metaclass(Singleton, object)):
defaults = {
'SILKY_DYNAMIC_PROFILING': [],
'SILKY_IGNORE_... | Alkalit/silk | silk/config.py | Python | mit | 1,268 | 0.000789 |
class DataTypeError(RuntimeError):
"""
Generic exception class for SDoc1 language errors with data types and expressions.
"""
pass
| SDoc/py-sdoc | sdoc/sdoc1/error.py | Python | mit | 147 | 0.006803 |
""" Here, we need some documentation...
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import types
import threading
import time
import six
from DIRAC import gLogger
from DIRAC.Core.Utilities.DIRACSingleton import DIRACSingleton
@... | yujikato/DIRAC | src/DIRAC/Core/Utilities/Devloader.py | Python | gpl-3.0 | 2,365 | 0.011839 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('obligarcy', '0006_auto_20151009_1947'),
]
operations = [
migrations.AlterField(
... | polypmer/obligarcy | obligarcy/migrations/0007_auto_20151010_2304.py | Python | gpl-3.0 | 696 | 0 |
from collections import defaultdict
class ObservableMemory:
def __init__(self, subject=None, addrWidth=16):
self.physMask = 0xffff
if addrWidth > 16:
# even with 32-bit address space, model only 256k memory
self.physMask = 0x3ffff
if subject is None:
su... | mkeller0815/py65 | py65/memory.py | Python | bsd-3-clause | 2,382 | 0.00084 |
# Generated by Django 2.2.3 on 2019-07-26 13:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("payments", "0013_auto_20190724_1628")]
operations = [
migrations.AlterModelOptions(
name="payment",
options={"get_latest_by": "created", ... | lafranceinsoumise/api-django | agir/payments/migrations/0014_auto_20190726_1503.py | Python | agpl-3.0 | 364 | 0 |
from django import template
from django.conf import settings
from django.template.loader import render_to_string
try:
from urlparse import urljoin
except ImportError:
from urllib.parse import urljoin
register = template.Library()
def get_settings():
"""Utility function to retrieve settings.py values wit... | saydulk/django-wysiwyg | django_wysiwyg/templatetags/wysiwyg.py | Python | mit | 2,413 | 0.002072 |
import fsui
from fsgamesys.context import fsgs
from launcher.i18n import gettext
from launcher.launcher_config import LauncherConfig
class CustomOptionsPage(fsui.Panel):
def __init__(self, parent):
fsui.Panel.__init__(self, parent)
self.layout = fsui.VerticalLayout()
label = fsui.MultiLin... | FrodeSolheim/fs-uae-launcher | launcher/ui/config/CustomOptionsPage.py | Python | gpl-2.0 | 2,973 | 0.000336 |
import flask
import keras
import numpy as np
import os
from keras.models import load_model
from PIL import Image
from flask import Flask, request
from jinja2 import Template
app = Flask(__name__)
model = load_model('smile.h5')
model._make_predict_function()
def predict_image(image):
image = image.convert(mode="... | lukas/ml-class | examples/keras-smile/smile-server-1.py | Python | gpl-2.0 | 1,356 | 0 |
import re
import sqlite3
import csv
import ast
import os
import sys
import fnmatch
import datetime
import xlrd
import win32com.client
def question_marks(st):
question_marks = '?'
for i in range(0, len(st.split(','))-1):
question_marks = question_marks + ",?"
return question_marks
def xlsx_to_arr(xlsx_file, works... | frederick623/pb | deltaone/d1_sbl_recon.py | Python | apache-2.0 | 7,739 | 0.030236 |
import os
import unittest
from vsg.rules import ieee
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_500_test_input.vhd'))
lExpected_lower = []
lExpected_lower.append('')
utils.read_file(os.path.join(s... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/ieee/test_rule_500.py | Python | gpl-3.0 | 2,648 | 0.003776 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from Tkinter import *
from ttk import *
class URLDialogView(object):
_LABEL_CONF = {'column': 0, 'padx': 5, 'pady': 5, 'sticky': W}
_ENTRY_CONF = {'padx': 5, 'pady': 5, 'sticky': E+W}
def __init__(self, parent, controller, data=N... | fzuellich/urlmonitor | view.py | Python | gpl-3.0 | 4,690 | 0.002559 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
here = lambda *a: os.path.join(os.path.dirname(__file__), *a)
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
... | chrism0dwk/PyTado | setup.py | Python | gpl-3.0 | 1,442 | 0.001387 |
#!/usr/bin/env python
"""
This script is mainly for running autotests on the build server, however, it
can also be used by engineers to run the tests locally on their machines.
It takes as optional parameters the path to the folder containing the test
executables (which must have names ending in _tests), and a list... | stangls/omim | tools/run_desktop_tests.py | Python | apache-2.0 | 9,109 | 0.007355 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Laurawly/tvm-1 | python/tvm/relay/backend/contrib/ethosu/te/identity.py | Python | apache-2.0 | 2,862 | 0.001048 |
import time
import datetime
from MyPy.core.exceptions import (
Warning, Error, InterfaceError, DatabaseError, DataError, OperationalError,
IntegrityError, InternalError, ProgrammingError, NotSupportedError
)
from MyPy.constants import fieldtypes
apilevel = '2.0'
threadsafety = 1
paramstyle = 'format'
def Co... | nasi/MyPy | MyPy/__init__.py | Python | bsd-3-clause | 2,276 | 0.010984 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-consumption/azure/mgmt/consumption/models/marketplace.py | Python | mit | 7,474 | 0.000803 |
from django.contrib import admin
# Register your models here.
from statistic import models | shownotes/snotes20-restapi | statistic/admin.py | Python | agpl-3.0 | 91 | 0.010989 |
import os
import unittest
def load_tests(loader, standard_tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
pattern = pattern or "test*.py"
# We are inside unittest.test.testmock, so the top-level is three notches up
top_level_dir = os.p... | Orav/kbengine | kbe/src/lib/python/Lib/unittest/test/testmock/__main__.py | Python | lgpl-3.0 | 641 | 0.00156 |
from CommonServerPython import *
''' STANDALONE FUNCTION '''
def get_threat_indicator_list(args: Dict[str, Any]) -> list:
"""
Executes cofense-threat-indicator-list command for given arguments.
:type args: ``Dict[str, Any]``
:param args: The script arguments provided by the user.
:return: List ... | VirusTotal/content | Packs/CofenseTriage/Scripts/CofenseTriageThreatEnrichment/CofenseTriageThreatEnrichment.py | Python | mit | 1,197 | 0.002506 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path imp... | jeffames-cs/nnot | pyfann/libfann.py | Python | mit | 29,340 | 0.00426 |
"""Expand target names in an aggregated coverage file."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from .... import types as t
from ....io import (
SortedSetEncoder,
write_json_file,
)
from . import (
CoverageAnalyzeTargetsConfig,
expand_indexes,
for... | azaghal/ansible | test/lib/ansible_test/_internal/coverage/analyze/targets/expand.py | Python | gpl-3.0 | 1,272 | 0.001572 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os, locale, sys
from core import controller
locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
debug = False
if len(sys.argv) > 1: debug = sys.argv[1] == '-d'
# Initialisation du controller principale
ctrl = controller.Controller(debug)
# démarrage du serveur
ctrl.run() | btouchard/piserver | src/piserver.py | Python | gpl-3.0 | 320 | 0.009404 |
#!/usr/bin/python
# build_native.py
# Build native codes
import sys
import os, os.path
import shutil
from optparse import OptionParser
import cocos
from MultiLanguage import MultiLanguage
import cocos_project
import json
import re
from xml.dom import minidom
import project_compile
BUILD_CFIG_FILE="build-cfg.json"
... | dios-game/dios-cocos | src/oslibs/cocos/cocos-src/tools/cocos2d-console/plugins/project_compile/build_android.py | Python | mit | 28,191 | 0.003689 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.