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 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('servo', '0013_auto_20150204_1113'),
]
operations = [
migrations.AddField(
model_name='orderstatus',
... | filipp/Servo | servo/migrations/0014_orderstatus_duration.py | Python | bsd-2-clause | 439 | 0 |
import urllib.request
import time
preço = 99.99 #algum valor maior
while preço >= 4.74:
pagina = urllib.request.urlopen(
'http://beans.itcarlow.ie/prices-loyalty.html')
texto = pagina.read().decode('utf8')
onde = texto.find('>$')
início = onde + 2
fim = início + 4
preço = float(t... | wsricardo/mcestudos | treinamento-webScraping/Abraji/p11.py | Python | gpl-3.0 | 468 | 0.021786 |
import pandas as pd
from ...config import _load_secrets
import sqlalchemy
import os
from tqdm import tqdm
class IlluminateSQLInterface:
"""A class representing a SQL interface to
Illuminate
"""
def __init__(self, secrets=None):
if secrets is None:
secrets = _load_secrets()
... | openEduConnect/eduextractor | eduextractor/sis/illuminate/illuminate_exporter.py | Python | mit | 1,702 | 0.006463 |
import os
import time as tm
import sys
# Handles the creation of condor files for a given set of directories
# -----------------------------------------------------------------------------
def createCondorFile(dataDir,outDir,run,day,times):
# Condor submission file name convention: run-day-time.condor
with ope... | Nablaquabla/sns-analysis | run-ba-analysis-v4.py | Python | gpl-3.0 | 5,144 | 0.033826 |
"""Collection of DIRAC useful file related modules.
.. warning::
By default on Error they return None.
"""
# pylint: skip-file
# getGlobbedFiles gives "RuntimeError: maximum recursion depth exceeded" in pylint
import os
import hashlib
import random
import glob
import sys
import re
import errno
__RCSID__ = "$Id$"... | arrabito/DIRAC | Core/Utilities/File.py | Python | gpl-3.0 | 7,925 | 0.012744 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2012 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
#
# This... | otherway/loc-spain | l10n_es_account_asset/account_asset.py | Python | agpl-3.0 | 9,813 | 0.002244 |
#
# Copyright 2001 - 2016 Ludek Smid [http://www.ospace.net/]
#
# This file is part of Outer Space.
#
# Outer Space 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
# (... | ospaceteam/outerspace | client/osci/dialog/ColorDefinitionDlg.py | Python | gpl-2.0 | 6,398 | 0.027665 |
#
# 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 us... | fharenheit/template-spark-app | src/main/python/mllib/ranking_metrics_example.py | Python | apache-2.0 | 2,197 | 0.00091 |
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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... | ktan2020/legacy-automation | win/Lib/site-packages/jpype/_jpackage.py | Python | mit | 1,988 | 0.013078 |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Internal shell widget : PythonShellWidget + Interpreter"""
# pylint: disable=C0103
# pylint: disable=R0903
# pylint: disable=R0911
# pylint: disable=R0201
#FIXME... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/spyderlib/widgets/internalshell.py | Python | gpl-3.0 | 16,008 | 0.005748 |
"""
niascape.usecase.postcount
投稿件数ユースケース
"""
import niascape
from niascape.repository import postcount
from niascape.utility.database import get_db
def day(option: dict) -> list:
with get_db(niascape.ini['database']) as db: # type: ignore # XXX セクションぶっこむとmypyさんにおこられ 辞書化すべきか
return postcount.day(db, **option)
... | ayziao/niascape | niascape/usecase/postcount.py | Python | mit | 1,264 | 0.01494 |
import gc
import os
import sys
import shlex
import subprocess
sys.path.insert(0, os.getcwd())
sys.path.insert(0, os.path.join(os.getcwd(), os.pardir))
from nose import SkipTest
from celery import current_app
from celery.tests.utils import unittest
import suite
GET_RSIZE = "/bin/ps -p %(pid)s -o rss="
QUICKTEST = i... | waseem18/oh-mainline | vendor/packages/celery/funtests/suite/test_leak.py | Python | agpl-3.0 | 3,713 | 0.001616 |
from celery.task import Task
from celery.registry import tasks
import datetime
import requests
import datetime
import settings
class Actuary(Task):
def run(self, user_id, page, **kwargs):
logger = self.get_logger(**kwargs)
logger.error("Actuary event captured.")
ts = datetime.datetime.... | antiface/Django-Actuary | actuary/tasks.py | Python | mit | 377 | 0.005305 |
"""Compressed Sparse Column matrix format"""
from __future__ import division, print_function, absolute_import
__docformat__ = "restructuredtext en"
__all__ = ['csc_matrix', 'isspmatrix_csc']
import numpy as np
from scipy._lib.six import xrange
from ._sparsetools import csc_tocsr
from . import _sparsetools
from .sp... | Shaswat27/scipy | scipy/sparse/csc.py | Python | bsd-3-clause | 6,349 | 0.001733 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# al... | ankur0493/google_python_exercises | basic/list2.py | Python | apache-2.0 | 2,574 | 0.012044 |
import math
import sys
sys.path.append("..")
import nopassword
print
print "Predfined runes"
runes = nopassword.get_runes()
for k, v in runes.items():
print k.ljust(20), len(v),"\t", v
print
print "Generate alphabets"
alphabets = {}
length = 5
itterations = 0
rr = runes["digits"]
while True:
itterations +... | nopassword/nopassword.py | tests/test_keyfile.py | Python | apache-2.0 | 707 | 0.015559 |
# Copyright (c) 2016 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 ... | eayunstack/neutron | neutron/tests/unit/agent/l3/test_dvr_snat_ns.py | Python | apache-2.0 | 2,142 | 0 |
# -*- coding: utf-8 -*-
import csv
import os
import re
try:
# Python 3
from urllib import request
except ImportError:
# Python 2
import urllib2 as request
from bs4 import BeautifulSoup
def extractFaqURL(url):
html = request.urlopen(url).read()
soup = BeautifulSoup(html, "html.p... | lvisdd/qnabot | webapp/data/jmafaq.py | Python | mit | 3,058 | 0.024526 |
# -*- coding: utf-8 -*-
"""Extensions module. Each extension is initialized in the app factory located
in app.py
"""
from flask.ext.bcrypt import Bcrypt
bcrypt = Bcrypt()
from flask.ext.login import LoginManager
login_manager = LoginManager()
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from flask.... | chudichudichudi/neuro-tedx-2 | tedx2/extensions.py | Python | bsd-3-clause | 655 | 0.010687 |
'''
Bubble
======
.. versionadded:: 1.1.0
.. image:: images/bubble.jpg
:align: right
The Bubble widget is a form of menu or a small popup where the menu options
are stacked either vertically or horizontally.
The :class:`Bubble` contains an arrow pointing in the direction you
choose.
Simple example
------------... | BillBillBillBill/Tickeys-linux | tickeys/kivy_32/kivy/uix/bubble.py | Python | mit | 12,590 | 0.000715 |
#!/usr/bin/env python
# deals with uploading grbl to arduino
# placed in a separate script to secondboot.py because I couldn't figure out how to CD into
# the right directory within python, so instead I'll do the "cd'ing" in rc.local, and call standalone script***
#*** EDIT: apparently passing cwd="directory" as an ar... | mn1del/rpi_cnc_img | secondboot_arduino.py | Python | gpl-3.0 | 1,627 | 0.014136 |
# Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import io
from typing import List, Optional, Union
from UM.FileHandler.FileHandler import FileHandler
from UM.FileHandler.FileWriter import FileWriter
from UM.FileHandler.WriteFileJob import WriteFileJob
from UM.Logger imp... | Ultimaker/Cura | plugins/DigitalLibrary/src/ExportFileJob.py | Python | lgpl-3.0 | 2,208 | 0.00317 |
import functools
from pluss.app import app
from pluss.util.cache import Cache
RATE_LIMIT_CACHE_KEY_TEMPLATE = 'pluss--remoteip--ratelimit--1--%s'
def ratelimited(func):
"""Includes the wrapped handler in the global rate limiter (60 calls/min)."""
@functools.wraps(func)
def wrapper(*args, **kwargs):
... | ayust/pluss | pluss/util/ratelimit.py | Python | mit | 1,111 | 0.007201 |
from ems.qt.graphics.storage.interfaces import SceneSerializer
from ems.qt.graphics.page_item import PageItem
class DictSceneSerializer(SceneSerializer):
def serialize(self, scene, tools):
saveData = {
'@author': 'Michael Tils',
'@desciption': 'Graphics Scene Contents',
... | mtils/ems | ems/qt/graphics/storage/dict_scene_serializer.py | Python | mit | 921 | 0.003257 |
#Milton Orlando Sarria
#filtrado elemental de ruido sinusoidal
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
#disenar el filtro usando una ventana hamming
b = signal.firwin(9, 0.8, window='hamming', pass_zero=True)
#definir la frecuencia de muestreo y generar un vector de tiempo hasta 5... | miltonsarria/dsp-python | filters/FIR/filter_sine1.py | Python | mit | 1,128 | 0.027482 |
from django.test import TestCase
from fixtureless import Factory
from owc_fixtureless import constants
from owc_fixtureless import models
class MageTestCase(TestCase):
def setUp(self):
self.factory = Factory()
def test_brothers_in_arms(self):
# Exclude the mage itself
mage_1 = self.f... | ricomoss/open-west-2015-fixtureless | owc_fixtureless/owc_fixtureless/tests.py | Python | mit | 927 | 0 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
import django.contrib.postgres.fields.hstore
class Migration(migrations.Migration):
dependencies = [
('hs_core', '0035_remove_deprecated_fields'),
]
operations = [
migrations.AddField(
model_name='contributor'... | hydroshare/hydroshare | hs_core/migrations/0036_auto_20171117_0422.py | Python | bsd-3-clause | 639 | 0.00313 |
# coding: utf-8
# In[1]:
import lime
import sklearn
import numpy as np
import sklearn
import sklearn.ensemble
import sklearn.metrics
from __future__ import print_function
# In[2]:
from sklearn.datasets import fetch_20newsgroups
categories = ['alt.atheism', 'soc.religion.christian']
newsgroups_train = fetch_20news... | pramitchoudhary/Experiments | notebook_gallery/other_experiments/explore-models/modelinterpretation/lime/LIME_Explanation.py | Python | unlicense | 3,638 | 0.007971 |
#!/usr/bin/env python
# CPIP is a C/C++ Preprocessor implemented in Python.
# Copyright (C) 2008-2017 Paul Ross
#
# 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... | paulross/cpip | tests/integration/util/UnitTestsPerf.py | Python | gpl-2.0 | 4,715 | 0.009332 |
import sys
from contextlib import contextmanager
# Are we training (or testing)
training = False
@contextmanager
def context(**kwargs):
"""Temporarily change the values of context variables passed.
Enables the `with` syntax:
>>> with context(training=True):
...
"""
current = dict((k, geta... | kadarakos/funktional | funktional/context.py | Python | mit | 540 | 0.007407 |
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | vponomaryov/manila | manila/tests/api/v1/test_limits.py | Python | apache-2.0 | 29,404 | 0.000034 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
############################################################################
#
# MODULE: tr3.unregister
# AUTHOR(S): Soeren Gebbert
#
# PURPOSE: Unregister raster3d maps from space time raster3d datasets
# COPYRIGHT: (C) 2011 by the GRASS Development Team
#
#... | AsherBond/MondocosmOS | grass_trunk/temporal/tr3.unregister/tr3.unregister.py | Python | agpl-3.0 | 1,642 | 0.017052 |
from __future__ import absolute_import
import six
import warnings
from . import backend as K
from .utils.generic_utils import deserialize_keras_object
from .engine import Layer
def softmax(x, axis=-1):
"""Softmax activation function.
# Arguments
x : Tensor.
axis: Integer, axis along which the... | deepforge-dev/deepforge-keras | test/test-cases/activations.py | Python | apache-2.0 | 2,712 | 0.000369 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from ..mode... | amagdas/superdesk | server/apps/item_lock/components/item_lock.py | Python | agpl-3.0 | 5,241 | 0.00229 |
# coding: utf-8
# Copyright 2014-2015 Álvaro Justen <https://github.com/turicas/rows/>
#
# 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 yo... | tilacog/rows | rows/cli.py | Python | gpl-3.0 | 4,322 | 0.000231 |
# Created By: Eric Mc Sween
# Created On: 2007-12-12
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-... | fokusov/moneyguru | core/model/date.py | Python | gpl-3.0 | 21,665 | 0.004339 |
import logging
import requests
from collections import OrderedDict
import operator as op
from ..lib import text
from ..controllers.request_maker import RequestMaker, RequestException
class AutocompleteApi(object):
base_url = 'http://suggestqueries.google.com/complete/search'
base_params = {'client': 'firef... | tbelhalfaoui/giddle | giddle/controllers/autocomplete_api.py | Python | gpl-2.0 | 2,924 | 0.005472 |
#
# 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... | wileeam/airflow | tests/providers/amazon/aws/sensors/test_sagemaker_base.py | Python | apache-2.0 | 4,728 | 0.000212 |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Tests for the Timelines flow."""
from grr.lib import action_mocks
from grr.lib import aff4
from grr.lib import flags
from grr.lib import test_lib
# pylint: disable=unused-import
from grr.lib.flows.general import timelines as _
# pylint: enable=unused-im... | statik/grr | lib/flows/general/timelines_test.py | Python | apache-2.0 | 1,939 | 0.011346 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
**ui_constants.py**
**Platform:**
Windows, Linux, Mac Os X.
**Description:**
Defines **sIBL_GUI** package ui constants through the :class:`UiConstants` class.
**Others:**
"""
from __future__ import unicode_literals
__author__ = "Thomas Mansencal"
__copyri... | KelSolaar/sIBL_GUI | sibl_gui/globals/ui_constants.py | Python | gpl-3.0 | 9,825 | 0.002239 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from datetime import datetime
import re
from pandas.compat import (zip, range, lrange, StringIO)
from pandas import (DataFrame, Series, Index, date_range, compat,
Timestamp)
import pandas as pd
from numpy import nan
import numpy as np... | pjryan126/solid-start-careers | store/api/zillow/venv/lib/python2.7/site-packages/pandas/tests/frame/test_replace.py | Python | gpl-2.0 | 42,783 | 0.000093 |
from test import test_support
import unittest
import codecs
import sys, StringIO
class Queue(object):
"""
queue: write bytes at one end, read bytes from the other end
"""
def __init__(self):
self._buffer = ""
def write(self, chars):
self._buffer += chars
def read(self, size=-1... | mancoast/CPythonPyc_test | cpython/242_test_codecs.py | Python | gpl-3.0 | 27,615 | 0.001811 |
#!/usr/bin/env python
import os
import time
import logging
import argparse
from Queue import Queue
from threading import Thread
from salt.utils.event import LocalClientEvent
LOGGER = logging.getLogger()
MAX_TIMEOUT_VALUE=60*5
def __parse_record(event):
payload = event.get('data', {})
return payload.get('rec... | rehmanz/salt-reactors-demo | salt/formulas/base/reactor/ui_reactor.py | Python | mit | 2,365 | 0.00592 |
"""A simple memcache-like server.
The basic data structure maintained is a single in-memory dictionary
mapping string keys to string values, with operations get, set and
delete. (Both keys and values may contain Unicode.)
This is a TCP server listening on port 54321. There is no
authentication.
Requests provide an... | leetreveil/tulip | examples/cachesvr.py | Python | apache-2.0 | 9,357 | 0 |
"""
Tests that duplicate columns are handled appropriately when parsed by the
CSV engine. In general, the expected result is that they are either thoroughly
de-duplicated (if mangling requested) or ignored otherwise.
"""
from io import StringIO
import pytest
from pandas import DataFrame
import pandas.util.testing as ... | cbertinato/pandas | pandas/tests/io/parser/test_mangle_dupes.py | Python | bsd-3-clause | 3,885 | 0 |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from .models import Feature
class FeaturePlugin(CMSPluginBase):
model = Feature
name = _("RAD Feature Plugin")
render_templ... | taghq/radcity_site | pdxrad/cms_plugins.py | Python | apache-2.0 | 573 | 0.005236 |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, John Westcott IV <john.westcott.iv@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': ... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx_collection/plugins/modules/tower_receive.py | Python | apache-2.0 | 5,506 | 0.001453 |
#!BPY
"""
Name: 'Inter-Quake Model'
Blender: 249
Group: 'Export'
Tip: 'Export Inter-Quake Model files'
"""
import struct, math
import Blender
import BPyArmature
IQM_POSITION = 0
IQM_TEXCOORD = 1
IQM_NORMAL = 2
IQM_TANGENT = 3
IQM_BLENDINDEXES = 4
IQM_BLENDWEIGHTS = 5
IQM_COLOR ... | lsalzman/iqm | blender-2.49/iqm_export.py | Python | mit | 40,875 | 0.006312 |
from datamodel import Library, Version, Status, VersionCache, CollectionReference, Dependency
from google.appengine.ext import ndb
from test_base import TestBase
class VersionCacheTests(TestBase):
def test_versions_for_key(self):
library_key = ndb.Key(Library, 'a/b')
Version(id='v2.0.0', sha='x', status=St... | webcomponents/webcomponents.org | src/datamodel_test.py | Python | apache-2.0 | 5,078 | 0.007089 |
############################################################################
# Joshua R. Boverhof, LBNL
# See LBNLCopyright for copyright notice!
###########################################################################
import pydoc, sys
from pysphere.ZSI import TC
# If function.__name__ is read-only, fail
def _x()... | devopshq/vspheretools | pysphere/ZSI/generate/pyclass.py | Python | mit | 9,999 | 0.007101 |
from stft import STFT
from pvoc import PhaseVocoder
import numpy as np
stft = STFT(1024, 2, 4)
pvoc = PhaseVocoder(stft)
def process(input, output):
for x in stft.forward(input):
x = pvoc.forward(x)
x = pvoc.shift(x, lambda y: y * 1.5)
x = pvoc.backward(x)
stft.backward(x)
stft... | nwoeanhinnogaehr/live-python-jacker | examples/pitchshift.py | Python | gpl-3.0 | 349 | 0.002865 |
from collections import defaultdict
from contextlib import contextmanager
import os
import plistlib
import re
import threading
import yaml
import sublime
MYPY = False
if MYPY:
from typing import DefaultDict, List, Optional
if 'syntax_file_map' not in globals():
syntax_file_map = defaultdict(list) # type: ... | divmain/GitSavvy | common/util/file.py | Python | mit | 4,644 | 0.000861 |
"Conferencing code"
# XXX A relatively simple enhancement to this would be to store the
# volumes for each source in the conference, and use an exponential
# decay type algorithm to determine the "loudest".
from shtoom.doug.source import Source
from twisted.internet.task import LoopingCall
from twisted.python impor... | braams/shtoom | shtoom/doug/conferencing.py | Python | lgpl-2.1 | 8,770 | 0.005701 |
# Copyright (c) 2013 MetaMetrics, Inc.
#
# 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 rights
# to use, copy, modify, merge, publish, d... | gilt/nova | nova/core/cfn_pyplates/options.py | Python | mit | 1,386 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Mayo Clinic
# 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... | hsolbrig/shexypy | shexypy/utils/dict_compare.py | Python | mit | 3,967 | 0.005294 |
# -*- coding: utf-8 -*-
# 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... | openstack/python-congressclient | doc/source/conf.py | Python | apache-2.0 | 3,547 | 0.000282 |
from tornado.web import HTTPError
from biothings.www.api.es.handlers.base_handler import BaseESRequestHandler
from biothings.www.api.es.transform import ScrollIterationDone
from biothings.www.api.es.query import BiothingScrollError, BiothingSearchError
from biothings.www.api.helper import BiothingParameterTypeError
fro... | SuLab/biothings.api | biothings/www/api/es/handlers/query_handler.py | Python | apache-2.0 | 15,331 | 0.006392 |
"""Adding a migration for the exploitability report.
Revision ID: 3a5471a358bf
Revises: 191d0453cc07
Create Date: 2013-10-25 07:07:33.968691
"""
# revision identifiers, used by Alembic.
revision = '3a5471a358bf'
down_revision = '4aacaea3eb48'
from alembic import op
from socorro.lib import citexttype, jsontype
from ... | adngdb/socorro | alembic/versions/3a5471a358bf_adding_a_migration_f.py | Python | mpl-2.0 | 1,624 | 0.010468 |
# 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... | mlperf/training_results_v0.7 | Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/tvm/tests/python/relay/test_op_level5.py | Python | apache-2.0 | 27,128 | 0.003834 |
from django import template
register = template.Library()
@register.filter
def duration(td):
seconds = td
minutes, seconds = divmod(seconds, 60)
hours, minutes = divmod(minutes, 60)
return "%d:%02d:%02d" % (hours, minutes, seconds) | baalkor/timetracking | opconsole/templatetags/duration.py | Python | apache-2.0 | 253 | 0.007905 |
# Copyright 2017 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... | xzturn/tensorflow | tensorflow/python/training/warm_starting_util.py | Python | apache-2.0 | 23,798 | 0.005042 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Intel Corp.
#
"""
Resource Pool Remove Plugin
"""
from control.commands.command import CommandResult
from control.plugin.manager import DeclarePlugin
from .resource_pool import ResourcePoolCommand
@DeclarePlugin('resource_pool_remove', 100)
class ResourcePoolRemoveComman... | intel-ctrlsys/actsys | actsys/control/commands/resource_pool/resource_pool_remove.py | Python | apache-2.0 | 933 | 0.003215 |
# 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-network/azure/mgmt/network/v2017_11_01/models/virtual_network_gateway_connection_list_entity_py3.py | Python | mit | 7,889 | 0.004056 |
##############################################################################################
# Copyright 2014-2015 Cloud Media Sdn. Bhd.
#
# This file is part of Xuan Application Development SDK.
#
# Xuan Application Development SDK is free software: you can redistribute it and/or modify
# it under the terms of... | TheStackBox/xuansdk | SDKLibrary/com/cloudMedia/theKuroBox/sdk/paramComponents/kbxSlider.py | Python | gpl-3.0 | 1,696 | 0.005896 |
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='Harmony',
version='0.1',
author='H. Gökhan Sarı',
author_email='th0th@returnfalse.net',
packages=['harmony'],
scripts=['bin/harmony'],
url='https://github.com/th0th/harmony/',
license='LICENSE.txt',
description='... | th0th/harmony | setup.py | Python | gpl-3.0 | 403 | 0 |
import re
import uuid
from xmodule.assetstore.assetmgr import AssetManager
XASSET_LOCATION_TAG = 'c4x'
XASSET_SRCREF_PREFIX = 'xasset:'
XASSET_THUMBNAIL_TAIL_NAME = '.jpg'
STREAM_DATA_CHUNK_SIZE = 1024
import os
import logging
import StringIO
from urlparse import urlparse, urlunparse, parse_qsl
from urllib import ... | MakeHer/edx-platform | common/lib/xmodule/xmodule/contentstore/content.py | Python | agpl-3.0 | 14,964 | 0.003609 |
#!/usr/bin/env python
# Tag Highlighter:
# Author: A. S. Budden <abudden _at_ gmail _dot_ com>
# Copyright: Copyright (C) 2009-2013 A. S. Budden
# Permission is hereby granted to use and distribute this code,
# with or without modifications, provided that this copyright
# notice is c... | ketor/z-vimrc | .vim/bundle/taghighlight/plugin/TagHighlight/module/config.py | Python | gpl-2.0 | 3,393 | 0.003831 |
import logging
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.urls import reverse
from zentral.utils.osx_package import get_standalone_package_builders
from .utils import delete_app, build_and_upload_app
logger = logging.getLogger("zentral.contrib.simplemdm.models")
c... | zentralopensource/zentral | zentral/contrib/simplemdm/models.py | Python | apache-2.0 | 3,296 | 0.002731 |
import sys
import random
# @include
def matrix_search(A, x):
row, col = 0, len(A[0]) - 1 # Start from the top-right corner.
# Keeps searching while there are unclassified rows and columns.
while row < len(A) and col >= 0:
if A[row][col] == x:
return True
elif A[row][col] < x:
... | meisamhe/GPLshared | Programming/MPI — AMath 483 583, Spring 2013 1.0 documentation_files/matrix_search.py | Python | gpl-3.0 | 2,103 | 0 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
from pex.fetcher import URLFetcher
from pex.network_configuration import NetworkConfiguration
from pex.requirements import Constraint, parse_require... | pantsbuild/pex | pex/resolve/requirement_configuration.py | Python | apache-2.0 | 2,532 | 0.00079 |
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import pynotify
import sys
if __name__ == '__main__':
if not pynotify.init("XY"):
sys.exit(1)
n = pynotify.Notification("X, Y Test",
"This notification should point to 150, 10")
n.set_hint("x", 150)
n.set_hi... | Distrotech/notify-python | tests/test-xy.py | Python | lgpl-2.1 | 418 | 0.004785 |
from nose.tools import *
from nose.plugins.attrib import attr
from django.test import TestCase
from django.core.management import call_command as call
from dasdocc.aggregator.tests.factories import FeedFactory, InvalidFeedFactory
from dasdocc.aggregator.models import Feed
class UpdateValidFeedsTests(TestCase):
d... | JohnRandom/django-aggregator | dasdocc/aggregator/tests/commands/TestUpdateFeeds.py | Python | bsd-3-clause | 786 | 0.002545 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import sys
from django.core.management.base import BaseCommand
from core import models
logger = logging.getLogger('fairintranet.technicians')
class Command(BaseCommand):
help =... | fairdk/fair-ubuntu-centre | installscripts/data/intranet/fairintranet/technicians/management/commands/install_site.py | Python | gpl-3.0 | 1,436 | 0.004875 |
from unittest import TestCase
from regulations.generator.layers import diff_applier
from regulations.generator.layers import tree_builder
from regulations.generator.node_types import REGTEXT
from collections import deque
class DiffApplierTest(TestCase):
def test_create_applier(self):
diff = {'some': 'di... | 18F/regulations-site | regulations/tests/diff_applier_tests.py | Python | cc0-1.0 | 8,525 | 0 |
from lettuce import step, world
from iotqautils.gtwRest import Rest_Utils_SBC
from common.user_steps import UserSteps
from common.gw_configuration import IOT_SERVER_ROOT,CBROKER_HEADER,CBROKER_PATH_HEADER
api = Rest_Utils_SBC(server_root=IOT_SERVER_ROOT+'/iot')
user_steps = UserSteps()
@step('a Service wi... | hilgroth/fiware-IoTAgent-Cplusplus | tests/e2e_tests/component/iot_api/services/create/setup.py | Python | agpl-3.0 | 10,033 | 0.011562 |
from .ddt_tile import ddt_tile
class ddt_tile_html(ddt_tile):
def make_parameters_form_01(self,
formparameters={},
):
'''Make htmlparameters
INPUT:
OUTPUT:
'''
#defaults:
htmlid='filtermenuform1';
htmltype='form_01';
formsubmi... | dmccloskey/ddt_python | ddt_python/ddt_tile_html.py | Python | mit | 2,646 | 0.032905 |
# -*- coding: utf-8 -*-
# pylint: disable=fixme, protected-access
"""The core module contains the SoCo class that implements
the main entry to the SoCo functionality
"""
from __future__ import unicode_literals
import datetime
import logging
import re
import socket
from functools import wraps
import warnings
from soco... | lawrenceakka/SoCo | soco/core.py | Python | mit | 73,424 | 0 |
from django.contrib import admin
from biz.network.models import Network, Subnet, Router
class NetworkAdmin(admin.ModelAdmin):
list_display = ("id", "name", "is_default")
class SubnetAdmin(admin.ModelAdmin):
list_display = ("id", "name", "address", "ip_version")
class RouterAdmin(admin.ModelAdmin):
l... | zhanghui9700/eonboard | eoncloud_web/biz/network/admin.py | Python | apache-2.0 | 487 | 0 |
import glob
import os
import numpy as np
def load_emebeddings(folder):
files = [filename for filename in glob.iglob(folder + '**', recursive=True) if not os.path.isdir(filename)]
w2v = {}
for file in files:
with open(file, "r", encoding='utf8') as lines:
for line in lines:
... | swagner-de/irws_homeworks | word_embeddings/embedding.py | Python | mit | 1,203 | 0.003325 |
#!/usr/bin/python -OOOO
# vim: set fileencoding=utf8 shiftwidth=4 tabstop=4 textwidth=80 foldmethod=marker :
# Copyright (c) 2010, Kou Man Tong. All rights reserved.
# For licensing, see LICENSE file included in the package.
"""
Base codec functions for bson.
"""
import struct
import cStringIO
import calendar, pytz
fro... | cupcicm/bson | bson/codec.py | Python | bsd-3-clause | 10,379 | 0.030061 |
#MenuTitle: Delete Hints in Visible Layers
# -*- coding: utf-8 -*-
__doc__="""
Deletes all hints in active layers of selected glyphs.
"""
import GlyphsApp
Font = Glyphs.font
selectedLayers = Font.selectedLayers
print "Deleting hints in active layer:"
def process( thisLayer ):
for x in reversed( range( len( thisLaye... | weiweihuanghuang/Glyphs-Scripts | Hinting/Delete Hints in Visible Layers.py | Python | apache-2.0 | 520 | 0.036538 |
server_module = 'txtemplates.echo'
backend_options = [{}]
backend_ids = ['default']
full_server_options = [({}, {})]
full_server_ids = ['default']
# vim: set ft=python sw=4 et spell spelllang=en:
| mdrohmann/txtemplates | tests/echo/conftest.py | Python | bsd-3-clause | 199 | 0 |
# encoding: utf-8
from __future__ import unicode_literals
from collections import deque
from .buffer import Buffer
from .compat import py2, str
from .line import Line
log = __import__('logging').getLogger(__name__)
def _pub(a):
return {i for i in a if i[0] != '_'}
class Lines(object):
"""An iterable set of n... | marrow/dsl | marrow/dsl/core/lines.py | Python | mit | 4,465 | 0.051064 |
import sys
sys.path.insert(1, "../../../")
import h2o
import pandas as pd
import statsmodels.api as sm
def prostate(ip,port):
# Log.info("Importing prostate.csv data...\n")
h2o_data = h2o.upload_file(path=h2o.locate("smalldata/logreg/prostate.csv"))
#prostate.summary()
sm_data = pd.read_csv(h2o.locate... | PawarPawan/h2o-v3 | h2o-py/tests/testdir_algos/glm/pyunit_NOFEATURE_prostateGLM.py | Python | apache-2.0 | 956 | 0.032427 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/global_/dynamic_neighbor_prefixes/__init__.py | Python | apache-2.0 | 15,976 | 0.001064 |
"""Docstring violation definition."""
from collections import namedtuple
from functools import partial
from itertools import dropwhile
from typing import Any, Callable, Iterable, List, Optional
from .parser import Definition
from .utils import is_blank
__all__ = ('Error', 'ErrorRegistry', 'conventions')
ErrorParam... | GreenSteam/pep257 | src/pydocstyle/violations.py | Python | mit | 12,345 | 0.000081 |
"""
Django settings for tutorial project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | NewEvolution/django-rest | tutorial/settings.py | Python | mit | 3,277 | 0.001221 |
class Solution(object):
def multiply(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
return str(int(num1) * int(num2))
| SF-Zhou/LeetCode.Solutions | solutions/multiply_strings.py | Python | mit | 194 | 0 |
import sys, socket, select, time
from optparse import OptionParser
XBOX_PORT = 5050
XBOX_PING = "dd00000a000000000000000400000002"
XBOX_POWER = "dd02001300000010"
help_text = "xbox-remote-power.py -a <ip address> -i <live id>"
py3 = sys.version_info[0] > 2
def main():
parser = OptionParser()
parser.add_opti... | JDQuackers/xbox-remote-power | xbox-remote-power.py | Python | mit | 2,719 | 0.00331 |
import unittest
import mock
import blivet
from pykickstart.constants import CLEARPART_TYPE_ALL, CLEARPART_TYPE_LINUX, CLEARPART_TYPE_NONE
from parted import PARTITION_NORMAL
from blivet.flags import flags
DEVICE_CLASSES = [
blivet.devices.DiskDevice,
blivet.devices.PartitionDevice
]
@unittest.skipUnless(not... | atodorov/blivet | tests/clearpart_test.py | Python | gpl-2.0 | 9,228 | 0.000759 |
# Copyright 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 requ... | HybridF5/tempest_debug | tempest/lib/services/compute/limits_client.py | Python | apache-2.0 | 1,138 | 0 |
# -*- test-case-name: twisted.test.test_persisted -*-
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Different styles of persisted objects.
"""
# System Imports
import types
import copy_reg
import copy
try:
import cStringIO as StringIO
except ImportError:
import Strin... | UstadMobile/exelearning-ustadmobile-work | twisted/persisted/styles.py | Python | gpl-2.0 | 27,358 | 0.007932 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_commoner_old_human_male_02.iff"
result.attribute_templ... | obi-two/Rebelion | data/scripts/templates/object/mobile/shared_dressed_commoner_old_human_male_02.py | Python | mit | 459 | 0.04793 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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 rights
# to use, copy, modify, merge, publ... | sidzan/netforce | netforce_stock/netforce_stock/models/barcode_issue_line.py | Python | mit | 2,232 | 0.003584 |
# Generated by Django 3.2 on 2021-08-25 20:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Ville',
fields=[
('id', models.IntegerField(d... | fab13n/caracole | villes/migrations/0001_initial.py | Python | mit | 5,318 | 0.005641 |
# /usr/bin/env python
import pygal
import requests
import json
#Use a view in CouchDB to get the data
#use the first key for attribute type
#order descending so when limit the results will get the latest at the top
r = requests.get('http://127.0.0.1:5984/mvp_sensor_data/_design/doc/_view/attribute_value?startkey=["te... | webbhm/OpenAg_MVP_UI | MVP_UI/python/temp_chart.py | Python | mit | 966 | 0.012422 |
import datetime
import json
from brake.decorators import ratelimit
from django.utils.decorators import method_decorator
from django.utils.translation import get_language
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponseRedirect, HttpResponse
from dj... | ministryofjustice/manchester_traffic_offences_pleas | apps/plea/views.py | Python | mit | 8,700 | 0.002069 |
#!/usr/bin/env python
# Copyright 2013-2015 Julian Metzler
"""
This program 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, either version 3 of the License, or
(at your option) any later version.
This pro... | Mezgrman/TweetPony | setup.py | Python | agpl-3.0 | 1,186 | 0.029511 |
# 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-monitor/azure/mgmt/monitor/models/activity_log_alert_resource.py | Python | mit | 3,303 | 0.000606 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import factory
from udata.factories import ModelFactory
from .models import Dataset, Resource, Checksum, CommunityResource, License
from udata.core.organization.factories import OrganizationFactory
from udata.core.spatial.factories import SpatialCovera... | davidbgk/udata | udata/core/dataset/factories.py | Python | agpl-3.0 | 1,823 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.