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 -*-
# Copyright 2014-2016 OpenMarket Ltd
#
# 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 applicab... | TribeMedia/synapse | synapse/server.py | Python | apache-2.0 | 11,005 | 0.000091 |
#############################################################################
# $HeadURL$
#############################################################################
""" ..mod: FTSRequest
=================
Helper class to perform FTS job submission and monitoring.
"""
# # imports
import sys
import re
import... | miloszz/DIRAC | DataManagementSystem/Client/FTSRequest.py | Python | gpl-3.0 | 37,261 | 0.02818 |
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | XiaosongWei/blink-crosswalk | Tools/Scripts/webkitpy/layout_tests/port/driver.py | Python | bsd-3-clause | 23,508 | 0.003148 |
#!/usr/bin/env python
# encoding: utf-8
'''
Created on September 24, 2019
@author: David Moss
'''
import time
# Time conversions to ms
ONE_SECOND_MS = 1000
ONE_MINUTE_MS = 60 * ONE_SECOND_MS
ONE_HOUR_MS = ONE_MINUTE_MS * 60
ONE_DAY_MS = ONE_HOUR_MS * 24
ONE_WEEK_MS = ONE_DAY_MS * 7
ONE_MONTH_MS = ONE_DAY_MS * 30
ONE... | peoplepower/botlab | com.ppc.Microservices/intelligence/dashboard/tools/set_status.py | Python | apache-2.0 | 7,607 | 0.00723 |
# Copyright (C) 2003 Python Software Foundation
import unittest
import shutil
import tempfile
import sys
import stat
import os
import os.path
from os.path import splitdrive
from distutils.spawn import find_executable, spawn
from shutil import (_make_tarball, _make_zipfile, make_archive,
... | ktan2020/legacy-automation | win/Lib/test/test_shutil.py | Python | mit | 30,473 | 0.001313 |
import unittest
import random, sys, time, re
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util, h2o_rf
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
# ... | vbelakov/h2o | py/testdir_single_jvm/test_parse_mnist_fvec.py | Python | apache-2.0 | 2,023 | 0.006426 |
shader_code = """
<script id="orbit_shader-vs" type="x-shader/x-vertex">
uniform vec3 focus;
uniform vec3 aef;
uniform vec3 omegaOmegainc;
attribute float lintwopi;
varying float lin;
uniform mat4 mvp;
const float M_PI = 3.14159265359;
void main() {
float a = aef.x;
float e... | dtamayo/rebound | rebound/widget.py | Python | gpl-3.0 | 25,951 | 0.006127 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import re
import os
import sys
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search(
... | fmartingr/iosfu | setup.py | Python | mit | 1,441 | 0 |
# Least common ancestor Problem
#http://www.ics.uci.edu/~eppstein/261/BenFar-LCA-00.pdf
# http://code.activestate.com/recipes/498243-finding-eulerian-path-in-undirected-graph/
# http://codereview.stackexchange.com/questions/104074/eulerian-tour-in-python
# Store Arrays: Parents: P[i] is the parent of i
# ... | tristan-hunt/UVaProblems | DataStructures/ac.py | Python | gpl-3.0 | 6,305 | 0.00571 |
# This should eventually land in telepathy-python, so has the same license:
# Copyright (C) 2007 Collabora Ltd. <http://www.collabora.co.uk/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Founda... | max-posedon/telepathy-python | examples/tubeconn.py | Python | lgpl-2.1 | 3,866 | 0.001035 |
"""
The :mod:`sklearn.model_selection._search` includes utilities to fine-tune the
parameters of an estimator.
"""
from __future__ import print_function
from __future__ import division
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas... | ClimbsRocks/scikit-learn | sklearn/model_selection/_search.py | Python | bsd-3-clause | 44,853 | 0.000067 |
from flask import current_app, Blueprint, render_template
import util
from database import db_uri
admin = Blueprint("admin", __name__, template_folder="templates")
@admin.route("/", methods=["GET"])
@util.login_required("operator")
def index():
"""
The index page for the admin interface, contains
a lis... | BenDoan/code_court | code_court/courthouse/views/admin/admin.py | Python | mit | 497 | 0 |
# encoding: UTF-8
'''
本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。
使用DR_setting.json来配置需要收集的合约,以及主力合约代码。
History
<id> <author> <description>
2017050300 hetajen Bat[Auto-CTP连接][Auto-Symbol订阅][Auto-DB写入][Auto-CTA加载]
2017050301 hetajen DB[CtaTemplate增加日线bar数据获取接口][Mongo不保存Tick数据][新... | hetajen/vnpy161 | vn.trader/dataRecorder/drEngine.py | Python | mit | 11,808 | 0.008268 |
from models import Likes
def filterKey(key):
return key.id()
def showCount(post_key):
like_obj = Likes.query(Likes.post == post_key).get()
if like_obj:
return like_obj.like_count
else:
return "0"
| ghoshabhi/Multi-User-Blog | utility/filters.py | Python | mit | 230 | 0.008696 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Spaghetti: Web Server Security Scanner
#
# @url: https://github.com/m4ll0k/Spaghetti
# @author: Momo Outaadi (M4ll0k)
# @license: See the file 'doc/LICENSE'
from lib.net import http
from lib.utils import printer
from lib.net import utils
class AdminInterfaces():
def... | Yukinoshita47/Yuki-Chan-The-Auto-Pentest | Module/Spaghetti/modules/discovery/AdminInterfaces.py | Python | mit | 1,102 | 0.040835 |
"""This example follows the simple text document Pipeline illustrated in the figures above.
"""
from pyspark.ml import Pipeline
from pyspark.ml.classification import LogisticRegression
from pyspark.ml.feature import HashingTF, Tokenizer
# Prepare training documents from a list of (id, text, label) tuples.
training = ... | xiligey/xiligey.github.io | code/2.py | Python | apache-2.0 | 1,442 | 0.00208 |
# Copyright (c) 2012 OpenStack Foundation
# Copyright (c) 2015 Rushil Chugh
# 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/l... | NetApp/manila | manila/share/utils.py | Python | apache-2.0 | 3,138 | 0 |
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import socket
import time
import traceback
import gc
from aqt.qt import *
import aqt
from anki import Collection
from anki.sync import Syncer, RemoteServer, FullSyncer, MediaSyncer, \
RemoteMe... | Stvad/anki | aqt/sync.py | Python | agpl-3.0 | 18,494 | 0.00173 |
from pathlib import Path
from django.test import SimpleTestCase
TEST_ROOT_DIR = Path(__file__).parent
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': (
str(TEST_ROOT_DIR / "templates"),
),
'OPTIONS': {
... | osantana/quickstartup | tests/base.py | Python | mit | 2,174 | 0 |
from __future__ import print_function
from pyspark.mllib.classification import LogisticRegressionWithLBFGS
from pyspark.mllib.regression import LabeledPoint
from pyspark.sql import SparkSession
from pyspark import SparkContext
import numpy as np
sc = SparkContext('local', 'logistic')
spark = SparkSession \
.builde... | GoogleCloudPlatform/training-data-analyst | quests/data-science-on-gcp-edition1_tf2/07_sparkml_and_bqml/experiment.py | Python | apache-2.0 | 5,377 | 0.015622 |
import asyncio
from unittest import mock
import pytest
from multidict import CIMultiDict
from aiohttp.signals import Signal
from aiohttp.test_utils import make_mocked_request
from aiohttp.web import Application, Response
@pytest.fixture
def app():
return Application()
@pytest.fixture
def debug_app():
retu... | playpauseandstop/aiohttp | tests/test_signals.py | Python | apache-2.0 | 3,612 | 0 |
#!/usr/bin/env python
'''
@author Luke C
@date Mon Mar 25 09:57:59 EDT 2013
@file ion/util/stored_values.py
'''
from pyon.core.exception import NotFound
import gevent
class StoredValueManager(object):
def __init__(self, container):
self.store = container.object_store
def stored_value_cas(self, doc_... | ooici/coi-services | ion/util/stored_values.py | Python | bsd-2-clause | 1,331 | 0.004508 |
import os
import subprocess
import logging
import re
from checks import utils
import sys
class RunSamtoolsCommands:
@classmethod
def _run_subprocess(cls, args_list):
proc = subprocess.run(args_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
utils.log_error(args_l... | wtsi-hgi/bam2cram-check | checks/stats_checks.py | Python | gpl-3.0 | 11,324 | 0.003621 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | datsfosure/ansible | lib/ansible/plugins/strategies/__init__.py | Python | gpl-3.0 | 19,457 | 0.003443 |
"""
Created on 2013-1-19
@author: Administrator
"""
import doctest
def average(values):
"""Computes the arithmetic mean of a list of numbers.
>>> print(average([20, 30, 70]))
40.0
"""
return sum(values) / len(values)
doctest.testmod() # automatically validate the embedded tests
| quchunguang/test | testpy3/testdoctest.py | Python | mit | 305 | 0.003279 |
import datetime
from mock import patch
from pretend import stub
from gurtel import session
def test_annotates_request():
"""Annotates request with ``session`` property."""
request = stub(
cookies={},
app=stub(secret_key='secret', is_ssl=True, config={}),
)
session.session_middle... | oddbird/gurtel | tests/test_session.py | Python | bsd-3-clause | 1,572 | 0 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use the AWS SDK for Python (Boto3) with the Amazon Transcribe API to
transcribe an audio file to a text file. Also shows how to define a custom vocabulary
to improve the accuracy of the ... | awsdocs/aws-doc-sdk-examples | python/example_code/transcribe/transcribe_basics.py | Python | apache-2.0 | 17,119 | 0.002045 |
import dryscrape
dryscrape.start_xvfb()
sess = dryscrape.Session(base_url = 'http://shop.mango.com')
sess.set_attribute('auto_load_images',False)
sess.visit('/ES/m/hombre/prendas/todas/?m=coleccion')
print sess.at_xpath("//*").children()
print "--------------------------"
print sess.at_xpath("//*[contains(@class,\"s... | carlosb1/examples-python | ideas/mango-example/mango.py | Python | gpl-2.0 | 444 | 0.009009 |
import os
import re
from amlib import conf, utils, log
'''
Functions for parsing AD automount maps into a common dict format.
Part of ampush. https://github.com/sfu-rcg/ampush
Copyright (C) 2016 Research Computing Group, Simon Fraser University.
'''
# ff = flat file automount map
def get_names():
'''
Return a li... | sfu-rcg/ampush | amlib/file_map.py | Python | mit | 6,519 | 0.00046 |
# Copyright (c) 2013 Jendrik Poloczek
# Copyright (c) 2013 Tao Sauvage
# Copyright (c) 2014 Aborilov Pavel
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014-2015 Tycho Andersen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "S... | kopchik/qtile | libqtile/widget/bitcoin_ticker.py | Python | mit | 2,607 | 0 |
# -*- coding: utf-8 -*-}
import logging
import os
import uuid
import requests
from flask import request, current_app, g
from flask_babel import gettext
from flask_restful import Resource
from sqlalchemy import or_
from sqlalchemy.orm import joinedload
from sqlalchemy.sql.elements import and_
from marshmallow.exceptio... | eubr-bigsea/tahiti | tahiti/workflow_permission_api.py | Python | apache-2.0 | 5,484 | 0 |
"""Support for monitoring emoncms feeds."""
from __future__ import annotations
from datetime import timedelta
from http import HTTPStatus
import logging
import requests
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
SensorState... | rohitranjan1991/home-assistant | homeassistant/components/emoncms/sensor.py | Python | mit | 8,487 | 0.000471 |
import eConsoleImpl
import eBaseImpl
import enigma
enigma.eTimer = eBaseImpl.eTimer
enigma.eSocketNotifier = eBaseImpl.eSocketNotifier
enigma.eConsoleAppContainer = eConsoleImpl.eConsoleAppContainer
from Tools.Profile import profile, profile_final
profile("PYTHON_START")
from enigma import runMainloop, eDVBDB, eTime... | kingvuplus/nn-gui | mytest.py | Python | gpl-2.0 | 17,117 | 0.026757 |
from django.core.management.base import NoArgsCommand
from django_mailer import models
from django_mailer.management.commands import create_handler
from optparse import make_option
import logging
class Command(NoArgsCommand):
help = 'Place deferred messages back in the queue.'
option_list = NoArgsCommand.opti... | GreenLightGo/django-mailer-2 | django_mailer/management/commands/retry_deferred.py | Python | mit | 1,161 | 0.001723 |
from __future__ import print_function, absolute_import
from .script_interface import ScriptInterfaceHelper, script_interface_register
@script_interface_register
class ComFixed(ScriptInterfaceHelper):
"""Fix the center of mass of specific types.
Subtracts mass-weighted fraction of the total
force action on... | KonradBreitsprecher/espresso | src/python/espressomd/comfixed.py | Python | gpl-3.0 | 699 | 0.001431 |
# Copyright 2019 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... | tensorflow/tensorflow | tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/multi_arguments_results_v1.py | Python | apache-2.0 | 3,570 | 0.005882 |
from django.contrib import admin
from newspaper.news.models import News, Event
class NewsAdmin(admin.ModelAdmin):
list_display = ('title', 'publish_date')
list_filter = ('publish_date',)
search_fields = ('title',)
class EventAdmin(admin.ModelAdmin):
pass
admin.site.register(News, NewsAdmin)
admin... | openwebinars-django/newspaper | newspaper/newspaper/news/admin.py | Python | apache-2.0 | 353 | 0.002833 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import collections
... | slyphon/pants | src/python/pants/engine/exp/graph.py | Python | apache-2.0 | 7,197 | 0.009032 |
__author__ = 'tbri'
from openerp import models, fields, api, _
class add_sponsorship_wizard(models.TransientModel):
_name = 'add_sponsorship_wizard'
def _get_all_children(self):
c = []
children = self.env['res.partner'].search([('sponsored_child', '=', 'True')])
for n in children:
... | bringsvor/sponsor | wizards/add_sponsorship.py | Python | agpl-3.0 | 1,922 | 0.011967 |
# -*- coding: utf-8 -*-
"""
analytics.models
Models for Demand and Supply data
:copyright: (c) 2013 by Openlabs Technologies & Consulting (P) Limited
:license: see LICENSE for more details.
"""
import operator
from django.db import models
import django.contrib.admin
from admin.models import Occupati... | arpitprogressive/arpittest | apps/analytics/models.py | Python | bsd-3-clause | 14,238 | 0.000702 |
#!/usr/bin/env python
import os, sys, webbrowser
try: from subprocess import getstatusoutput # Python3
except: from commands import getstatusoutput # Python2
def shell_command(command): # do the command and print the output
cmdResults = getstatusoutput(command)
if True: # not cmdResults[0]:
for... | cclauss/In-Harms-Way | server/run_django.py | Python | apache-2.0 | 727 | 0.016506 |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | yosukesuzuki/url-shortner | admin.py | Python | bsd-2-clause | 1,232 | 0 |
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import sys
from IPython.lib.kernel import connect_qtconsole
from IPython.kernel.zmq.kernelapp import IPKernelApp
#-----------------------------------... | pioneers/topgear | ipython-in-depth/examples/Embedding/internal_ipkernel.py | Python | apache-2.0 | 2,018 | 0.004955 |
"""Interactive (widget based) artists."""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, RadioButtons
from types import SimpleNamespace
from ._helpers import create_figure, plot_colorbar, add_sideplot
from ._base import _order_for_imshow
from ._color... | wright-group/WrightTools | WrightTools/artists/_interact.py | Python | mit | 20,114 | 0.00179 |
# -*- coding: utf-8 -*-
from core.test_utils.context_managers import SettingsOverride
from django import template
from django.test.testcases import TestCase
class PackaginatorTagsTests(TestCase):
def test_fixed_ga(self):
tpl = template.Template("""
{% load packaginator_tags %}
{% f... | pythonchelle/opencomparison | apps/core/tests/test_ga.py | Python | mit | 1,060 | 0.00566 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.defaults
from erpnext.controllers.selling_controller import SellingController
from erpnext.stock.doctype.batch.batch import... | libracore/erpnext | erpnext/stock/doctype/delivery_note/delivery_note.py | Python | gpl-3.0 | 23,654 | 0.003551 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class UtmCampaign(models.Model):
_inherit = 'utm.campaign'
ab_testing_winner_selection = fields.Selection(selection_add=[('crm_lead_count', 'Leads')])
| jeremiahyan/odoo | addons/mass_mailing_crm/models/utm.py | Python | gpl-3.0 | 294 | 0.003401 |
# -*- coding: utf-8 *-*
from collections import OrderedDict
from nicepy.utils import ljust_all, pretty_repr
def get_failed_msg(compare_method, values, expected_values, names=None, expected_names=None):
failed_list = []
names = names or map(str, range(len(values)))
expected_names = expected_names or [''] *... | katakumpo/nicepy | nicepy/assertions/helpers.py | Python | mit | 1,696 | 0.004717 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-12 23:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('twitter_feed', '0001_initial'),
]
operations = [
migrations.AddField(
... | isstiaung/Adimal | adimal/twitter_feed/migrations/0002_tweet_links.py | Python | mit | 490 | 0 |
# Copyright 2016 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... | chemelnucfin/tensorflow | tensorflow/python/keras/metrics_confusion_matrix_test.py | Python | apache-2.0 | 51,243 | 0.002381 |
import sys
from traceback import format_exception
import colorama
def color(color_, settings):
"""Utility for ability to disabling colored output."""
if settings.no_colors:
return ''
else:
return color_
def exception(title, exc_info, settings):
sys.stderr.write(
u'{warn}[WARN... | JianfengYao/thefuck | thefuck/logs.py | Python | mit | 1,661 | 0.000602 |
"""This module is responsible for storing files on disk.
The storage strategy is as follows:
- Files themselves are stored in a separate directory called 'blobs'.
- Stored files are named by their SHA256 hashes (in hex).
- Stored files are grouped into directories by their first byte (two hex
characters), referred t... | sio2project/filetracker | filetracker/servers/storage.py | Python | gpl-3.0 | 17,784 | 0.00045 |
import pytest
from indy import IndyError
from indy import did
from indy import wallet
from indy.error import ErrorCode
@pytest.mark.asyncio
@pytest.mark.parametrize("wallet_handle_cleanup", [False])
async def test_import_wallet_works(wallet_handle, wallet_config, credentials, export_config):
(_did, _verkey) = aw... | srottem/indy-sdk | wrappers/python/tests/wallet/test_import_wallet.py | Python | apache-2.0 | 1,307 | 0.00153 |
try:
import json as _json
except ImportError:
import sys
sys.path.append("simplejson-2.3.3")
import simplejson as _json
import requests as _requests
import urllib.parse as _urlparse
import random as _random
import base64 as _base64
from configparser import ConfigParser as _ConfigParser
import os as _o... | kbase/narrative | src/biokbase/service/Client.py | Python | mit | 7,649 | 0.000392 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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
# ... | vlegoff/tsunami | src/secondaires/navigation/commandes/matelot/__init__.py | Python | bsd-3-clause | 3,210 | 0.000312 |
from sympy.integrals.transforms import (mellin_transform,
inverse_mellin_transform, laplace_transform, inverse_laplace_transform,
fourier_transform, inverse_fourier_transform,
sine_transform, inverse_sine_transform,
cosine_transform, inverse_cosine_transform,
hankel_transform, inverse_hankel_transfo... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/integrals/tests/test_transforms.py | Python | mit | 31,213 | 0.002531 |
######################################################################
#
# Copyright (C) 2013
# Associated Universities, Inc. Washington DC, USA,
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Fo... | e-koch/VLA_Lband | 16B/pipeline4.7.1_custom/EVLA_pipe_fluxgains.py | Python | mit | 6,065 | 0.019621 |
"""empty message
Revision ID: 059e2a9bfb4c
Revises:
Create Date: 2017-07-10 21:50:44.380938
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '059e2a9bfb4c'
down_revision = None
branch_labels = None
depends_on = None
d... | hardworkingcoder/dw_experiments | migrations/versions/059e2a9bfb4c_.py | Python | mit | 1,851 | 0.010805 |
#!/usr/bin/python2.7
#
# setup_leveldb.py
#
# Compiles and install Minecraft Pocket Edtition binary support.
#
__author__ = "D.C.-G. 2017"
__version__ = "0.3.0"
import sys
import os
import platform
import fnmatch
if sys.platform != "linux2":
print "This script can't run on other platforms than Linux ones..."
... | fhfuih/MCEdit-Unified | pymclevel/setup_leveldb.py | Python | isc | 11,800 | 0.003136 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-grafeas | grafeas/grafeas_v1/services/grafeas/transports/__init__.py | Python | apache-2.0 | 1,131 | 0 |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.db.models import Q
# from djangobmf.permissions import ModulePermission
from djangobmf.utils import FilterQueryset
class GoalFilter(FilterQueryset):
def filter_queryset(self, qs, user):
if user.has_perm(... | django-bmf/django-bmf | djangobmf/contrib/task/permissions.py | Python | bsd-3-clause | 2,444 | 0.003682 |
# Orca
#
# Copyright 2010 Joanmarie Diggs.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library i... | chrys87/orca-beep | src/orca/scripts/apps/soffice/script_utilities.py | Python | lgpl-2.1 | 22,259 | 0.001483 |
from django.conf.urls import url, include
from rest_framework import routers
from api import views
router = routers.DefaultRouter(trailing_slash=True)
router.register(
r'sysusers', views.DjangoUserViewSet, base_name="sysusers")
router.register(
r'sysgroups', views.DjangoGroupViewSet, base_name="sysgroups")
rou... | geosoco/reddit_coding | api/urls.py | Python | bsd-3-clause | 1,309 | 0 |
#!/usr/bin/env python3
""" Program that convert a pdf to a text file using Tesseract OCR.
The pdf file is first converted to a png file using ghostscript,
then the png file if processed by Tesseract.
"""
import os
import subprocess
import glob
import platform
import argparse
parser = argparse.ArgumentParser(descri... | bricaud/OCR-classif | pdf2txt.py | Python | apache-2.0 | 3,948 | 0.029889 |
#coding=utf-8
import sys
import os
import time
from shutil import *
def backup_db(dirname):
assert os.path.isdir(dirname),"not dirname"
for root,dirs,filenames in os.walk(dirname):
#print root,dirs,filenames
for filename in filenames:
filename = os.path.join(root,filename)
... | sundream/shell | backup_db.py | Python | gpl-2.0 | 896 | 0.014509 |
import logging
import socket
import ssl
import struct
import warnings
import zlib
import io
import os
import platform
from functools import wraps
from threading import local as thread_local
from .rencode import dumps, loads
DEFAULT_LINUX_CONFIG_DIR_PATH = '~/.config/deluge'
RPC_RESPONSE = 1
RPC_ERROR = 2
RPC_EVENT = ... | pymedusa/Medusa | ext/deluge_client/client.py | Python | gpl-3.0 | 12,558 | 0.00223 |
# Generated by Django 2.1.7 on 2019-04-30 13:20
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='publishablemodel',
name='id'... | flavoi/diventi | diventi/core/migrations/0002_auto_20190430_1520.py | Python | apache-2.0 | 446 | 0.002242 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | arunkgupta/gramps | gramps/gen/utils/alive.py | Python | gpl-2.0 | 26,674 | 0.005436 |
# **********************************************************************
#
# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# ***********************************************************... | ljx0305/ice | python/test/Ice/adapterDeactivation/AllTests.py | Python | gpl-2.0 | 2,229 | 0.007627 |
import unittest
import zope.component
from zExceptions import Unauthorized
from Products.PloneTestCase import ptc
from Products.PloneTestCase.ptc import default_user
from pmr2.oauth.interfaces import ITokenManager, IConsumerManager
from pmr2.oauth.interfaces import IScopeManager
from pmr2.oauth.token import Token
fr... | PMR2/pmr2.oauth | pmr2/oauth/tests/test_form.py | Python | gpl-2.0 | 4,711 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-21 22:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterField(
... | devolio/devolio | users/migrations/0002_auto_20170321_2209.py | Python | gpl-3.0 | 589 | 0.001698 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | kalrey/swift | swift/common/constraints.py | Python | apache-2.0 | 10,266 | 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... | cts2/pyjxslt | pyjxslt-python/tests/testXMLtoJSON.py | Python | apache-2.0 | 3,904 | 0.003842 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | python/fate_arch/metastore/db_models.py | Python | apache-2.0 | 4,898 | 0.001429 |
# -*- coding: utf-8 -*-
"""
Tests.
"""
import unittest
from bruges.rockphysics import fluidsub
# Inputs... GAS case
vp_gas = 2429.0
vs_gas = 1462.4
rho_gas = 2080.
# Expected outputs... BRINE case
vp_brine = 2850.5
vs_brine = 1416.1
rho_brine = 2210.0
phi = 0.275 # Don't know this... reading from fig
rhoh... | agile-geoscience/agilegeo | bruges/rockphysics/test/fluidsub_test.py | Python | apache-2.0 | 2,698 | 0 |
r"""
Used to configure the main parameters for each implemented model.
.. currentmodule:: compmech.conecyl.modelDB
"""
import numpy as np
from scipy.sparse import coo_matrix
from clpt import *
from fsdt import *
db = {
'clpt_donnell_bc1': {
'linear static': True,
'linear... | saullocastro/compmech | compmech/conecyl/modelDB.py | Python | bsd-3-clause | 17,932 | 0.001617 |
from __future__ import division
from math import *
def calculate(expr_string):
math_list = ['math', 'acos', 'asin', 'atan', 'atan2', 'ceil',
'cos', 'cosh', 'degrees', 'e', 'exp', 'fabs', 'floor', 'fmod',
'frexp', 'hypot', 'ldexp', 'log', 'log10', 'modf', 'pi',
'pow', 'radians', 'sin', 'si... | vtbassmatt/django-expression-fields | src/expression_fields/expr.py | Python | mit | 668 | 0.01497 |
from django.core.exceptions import ValidationError
from django.test import TestCase
from api.test.models import _get_string_data_object
from api.models.data_nodes import *
class TestDataNode(TestCase):
INPUT_DATA=(
([(0,3),(0,1)], 'i'),
([(1,3),(0,2)], 'a'),
([(1,3),(1,2)], 'm'),
... | StanfordBioinformatics/loom | server/loomengine_server/api/test/models/test_data_nodes.py | Python | agpl-3.0 | 10,494 | 0.019726 |
from rest_framework.decorators import api_view, parser_classes
from rest_framework.parsers import JSONParser, FormParser, MultiPartParser
from rest_framework.response import Response
from .serializers import *
import json
from urllib.parse import urlencode
from urllib.request import urlopen, Request
from urllib.error i... | stlim0730/glide | api/views.py | Python | mit | 35,037 | 0.013643 |
# implement samba_tool drs commands
#
# Copyright Andrew Tridgell 2010
# Copyright Andrew Bartlett 2017
#
# based on C implementation by Kamen Mazdrashki <kamen.mazdrashki@postpath.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | kernevil/samba | python/samba/netcmd/drs.py | Python | gpl-3.0 | 36,173 | 0.001603 |
#!/usr/bin/env python
from datetime import timedelta
import os
import random
from django.utils.dateparse import parse_date
from faker import Faker
test_email = 'michael.b001@gmx.de'
fake = Faker('de')
fake.seed(1)
random.seed(1)
def get_random_date():
return parse_date('1983-03-31') + timedelta(days=random.r... | michaelbratsch/bwb | populate.py | Python | gpl-3.0 | 1,775 | 0 |
# 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... | allenlavoie/tensorflow | tensorflow/contrib/distributions/python/ops/estimator.py | Python | apache-2.0 | 7,908 | 0.004299 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import os
from hashlib import md5
# This mu... | unho/pootle | pootle/apps/pootle_app/management/commands/update_tmserver.py | Python | gpl-3.0 | 13,500 | 0.000963 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Daniel Jaouen <dcj24@cornell.edu>
# (c) 2016, Indrajit Raychaudhuri <irc+code@indrajit.com>
#
# Based on homebrew (Andrew Dunham <andrew@du.nham.ca>)
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the... | andreaso/ansible | lib/ansible/modules/packaging/os/homebrew_tap.py | Python | gpl-3.0 | 7,344 | 0.000681 |
import random
import requests
import shutil
import logging
import os
import traceback
import ujson
from typing import List, Dict, Any, Optional, Set, Callable, Iterable, Tuple, TypeVar
from django.forms.models import model_to_dict
from zerver.models import Realm, RealmEmoji, Subscription, Recipient, \
Attachment,... | jackrzhang/zulip | zerver/data_import/import_util.py | Python | apache-2.0 | 21,272 | 0.003197 |
# Copyright 2013 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... | vedujoshi/tempest | tempest/api/network/test_floating_ips.py | Python | apache-2.0 | 10,882 | 0 |
""" 9.4 Write a program to read through the mbox-short.txt and
figure out who has the sent the greatest number of mail messages.
The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail.
The program creates a Python dictionary that maps the sender's mail address to a ... | missulmer/Pythonstudy | coursera_python_specialization/9_4.py | Python | cc0-1.0 | 1,246 | 0.005618 |
# use priority queue to implement stack and queue
import heapq
class stack:
data = []
highestPriority = 0
lowestPriority = 0
def push(self, e):
self.highestPriority -= 1 # smaller value means priority is higher
heapq.heappush(self.data, (self.highestPriority, e))
def pop(self):... | yubinbai/python_practice | priorityqueue.py | Python | apache-2.0 | 1,718 | 0.005239 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-03-05 14:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('partner', '0016_auto_20191115_2151'),
]
operations = [
migrations.AlterField(
model_name='historicalp... | eduNEXT/edunext-ecommerce | ecommerce/extensions/partner/migrations/0017_auto_20200305_1448.py | Python | agpl-3.0 | 887 | 0.003382 |
import MySQLdb
from parameters import Parameters
import logging
def run_sql(sql, db=None):
db = MySQLdb.connect(host=Parameters.DB_HOST, user=Parameters.DB_USER, passwd=Parameters.DB_PASSWORD, db=Parameters.DB_SCHEMA)
cursor = db.cursor()
logging.debug(sql)
try:
cursor.execut... | willycs40/zoopla_pull | db.py | Python | bsd-2-clause | 795 | 0.015094 |
import logging
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.mail import EmailMultiAlternatives
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils import timezone
from djblets.siteconfig.models import SiteC... | atagar/ReviewBoard | reviewboard/notifications/email.py | Python | mit | 13,727 | 0.000437 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2008 Francisco José Rodríguez Bogado #
# (pacoqueen@users.sourceforge.net) #
# ... | pacoqueen/bbinn | informes/albaran_multipag.py | Python | gpl-2.0 | 26,260 | 0.01394 |
#!/usr/bin/python
"""A script to get information from MrTijn's new server so I (MrMadsenMalmo) can display it
on a website
"""
__author__ = "MrMadsenMalmo - Fredrik A. Madsen-Malmo & Tijndagamer"
import os
import time
import re
import datetime
def main():
dataList = []
dataList.append(os.popen("uptime").re... | FredrikAugust/server-status | statuspagescript.py | Python | mit | 2,247 | 0.015576 |
#!/usr/bin/env python3
import fnmatch
import os
import re
import ntpath
import sys
import argparse
def validKeyWordAfterCode(content, index):
keyWords = ["for", "do", "count", "each", "forEach", "else", "and", "not", "isEqualTo", "in", "call", "spawn", "execVM", "catch"];
for word in keyWords:
try:
... | osasto-kuikka/KGE | tools/sqf_validator.py | Python | gpl-2.0 | 8,231 | 0.008018 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | QISKit/qiskit-sdk-py | qiskit/result/exceptions.py | Python | apache-2.0 | 1,290 | 0 |
# -*- coding: utf-8 -*-
"""
Code to manage fetching and storing the metadata of IdPs.
"""
#pylint: disable=no-member
from celery.task import task # pylint: disable=import-error,no-name-in-module
import datetime
import dateutil.parser
import logging
from lxml import etree
import requests
from onelogin.saml2.utils impor... | mushtaqak/edx-platform | common/djangoapps/third_party_auth/tasks.py | Python | agpl-3.0 | 6,642 | 0.003917 |
## @file
# Routines for generating Pcd Database
#
# Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the ... | intel/ipmctl | BaseTools/Source/Python/AutoGen/GenPcdDb.py | Python | bsd-3-clause | 75,819 | 0.007755 |
import requests
from config import constants
from database import db
from database import db_models
from util import fips
R = db_models.Rep
HOUSE_MEMBERS_LEAVING_OFFICE_URL = 'https://api.propublica.org/congress/v1/114/house/members/leaving.json'
SENATE_MEMBERS_LEAVING_OFFICE_URL = 'https://api.propublica.org/congre... | jlgoldman/writetogov | database/populate_rep_status_from_propublica.py | Python | bsd-3-clause | 2,149 | 0.005119 |
import asyncio
import asyncio.streams
from .client_exceptions import (ClientOSError, ClientPayloadError,
ClientResponseError, ServerDisconnectedError)
from .http import HttpResponseParser, StreamWriter
from .streams import EMPTY_PAYLOAD, DataQueue
class ResponseHandler(DataQueue, asyn... | alex-eri/aiohttp-1 | aiohttp/client_proto.py | Python | apache-2.0 | 6,070 | 0 |
#!/usr/bin/env python
import imp
import os
import sys
PYCART_DIR = ''.join(['python-', '.'.join(map(str, sys.version_info[:2]))])
try:
zvirtenv = os.path.join(os.environ['OPENSHIFT_HOMEDIR'], PYCART_DIR,
'virtenv', 'bin', 'activate_this.py')
execfile(zvirtenv, dict(__file__ = zvirtenv... | getupcloud/openshift-nginx-python-2.7 | app.py | Python | apache-2.0 | 1,287 | 0.018648 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.