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 -*-
"""
Settings of ``critica.apps.notes`` application.
"""
from critica.apps.notes import choices
# Excluded categories
# ------------------------------------------------------------------------------
EXCLUDED_CATEGORIES = [
'epicurien',
'voyages',
'regions',
'coup-de-gueule',
]
... | brunobord/critica | apps/notes/settings.py | Python | gpl-3.0 | 652 | 0.001534 |
#! /usr/bin/env python3
# This was forked from https://github.com/rustyrussell/lightning-payencode/tree/acc16ec13a3fa1dc16c07af6ec67c261bd8aff23
import re
import time
from hashlib import sha256
from binascii import hexlify
from decimal import Decimal
from typing import Optional, TYPE_CHECKING, Type
import random
impo... | wakiyamap/electrum-mona | electrum_mona/lnaddr.py | Python | mit | 18,219 | 0.002744 |
# -*- coding: utf8 -*-
from injector import singleton, inject
try:
import configparser
except ImportError:
import configparser as configparser
from sht1x.Sht1x import Sht1x as SHT1x
@singleton
class Sensor:
name = "SHT1x"
@inject
def __init__(self, config_parser: configparser.ConfigParser):
... | wuan/klimalogger | klimalogger/sensor/sht1x_sensor.py | Python | apache-2.0 | 1,458 | 0.00206 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/compute_management_client.py | Python | mit | 7,735 | 0.002069 |
###################################################################
# Numexpr - Fast numerical array expression evaluator for NumPy.
#
# License: MIT
# Author: See AUTHORS.txt
#
# See LICENSE.txt and LICENSES/*.txt for details about copyright and
# rights to use.
##########################################... | Alwnikrotikz/numexpr | bench/vml_timing.py | Python | mit | 5,758 | 0.002431 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013,2014 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/django-perf | foo/tuna/management/commands/tuna_delete_direct.py | Python | gpl-3.0 | 1,873 | 0.000534 |
# -*- 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... | Lilykos/invenio | invenio/modules/jsonalchemy/jsonext/engines/cache.py | Python | gpl-2.0 | 4,277 | 0.00187 |
from django.db import models
import warnings
from django.utils import timezone
import requests
from image_cropping import ImageRatioField
class CompMember(models.Model):
"""A member of compsoc"""
class Meta:
verbose_name = 'CompSoc Member'
verbose_name_plural = 'CompSoc Members'
index = ... | compsoc-ssc/compsocssc | general/models.py | Python | mit | 2,517 | 0.005165 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2018
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | Eldinnie/python-telegram-bot | tests/test_video.py | Python | gpl-3.0 | 7,707 | 0.000389 |
from gurtel.util import Url
class TestUrl(object):
def equal(self, one, two):
"""
For this test, want to ensure that compare-equal implies hash-equal.
"""
return (one == two) and (hash(one) == hash(two))
def test_no_qs(self):
assert self.equal(
Url("http:/... | oddbird/gurtel | tests/test_util.py | Python | bsd-3-clause | 1,076 | 0 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import decimal
import pytest
from django.conf import settings
from shuup.core.models import Shipm... | hrayr-artunyan/shuup | shuup_tests/core/test_shipments.py | Python | agpl-3.0 | 6,394 | 0.001251 |
from copy import deepcopy
from .base import Strategy
class InsertionSort(Strategy):
def sort_by(self, field):
return self._sort(lambda x, y: x.grades[field] < y.grades[field])
def sort(self):
return self._sort(lambda x, y: x < y)
def _sort(self, compare):
for first_item in self.items:
items... | vtemian/university_projects | practic_stage/hmw4/strategies/insertion.py | Python | apache-2.0 | 524 | 0.013359 |
# coding=utf-8
""" NodeChains are sequential orders of :mod:`~pySPACE.missions.nodes`
.. image:: ../../graphics/node_chain.png
:width: 500
There are two main use cases:
* the application for :mod:`~pySPACE.run.launch_live` and the
:mod:`~pySPACE.environments.live` using the default
:class:`Nod... | Crespo911/pyspace | pySPACE/environments/chains/node_chain.py | Python | gpl-3.0 | 60,058 | 0.003014 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | google/uncertainty-baselines | uncertainty_baselines/datasets/imagenet_test.py | Python | apache-2.0 | 1,536 | 0.002604 |
class Node(object):
"""Find if two nodes in a directed graph are connected.
Based on http://www.codewars.com/kata/53897d3187c26d42ac00040d
For example:
a -+-> b -> c -> e
|
+-> d
a.connected_to(a) == true
a.connected_to(b) == true
a.connected_to(c) == true
b.connected_to(d... | intenthq/code-challenges | python/connected_graph/connected_graph.py | Python | mit | 637 | 0.00314 |
# Copyright 2015 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/framework/subscribe_test.py | Python | apache-2.0 | 13,361 | 0.005838 |
#### 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 = Static()
result.template = "object/static/particle/shared_particle_geyser_center.iff"
result.attribute_template_i... | anhstudios/swganh | data/scripts/templates/object/static/particle/shared_particle_geyser_center.py | Python | mit | 451 | 0.046563 |
#!/usr/bin/env python
# encoding: utf-8
from flask import Blueprint, redirect, session, url_for, flash
from flask_babel import _
from flask_babel import refresh
from flask_login import current_user
from app import db, constants
from app.views import redirect_back
blueprint = Blueprint('lang', __name__, url_prefix='/... | viaict/viaduct | app/views/lang.py | Python | mit | 1,481 | 0 |
'''
YARN Cluster Metrics
--------------------
yarn.metrics.appsSubmitted The number of submitted apps
yarn.metrics.appsCompleted The number of completed apps
yarn.metrics.appsPending The number of pending apps
yarn.metrics.appsRunning The number of running apps
yarn.metrics.apps... | StackVista/sts-agent-integrations-core | yarn/check.py | Python | bsd-3-clause | 20,533 | 0.00375 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-10-28 15:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dcim', '0019_new_iface_form_factors'),
]
operations = [
migrations.AddField(
model_name='rack',
... | lampwins/netbox | netbox/dcim/migrations/0020_rack_desc_units.py | Python | apache-2.0 | 493 | 0.002028 |
#!/usr/bin/env python
import numpy as np
from kmodes.kmodes import KModes
# reproduce results on small soybean data set
x = np.genfromtxt('soybean.csv', dtype=int, delimiter=',')[:, :-1]
y = np.genfromtxt('soybean.csv', dtype=str, delimiter=',', usecols=(35, ))
kmodes_huang = KModes(n_clusters=4, init='Huang', verbo... | nicodv/kmodes | examples/soybean.py | Python | mit | 1,461 | 0.000684 |
#-*- coding: utf-8 -*-
import phonenumbers
from django.conf import settings
from django.core import validators
from django.utils.six import string_types
from phonenumbers.phonenumberutil import NumberParseException
class PhoneNumber(phonenumbers.phonenumber.PhoneNumber):
"""
A extended version of phonenumbers... | CloudNcodeInc/django-phonenumber-field | phonenumber_field/phonenumber.py | Python | mit | 3,532 | 0.001982 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2020 Gabriel Ferreira
# Copyright (C) 2020 Laurent Monin
#
# 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 Founda... | musicbrainz/picard | picard/util/progresscheckpoints.py | Python | gpl-2.0 | 1,663 | 0.001203 |
"""
RESTx: Sane, simple and effective data publishing and integration.
Copyright (C) 2010 MuleSoft Inc. http://www.mulesoft.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version... | yyamano/RESTx | src/python/starter.py | Python | gpl-3.0 | 2,796 | 0.011803 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-30 12:33
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('todo', '0006_auto_20160530_1210'),
]
operations = [... | Azarn/mytodo | todo/migrations/0007_auto_20160530_1233.py | Python | apache-2.0 | 593 | 0.001686 |
# Copyright 2020-2021 The Kubeflow 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 ... | kubeflow/pipelines | manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/sync.py | Python | apache-2.0 | 16,824 | 0.00107 |
from sympy.utilities.source import get_mod_func, get_class
def test_get_mod_func():
assert get_mod_func('sympy.core.basic.Basic') == ('sympy.core.basic', 'Basic')
def test_get_class():
_basic = get_class('sympy.core.basic.Basic')
assert _basic.__name__ == 'Basic'
| devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/sympy/utilities/tests/test_source.py | Python | agpl-3.0 | 278 | 0.010791 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
try:
_STRING_TYPE = basestring
except NameError: # pragma: no cover
_STRING_TYPE = str
from recipe_engine.config import config_item_context, ConfigGrou... | CoherentLabs/depot_tools | recipes/recipe_modules/gclient/config.py | Python | bsd-3-clause | 18,342 | 0.019082 |
"""Retrieve temporary access token by using refresh/offline token.
Copyright (c) 2019 Red Hat Inc.
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... | tisnik/fabric8-analytics-common | a2t/src/auth.py | Python | apache-2.0 | 3,986 | 0.001254 |
# -*- coding: utf-8 -*-
import bottle
import sys
import unittest
import wsgiref
import wsgiref.util
import wsgiref.validate
import mimetypes
import uuid
from bottle import tob, tonat, BytesIO, py3k, unicode
def warn(msg):
sys.stderr.write('WARNING: %s\n' % msg.strip())
def tobs(data):
''' Transforms bytes o... | Eddy0402/Environment | vim/ycmd/third_party/bottle/test/tools.py | Python | gpl-3.0 | 5,129 | 0.005069 |
def agts(queue):
iron = queue.add('iron.py', ncpus=8, walltime=8 * 60)
queue.add('iron.agts.py', deps=[iron],
creates=['Fe_conv_k.png', 'Fe_conv_h.png'])
if __name__ == '__main__':
import numpy as np
import pylab as plt
from ase.utils.eos import EquationOfState
from ase.io import ... | qsnake/gpaw | doc/tutorials/lattice_constants/iron.agts.py | Python | gpl-3.0 | 1,569 | 0.003187 |
#
# Copyright (c) 2015 Open-RnD Sp. z o.o.
#
# 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... | open-rnd/ros3d-www | ros3dui/system/__init__.py | Python | mit | 1,104 | 0 |
# Copyright 2013 Allen Institute
# This file is part of dipde
# dipde 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.
#
# dipde is dis... | AllenInstitute/dipde | dipde/examples/singlepop_exponential_distribution.py | Python | gpl-3.0 | 2,322 | 0.009044 |
# -*- coding: utf-8 -*-
# Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
# For example, this binary tree is symmetric:
# 1
# / \
# 2 2
# / \ / \
# 3 4 4 3
# But the following is not:
# 1
# / \
# 2 2
# \ \
# 3 3
# Definition for a ... | ammzen/SolveLeetCode | 101SymmetricTree.py | Python | mit | 1,224 | 0.00817 |
import yaml
# We try to dump using the CSafeDumper for speed improvements.
try:
from yaml import CSafeDumper as Dumper
except ImportError: #pragma: no cover
from yaml import SafeDumper as Dumper #pragma: no cover
from hepdata_converter.common import Option, OptionInitMixin
from hepdata_converter.writers import ... | HEPData/hepdata-converter | hepdata_converter/writers/yaml_writer.py | Python | gpl-2.0 | 3,048 | 0.00689 |
import logging
from utils import common
from utils.lyric_base import LyricBase
site_class = 'UtaNet'
site_index = 'uta_net'
site_keyword = 'uta-net'
site_url = 'http://www.uta-net.com/'
test_url = 'http://www.uta-net.com/song/138139/'
test_expect_length = 1089
# current url format
# 'http://www.uta-net.com/song/13813... | franklai/lyric-get | lyric_engine/modules/uta_net.py | Python | mit | 3,585 | 0.000561 |
# 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
# distributed under the Li... | pypa/warehouse | warehouse/admin/__init__.py | Python | apache-2.0 | 2,024 | 0.000988 |
"""SymPy is a Python library for symbolic mathematics. It aims to become a
full-featured computer algebra system (CAS) while keeping the code as
simple as possible in order to be comprehensible and easily extensible.
SymPy is written entirely in Python and does not require any external
libraries, except optionally for ... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/__init__.py | Python | mit | 2,176 | 0.011949 |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2017-present MagicStack Inc. and the EdgeDB 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... | edgedb/edgedb | tests/test_edgeql_expr_aliases.py | Python | apache-2.0 | 32,398 | 0 |
import sys
sentid_prev = 0
first_line = True
first_word = True
for line in sys.stdin:
row = line.strip().split()
if first_line:
word_ix = row.index('word')
sentid_ix = row.index('sentid')
first_line = False
else:
word = row[word_ix]
sentid = row[sentid_ix]
i... | modelblocks/modelblocks-release | resource-general/scripts/itemmeasures2lineitems.py | Python | gpl-3.0 | 588 | 0.001701 |
import os
import platform
from setuptools import setup, Extension
from distutils.util import convert_path
from Cython.Build import cythonize
system = platform.system()
## paths settings
# Linux
if 'Linux' in system:
CLFFT_DIR = r'/home/gregor/devel/clFFT'
CLFFT_LIB_DIRS = [r'/usr/local/lib64']
CLFFT_INCL_... | geggo/gpyfft | setup.py | Python | lgpl-3.0 | 3,106 | 0.00322 |
import sys
import time
import commands
import userinterface.Client as Client
from taskbuffer.JobSpec import JobSpec
from taskbuffer.FileSpec import FileSpec
if len(sys.argv)>1:
site = sys.argv[1]
else:
site = None
datasetName = 'panda.destDB.%s' % commands.getoutput('uuidgen')
destName = 'BNL_ATLAS_2'
job... | RRCKI/panda-server | pandaserver/test/execute.py | Python | apache-2.0 | 2,194 | 0.014585 |
# Copyright (c) 2016,2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
===========================
Upper Air Sounding Tutorial
===========================
Upper air analysis is a staple of many synoptic and mesoscale analysis
problems. In this... | metpy/MetPy | v0.8/_downloads/upperair_soundings.py | Python | bsd-3-clause | 7,536 | 0.001725 |
import numpy
from samuroi.gui.samuroiwindow import SamuROIWindow
from samuroi.plugins.tif import load_tif
from samuroi.plugins.swc import load_swc
from samuroi.masks.segmentation import Segmentation as SegmentationMask
# requirements for template matching and post processing
from samuroi.event.biexponential import Bi... | aolsux/SamuROI | doc/examples/script.py | Python | mit | 4,482 | 0.004685 |
import urllib.request
import time
def pega_preço():
pagina = urllib.request.urlopen('http://beans.itcarlow.ie/prices-loyalty.html')
texto = pagina.read().decode('utf8')
onde = texto.find('>$')
inicio= onde + 2
fim = inicio + 4
return float(texto[inicio:fim])
opção = input("deseja comprar já? (S/... | andersonsilvade/python_C | Python32/aulas/hakeandositeprecodescontowhiletemposimounao.py | Python | mit | 607 | 0.013559 |
# This file is part of the Perspectives Notary Server
#
# Copyright (C) 2011 Dan Wendlandt
#
# 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, version 3 of the License.
#
# This progra... | hiviah/perspectives-observatory | utilities/svg_client.py | Python | gpl-3.0 | 1,448 | 0.015884 |
import os.path
from os.path import abspath
import re
import sys
import types
import pickle
from test import support
from test.support import import_helper
import test.test_importlib.util
import unittest
import unittest.mock
import unittest.test
class TestableTestProgram(unittest.TestProgram):
module = None
e... | brython-dev/brython | www/src/Lib/unittest/test/test_discovery.py | Python | bsd-3-clause | 34,059 | 0.001556 |
"""This module can be used for finding similar code"""
import re
import rope.refactor.wildcards
from rope.base import libutils
from rope.base import codeanalyze, exceptions, ast, builtins
from rope.refactor import (patchedast, wildcards)
from rope.refactor.patchedast import MismatchedTokenError
class BadNameInCheck... | mcepl/rope | rope/refactor/similarfinder.py | Python | lgpl-3.0 | 12,522 | 0.00008 |
# 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-web/azure/mgmt/web/models/dimension.py | Python | mit | 1,562 | 0.00128 |
# coding: utf8
# retest.py
# 12/16/2012 jichi
__all__ = 'RegExpTester',
if __name__ == '__main__':
import sys
sys.path.append('..')
import debug
debug.initenv()
import re
from PySide.QtCore import Qt
from Qt5 import QtWidgets
from sakurakit import skqss
from sakurakit.skclass import memoizedproperty
from sak... | Dangetsu/vnr | Frameworks/Sakura/py/apps/reader/dialogs/retest.py | Python | gpl-3.0 | 5,176 | 0.010626 |
import json
import os
import math
import pytest
def calculate_max_velocity(**kwargs):
"""
Calculate the maximum velocity the ADCP can measure including the boat speed in m/s. This speed is the
speed the ADCP is capable of measuring, if the speed exceeds this value, then the data will be incorrect
due... | ricorx7/rti_python | ADCP/Predictor/MaxVelocity.py | Python | bsd-3-clause | 6,635 | 0.004823 |
# encoding: UTF-8
__author__ = 'CHENXY'
from string import join
from sgit_struct import structDict
def processCallBack(line):
orignalLine = line
line = line.replace(' virtual void ', '') # 删除行首的无效内容
line = line.replace('{};\n', '') # 删除行尾的无效内容
content = line.split('(')
cbNa... | lukesummer/vnpy | vn.sgit/pyscript/generate_md_functions.py | Python | mit | 11,152 | 0.003639 |
"""Provide neighbour searches using OpenCl GPU-code."""
from pkg_resources import resource_filename
import numpy as np
from . import idtxl_exceptions as ex
try:
import pyopencl as cl
except ImportError as err:
ex.package_missing(err, 'PyOpenCl is not available on this system. Install'
... | pwollstadt/IDTxl | dev/search_GPU/neighbour_search_opencl_old.py | Python | gpl-3.0 | 12,468 | 0.000962 |
def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface OptionalConstraints1 {
undefined foo(optional byte arg1, byte arg2);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(not threw,
... | CYBAI/servo | components/script/dom/bindings/codegen/parser/tests/test_optional_constraints.py | Python | mpl-2.0 | 981 | 0.001019 |
import numpy as np
import time
import math
import cv2
from pylab import array, arange, uint8
from PIL import Image
import eventlet
from eventlet import Timeout
import multiprocessing as mp
# Change the path below to point to the directoy where you installed the AirSim PythonClient
#sys.path.append('C:/Users/Kjell/Goog... | Kjell-K/AirGym | gym_airsim/envs/myAirSimClient.py | Python | mit | 6,563 | 0.017218 |
# -*- coding: utf-8 -*-
"""Automatic reverse engineering of firmware files for embedded devices."""
from resyst import metadata
__version__ = metadata.version
__author__ = metadata.authors[0]
__license__ = metadata.license
__copyright__ = metadata.copyright
| InfectedPacket/resyst | resyst/__init__.py | Python | gpl-2.0 | 262 | 0.003817 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
check same interface phos_binding patterns
"""
import os
import sys
import urllib
import urllib2
import cPickle as pickle
from multiprocessing import Pool
def get_entityid(p):
pdbid,interface_id,chain1,chain2 = p
url = 'http://www.rcsb.org/pdb/rest/customRepo... | lituan/tools | pisa/pisa_same_entity.py | Python | cc0-1.0 | 5,849 | 0.014361 |
from unittest import TestCase
from webtest import TestApp
from nose.tools import * # noqa
from ..main import app
class TestAUser(TestCase):
def setUp(self):
self.app = TestApp(app)
def tearDown(self):
pass
def test_can_see_homepage(self):
# Goes to homepage
res = self.ap... | killtheyak/killtheyak.github.io | killtheyak/test/webtest_tests.py | Python | mit | 1,412 | 0.000708 |
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Products - Send to Scales',
'summary': 'Synchronize Odoo database with Scales',
'versio... | houssine78/addons | product_to_scale_bizerba/__openerp__.py | Python | agpl-3.0 | 1,686 | 0 |
#!/usr/bin/python
import sys
service_name = "cherrypy-dns"
pidfile_path = "/var/run/" + service_name + ".pid"
port = 8001
if len(sys.argv) > 1 and sys.argv[1] == "service_name": print service_name; sys.exit(0)
if len(sys.argv) > 1 and sys.argv[1] == "pidfile_path": print pidfile_path; sys.exit(0)
if len(sys.argv) > ... | sukharevd/hadoop-install | bin/cherrypy-dns.py | Python | apache-2.0 | 1,744 | 0.012615 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | grap/OCB | addons/purchase/purchase.py | Python | agpl-3.0 | 71,343 | 0.007639 |
import os
from jedi._compatibility import FileNotFoundError, force_unicode, scandir
from jedi.api import classes
from jedi.api.strings import StringName, get_quote_ending
from jedi.api.helpers import match
from jedi.inference.helpers import get_str_or_none
class PathName(StringName):
api_type = u'path'
def com... | sserrot/champion_relationships | venv/Lib/site-packages/jedi/api/file_name.py | Python | mit | 5,707 | 0.001752 |
import re
from unicodedata import normalize
from datetime import datetime
from django.shortcuts import render
from django.http import HttpResponse as response
from django.http import HttpResponseRedirect as redirect
from django.conf import settings
from models import Spreadable,Image,Playable,Spreaded,Product
from soc... | efforia/eos-dashboard | pandora-hub/app.py | Python | lgpl-3.0 | 5,312 | 0.022779 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
if os.environ.get('DJANGO_SETTINGS_MODULE') is None:
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.base'
# When using an on-disk database for the test suite,
# Django asks us if we want to delete the database.
# We do.... | edx/edx-ora2 | manage.py | Python | agpl-3.0 | 762 | 0.001312 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("migrations", "0002_second")]
operations = [
migrations.CreateModel(
"OtherAuthor",
[
("id", models.AutoField(primary_key=True)),
("name", models.... | edmorley/django | tests/migrations2/test_migrations_2/0001_initial.py | Python | bsd-3-clause | 562 | 0 |
from requests.auth import HTTPBasicAuth
def apply_updates(doc, update_dict):
# updates the doc with items from the dict
# returns whether or not any updates were made
should_save = False
for key, value in update_dict.items():
if getattr(doc, key, None) != value:
setattr(doc, key, v... | puttarajubr/commcare-hq | custom/api/utils.py | Python | bsd-3-clause | 714 | 0.001401 |
# encoding: utf-8
import csv
from urllib2 import HTTPError
import django
from django.db import transaction
import urllib2
from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
from openfonacide.matcher import Matcher
from openfonacide.mo... | nemesiscodex/openfonacide | openfonacide/management/commands/actualizar_datasets.py | Python | lgpl-3.0 | 3,284 | 0.002134 |
from django.http import HttpResponse
import pymongo
import MySQLdb
from course_dashboard_api.v2.dbv import *
sql_user = MYSQL_USER
sql_pswd = MYSQL_PSWD
mysql_db = MYSQL_DB
mongo_db = MONGO_DB
""" Description: Function to get quiz level grades of all students in a particular course.
Input Parameters:
... | jaygoswami2303/course_dashboard_api | v2/GradeAPI/api.py | Python | mit | 27,402 | 0.006861 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | iceman1989/Check_mk | web/plugins/userdb/ldap.py | Python | gpl-2.0 | 48,692 | 0.010065 |
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
try:
import botocore.waiter as core_waiter
except ImportError:
pass # caught by HAS_BOTO3
ec2_data = {
"version": 2,
"waiters": {
"RouteTableExists": {
... | tareqalayan/ansible | lib/ansible/module_utils/aws/waiters.py | Python | gpl-3.0 | 9,345 | 0.000428 |
""" NormalizeTuples removes implicit variable -> tuple conversion. """
from pythran.analyses import Identifiers
from pythran.passmanager import Transformation
import ast
class _ConvertToTuple(ast.NodeTransformer):
def __init__(self, tuple_id, renamings):
self.tuple_id = tuple_id
self.renamings =... | pbrunet/pythran | pythran/transformations/normalize_tuples.py | Python | bsd-3-clause | 6,743 | 0 |
from .responses import SecretsManagerResponse
url_bases = [r"https?://secretsmanager\.(.+)\.amazonaws\.com"]
url_paths = {"{0}/$": SecretsManagerResponse.dispatch}
| spulec/moto | moto/secretsmanager/urls.py | Python | apache-2.0 | 166 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-08-02 20:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mindynode_nltk', '0009_auto_20170802_2046'),
]
operations = [
migrations.AddFi... | josherich/mindynode-parsers | mindynode_nltk/migrations/0010_keywordsum_keyword_category.py | Python | mit | 519 | 0.001942 |
# -*- coding: utf-8 -*-
from django import forms
from django.apps import apps
from django.contrib.auth import get_user_model, get_permission_codename
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.core... | czpython/django-cms | cms/admin/forms.py | Python | bsd-3-clause | 48,437 | 0.001755 |
tests=[
("python","UnitTestBuildComposite.py",{}),
("python","UnitTestScreenComposite.py",{}),
("python","UnitTestAnalyzeComposite.py",{}),
]
for dir in ['Cluster','Composite','Data','DecTree','Descriptors','FeatureSelect','InfoTheory','KNN','ModelPackage','NaiveBayes','Neural','SLT']:
tests.append(('pyth... | rdkit/rdkit-orig | rdkit/ML/test_list.py | Python | bsd-3-clause | 523 | 0.059273 |
def passive(cls):
passive_note = '''
.. note:: This object is a "passive" object. Any changes you make to it will not be reflected in the core and vice-versa. If you wish to update a core version of this object you should use the appropriate API.
'''
if hasattr(cls, "__doc__") and cls.__doc__:
cls.__doc__ += pa... | Vector35/binaryninja-api | python/decorators.py | Python | mit | 380 | 0.026316 |
import sublime, sublime_plugin
import functools
import os
import shutil
class IntellijCopyCommand(sublime_plugin.TextCommand):
def run(self, edit):
v = self.view
selection = v.sel();
if len(selection) == 0:
v.run_command('expand_selection', { "to": "line" })
v.run_comman... | uboness/sublime-plugins | Intellij/Intellij.py | Python | apache-2.0 | 2,360 | 0.007627 |
class Solution:
def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
red, white, blue = 0, 0, len(nums) - 1
while white <= blue:
if nums[white] == 0: # red
nums[red], nums[white] = nu... | tanchao/algo | leetcode/py/75_sort_colors.py | Python | mit | 579 | 0.008636 |
import numpy as np;
np.set_printoptions(linewidth=40, precision=5, suppress=True)
import pandas as pd; pd.options.display.max_rows=80;pd.options.display.expand_frame_repr=False;pd.options.display.max_columns=20
import pylab as plt;
import os; home=os.path.expanduser('~') +'/'
import sys;sys.path.insert(1,... | airanmehr/bio | Scripts/TimeSeriesPaper/Plot/Markov.py | Python | mit | 8,854 | 0.038288 |
"""
KINCluster is clustering like KIN.
release note:
- version 0.1.6
fix settings
update pipeline
delete unused arguments
fix convention by pylint
now logging
- version 0.1.5.5
fix using custom settings
support both moudle and dict
- version 0.1.5.4
Update tokenizer, remove stopwords ... | memento7/KINCluster | KINCluster/__init__.py | Python | mit | 1,038 | 0 |
import copy
import datetime
import logging
import math
import operator
import traceback
from collections import namedtuple
from typing import Any, Dict, Optional, Tuple
from pyparsing import (
CaselessKeyword,
Combine,
Forward,
Group,
Literal,
ParseException,
Regex,
Suppress,
Word,
... | great-expectations/great_expectations | great_expectations/core/evaluation_parameters.py | Python | apache-2.0 | 17,237 | 0.002843 |
from .app import Sofi
| tryexceptpass/sofi | sofi/app/__init__.py | Python | mit | 23 | 0 |
import io
import openpyxl
from django.test import (
Client, TestCase
)
from django.urls import reverse
from core.models import (
User, Batch, Section, Election, Candidate, CandidateParty,
CandidatePosition, Vote, VoterProfile, Setting, UserType
)
class ResultsExporter(TestCase):
"""
Tests the r... | seanballais/botos | tests/test_results_exporter_view.py | Python | gpl-3.0 | 18,942 | 0.00132 |
# Copyright (C) 2008 Dirk Vanden Boer <dirk.vdb@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later versi... | thegooglecodearchive/phonetooth | phonetooth/bluetoothdiscovery.py | Python | gpl-2.0 | 1,814 | 0.012679 |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
""" Tweet rirrakuma 4kuma submit.
"""
import tweepy
TWEET_CONTENT = (
"リラックマの4クマ漫画が更新されました!\n"
"http://www.shufu.co.jp/contents/4kuma/"
)
consumer_key = ""
consumer_secret = ""
access_key = ""
access_secret = ""
def main():
auth = tweepy.OAuthHandler(... | pyohei/rirakkuma-crawller | tweet.py | Python | mit | 565 | 0.001898 |
# -*- coding: utf-8 -*-
from openprocurement.auctions.core.utils import (
apply_patch,
context_unpack,
get_now,
json_view,
opresource,
save_auction,
)
from openprocurement.auctions.core.validation import (
validate_lot_data,
validate_patch_lot_data,
)
from openprocurement.auctions.core.v... | openprocurement/openprocurement.auctions.dgf | openprocurement/auctions/dgf/views/other/lot.py | Python | apache-2.0 | 3,339 | 0.004193 |
# 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 Licen... | AlexCatarino/Lean | Algorithm.Python/DelistingEventsAlgorithm.py | Python | apache-2.0 | 3,448 | 0.007251 |
__author__ = 'mark'
# StarinetPython3Logger a data logger for the Beaglebone Black.
# Copyright (C) 2015 Mark Horn
#
# This file is part of StarinetPython3Logger.
#
# StarinetPython3Logger is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the... | mhorn71/StarinetPythonLogger | utilities/staribuscrc.py | Python | gpl-2.0 | 2,214 | 0.004065 |
import FWCore.ParameterSet.Config as cms
process = cms.Process("Demo")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
process.source = cms.Source("PoolSource",
# replace 'myfile.root' with the source file you want to use
file... | jlrodrig/MyAnalysis | MiniAnalyzer/python/ConfFile_cfg.py | Python | gpl-3.0 | 471 | 0.019108 |
from openstates.utils import LXMLMixin
from billy.scrape.votes import VoteScraper, Vote
from billy.scrape.utils import convert_pdf
import datetime
import subprocess
import lxml
import os
import re
journals = "http://www.leg.state.co.us/CLICS/CLICS%s/csljournals.nsf/" \
"jouNav?Openform&%s"
date_re = re.compile(
... | cliftonmcintosh/openstates | openstates/co/votes.py | Python | gpl-3.0 | 12,425 | 0.002334 |
from importlib import import_module
import os
import sys
from django.apps import apps
from django.db.migrations.recorder import MigrationRecorder
from django.db.migrations.graph import MigrationGraph
from django.db.migrations.migration import Migration
from django.db.migrations.state import ModelState
from django.db.m... | TimBuckley/effective_django | django/db/migrations/loader.py | Python | bsd-3-clause | 11,967 | 0.001588 |
"""Most of these tests come from the examples in Bronstein's book."""
from sympy import (Poly, I, S, Function, log, symbols, exp, tan, sqrt,
Symbol, Lambda, sin, Eq, Ne, Piecewise, factor, expand_log, cancel,
expand, diff, pi, atan)
from sympy.integrals.risch import (gcdex_diophantine, frac_in, as_poly_1t,
... | wxgeo/geophar | wxgeometrie/sympy/integrals/tests/test_risch.py | Python | gpl-2.0 | 35,961 | 0.006173 |
"""
This module contains fabriccolor's `main` method plus related subroutines.
"""
import fnmatch
import os
import sys
def find_fabsettings():
"""
Look for fabsettings.py, which will contain all information about
target servers and distros on each server. i
"""
matches = []
for root, dirna... | calvinchengx/fabriccolors | fabriccolors/main.py | Python | bsd-2-clause | 1,828 | 0.001094 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
# This module is NOT auto-generated
# Inspired by decompiled Java classes from vCenter's internalvim25stubs.jar
# Unless states otherside, the methods and attributes were not used by esxcli,
# and thus not tested
log = logging.getLogger(__name__)
de... | xuru/pyvisdk | pyvisdk/do/vim_esx_cl_inetworkfirewallrulesetallowediplist_firewall_ruleset_allowedip.py | Python | mit | 1,110 | 0.008108 |
#!/usr/bin/env python
# This assumes an id on each field.
import logging
import hashlib
import random
log = logging.getLogger('anonymize')
common_hash_secret = "%016x" % (random.getrandbits(128))
def get_truncates(config):
database = config.get('database', {})
truncates = database.get('truncate', [])
sq... | davedash/mysql-anonymous | anonymize.py | Python | mit | 3,818 | 0.003405 |
import argparse
import shlex
parser = argparse.ArgumentParser(description='Short sample app',
fromfile_prefix_chars='@',
)
parser.add_argument('-a', action="store_true", default=False)
parser.add_argument('-b', action="store", dest="b")
parser.add_argu... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_application_building_blocks/argparse_fromfile_prefix_chars.py | Python | apache-2.0 | 435 | 0.002299 |
#!/usr/bin/env python
from __future__ import division, absolute_import, print_function
from future.builtins import super
from iris_sdk.models.account_users import AccountUsers
from iris_sdk.models.available_npa_nxx import AvailableNpaNxx
from iris_sdk.models.available_numbers import AvailableNumbers
from iris_sdk.mod... | bandwidthcom/python-bandwidth-iris | iris_sdk/models/account.py | Python | mit | 4,216 | 0.000474 |
"""Support for Hive light devices."""
from datetime import timedelta
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
LightEntity,
)
from homeassistant.helpers.entity import DeviceInfo
import... | jawilson/home-assistant | homeassistant/components/hive/light.py | Python | apache-2.0 | 5,000 | 0.0002 |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Timothy
#
# Created: 02/02/2015
# Copyright: (c) Timothy 2015
# Licence: <your licence>
#-------------------------------------------------------------------------------
import py... | Neomania/BeeSimulation | fonts.py | Python | mit | 808 | 0.012376 |
import shelve
"""
Currently unused. All mysql queries are now done via IomDataModels.
May be resurrected to help with shelve and pickles
"""
from USCProjectDAOs import IOMProjectDAO
class IOMService(IOMProjectDAO):
"""
This handles interactions with the IOM data database and storage files.
All user appl... | PainNarrativesLab/IOMNarratives | IOMDataService.py | Python | mit | 5,350 | 0.002991 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.