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 | prefix stringlengths 0 8.16k | middle stringlengths 3 512 | suffix stringlengths 0 8.17k |
|---|---|---|---|---|---|---|---|---|
EmreAtes/spack | var/spack/repos/builtin/packages/r-mda/package.py | Python | lgpl-2.1 | 1,727 | 0.000579 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-64... | om spack import *
class RMda(RPackage):
"""Mixture and flexible discriminant analysis, multivariate adaptive
regression splines (MARS), BRUTO."""
homepage = "https://cran.r-project.org/package=mda"
url = "https://cran.r-project.org/src/contrib/mda_0.4-9.tar.gz"
list_url = "https://cran.r-pro... | version('0.4-9', '2ce1446c4a013e0ebcc1099a00269ad9')
depends_on('[email protected]:')
depends_on('r-class', type=('build', 'run'))
|
UManPychron/pychron | pychron/core/ui/image_editor.py | Python | apache-2.0 | 1,154 | 0 | # ========================== | =====================================================
# Copyright 2013 Jake Ross
#
# 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 re... | applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =======================... |
bsmr-eve/Pyfa | eos/effects/shipbonusmissilelauncherheavyrofatc1.py | Python | gpl-3.0 | 300 | 0.006667 | # shipBonusMissileLauncherHeavyROFATC1
#
# Used by:
# Shi | p: Vangel
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Missile Launcher Heavy",
"speed", ship.getModifiedItemAttr("shipBon | usATC1"))
|
procangroup/edx-platform | common/djangoapps/student/apps.py | Python | agpl-3.0 | 603 | 0.001658 | """
Configuration for the ``student`` Django application.
"""
from __future__ import absolute_import
from django.apps import AppConfig
from django.contrib.auth.signals import user_logged_in
class Stud | entConfig(AppConfig):
"""
Default configuration for the `` | student`` application.
"""
name = 'student'
def ready(self):
from django.contrib.auth.models import update_last_login as django_update_last_login
user_logged_in.disconnect(django_update_last_login)
from .signals.receivers import update_last_login
user_logged_in.connect(updat... |
pylada/pylada-light | src/pylada/vasp/incar/__init__.py | Python | gpl-3.0 | 10,395 | 0.002116 | ###############################
# This file is part of PyLaDa.
#
# Copyright (C) 2013 National Renewable Energy Lab
#
# PyLaDa is a high throughput computational platform for Physics. It aims to make it easier to submit
# large numbers of jobs on supercomputers. It provides a python interface to physical input, suc... | e)
self.nonscf = NonScf(False)
self.system = System(True)
self.smearing = Smearing(None)
self.relaxation = Relaxation(None)
self.lsorbit = Lsorbit(None)
self.lwave = Boolean("lwave", False)
self.lcharg = Boolean("lcharg", True)
self.lvtot = Boolean("lvtot... | se)
self.lrpa = Boolean("lrpa", None)
self.loptics = Boolean("loptics", None)
self.lpead = Boolean("lpead", None)
self.lplane = Boolean("lplane", None)
self.nelm = Integer("nelm", None)
self.nelmin = Integer("nelmin", None)
self.nelmdl = Integer("nelmdl", None)
... |
ZhizhongPan/LeetCode | AddTwoNumbers/Solution.py | Python | mit | 193 | 0.010363 | fr | om _DS import ListNode
class Solution:
def add_two_numbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
| |
amitt001/Analytics-App | API/rate/__init__.py | Python | mit | 19 | 0.052632 | impo | rt rate_op | inion |
Azure/azure-sdk-for-python | sdk/databox/azure-mgmt-databox/azure/mgmt/databox/v2019_09_01/operations/_operations.py | Python | mit | 4,671 | 0.004282 | # 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 may cause incorrect behavior and will be lost if the code is regenerated.
# ----- | ---------------------------------------------------------------------
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline i... |
gnarula/eden_deployment | modules/s3db/cap.py | Python | mit | 78,715 | 0.007305 | # -*- coding: utf-8 -*-
""" Sahana Eden Common Alerting Protocol (CAP) Model
@copyright: 2009-2014 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to dea... | ,
"aviation.aircraftCrash": T("Aircraft Crash"),
"aviation.aircraftHijacking": T("Aircraft Hijacking"),
| "aviation.airportClosure": T("Airport Closure"),
"aviation.airspaceClosure": T("Airspace Closure"),
"aviation.noticeToAirmen": T("Notice to Airmen"),
"aviation.spaceDebris": T("Space Debris"),
"civil.demonstrations": T("Demonstrations"),
"civil.dig... |
fboers/jumegX | scripts/jumeg_tsv.py | Python | bsd-3-clause | 1,968 | 0.03252 | #!/usr/bin/env python
"""
JuMEG TSV Time Series Viewer
F | B 26.02.2015
last updae FB 26.02.2015
"""
import sys, getopt, os, os.path
import mne
#fout="/localdata/frank/data/MEG94T/mne/110058/MEG94T/121001_1331/1/110058_MEG94T_121001_1331_1_c,rfDC-float32,30sec-raw.fif'
#raw.save( fname,format='single',tmax=30.0)import wx
# jumeg_tsv.py --fname=110058_MEG94T_121001_13... | v.py --fname=110058_MEG94T_121001_1331_1_c,rfDC_30sec-raw.fif --path=/localdata/frank/data/MEG94T/mne/110058/MEG94T/121001_1331/1
#--- jumegs functions
from jumeg.tsvgl.utils.jumeg_tsv_utils import jumeg_tsv_utils_get_args
from jumeg.tsvgl.jumeg_tsv_gui import jumeg_tsv_gui
#from jumeg.tsv.jumeg_tsv_gui_orig import... |
parinporecha/backend_gtgonline | GTG/gtk/browser/custominfobar.py | Python | gpl-3.0 | 8,564 | 0 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2012 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... | later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Publi... | -----
import gtk
import threading
from GTG import _
from GTG.backends.backendsignals import BackendSignals
from GTG.tools.networkmanager import is_connection_up
class CustomInfoBar(gtk.InfoBar):
'''
A gtk.InfoBar specialized for displaying errors and requests for
interaction coming from the backends
... |
fedora-infra/faitout | faitout/default_config.py | Python | gpl-3.0 | 2,128 | 0.00047 | #-*- coding: utf-8 -*-
"""
default_config - the default configuration allowing to run this project
quickly and easily from the sources.
(c) 2013 - Copyright Red Hat Inc.
Authors:
- Pierre-Yves Chibon <[email protected]>
Distributed under License GPLv3 or later
You can find a copy of this lic... | warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
"""
# url to the database server:
DB_URL = 'sqlite://... |
chromium/chromium | tools/traffic_annotation/scripts/generator_utils_tests.py | Python | bsd-3-clause | 5,005 | 0.002997 | #!/usr/bin/env python
# Copyright 2020 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.
"""
Unit tests for generator_utils.py
"""
import os
import unittest
import generator_utils
# Absolute path to chrome/src.
SCRIPT_DIR =... | assertEqual(self.ANNOTATIONS_MAPPING,
generator_utils.map_annotation | s(self.TSV_CONTENTS))
def test_xml_parser_build_placeholders(self):
xml_parser = generator_utils.XMLParser(
os.path.join(TESTS_DIR, "fake_grouping.xml"), self.ANNOTATIONS_MAPPING)
self.assertEqual(self.PLACEHOLDERS, xml_parser.build_placeholders())
def test_find_first_index(self):
first_index ... |
rupor-github/fb2mobi | ui/gui_config.py | Python | mit | 7,187 | 0.004176 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from lxml import etree
from lxml.builder import ElementMaker
import os
import codecs
class GuiConfig():
def __init__(self, config_file):
self.config_file = os.path.normpath(os.path.abspath(config_file))
self.converterConfig = {}
self.currentP... | f e.tag == 'currentFormat':
self.currentFormat = e.text
elif e.tag == 'outputFolder':
self.outputFolder = e.text
elif e.tag == 'lastUsedTargetPath':
self.lastUsedTargetPath = e.text
elif e.tag == 'embedFontFamily':
se... | self.hyphens = e.text
elif e.tag == 'lastUsedPath':
self.lastUsedPath = e.text
elif e.tag == 'kindlePath':
self.kindlePath = e.text
elif e.tag == 'kindleDocsSubfolder':
self.kindleDocsSubfolder = e.text
elif... |
saxix/django-concurrency | tests/test_reversion.py | Python | mit | 961 | 0.002081 | import pytest
from demo.models import ReversionConcurrentModel
from django.urls import reverse
from reversion import add_to_revision, revisions, set_comment
from reversion.models import Version
@pytest.mark.django_db
@pytest.mark.functional
def test_recover(admin_user, client):
concurrentmodel = ReversionConcurre... | url, user | =admin_user.username)
res.form.submit().follow()
concurrentmodel2 = ReversionConcurrentModel.objects.get(pk=concurrentmodel.pk)
assert concurrentmodel2.username == ver.field_dict['username']
assert concurrentmodel2.version > ver.field_dict['version']
|
odoo-romania/extra | account_statement_operation_multicompany/__openerp__.py | Python | agpl-3.0 | 1,519 | 0 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account Statement Operation multi-company module for Odoo
# Copyright (C) 2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <[email protected]>
#
# This program is free so... | ails.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Account Statement Operation Multi-company',
'version': '0... |
'summary': 'Fix multi-company issue on Statement Operation Templates',
'author': "Akretion,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com',
'depends': ['account'],
'data': [
'account_view.xml',
'security/rule.xml',
],
'installable': True,
}
|
TheTimmy/spack | var/spack/repos/builtin/packages/simul/package.py | Python | lgpl-2.1 | 2,009 | 0.000498 | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-64... | L.
#
# 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 Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT A | NY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the ... |
resmo/ansible | lib/ansible/modules/cloud/google/gcp_kms_key_ring.py | Python | gpl-3.0 | 7,192 | 0.003059 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | location:
description:
- The location for the KeyRing.
- A full list of valid locations can be found by running `gcloud kms locations list`.
returned: success
type: str
'''
################################################################################
# Imports
#############################################... | json
################################################################################
# Main
################################################################################
def main():
"""Main function"""
module = GcpModule(
argument_spec=dict(
state=dict(default='present', choices=['pr... |
pu6ki/elsyser | talks/models.py | Python | mit | 891 | 0.002245 | from django.db import models
from django.contrib.auth.models import User
from vote.models import VoteModel
cla | ss Meetup(models.Model):
date = models.DateTimeField()
description = models.CharField(max_length=10000, blank=True, null=True)
def __str__(se | lf):
return '{} ({})'.format(self.__class__.__name__, self.date)
class Meta:
ordering = ['date']
class Talk(VoteModel):
meetup = models.ForeignKey(Meetup, related_name='talks', null=True, on_delete=models.CASCADE)
author = models.ForeignKey(User, related_name='talks', on_delete=models.CAS... |
MAKOMO/artisan | src/comm/CommFujiExamplePython2.6.py | Python | gpl-3.0 | 5,757 | 0.012159 | #!/usr/bin/env python
#####################################################################################
# COMM TEST PROGRAM FOR FUJI PXG4 or PXR3 with RS485 option and modbus protocol
# This program shows how to read Temp from a Fuji PID
# ########################################################################... | command = "\x02\x04\x03\xE8\x00\x01\xB1\x89"
serPID = serial.Serial("COM12", baudrate=9600, bytesize=8, parity='O', stopbits=1, timeout=1)
serPID.write(command)
|
#example of data received r = "\x01\x04\x02\x03\x46\x38\x32" (7 bytes)
r = serPID.read(7)
serPID.close()
if len(r) != 7:
print "bad RX data"
return 0
except serial.SerialException, e:
print "Serial port error" + str(e)
... |
square/pants | tests/python/pants_test/tasks/test_bundle_create.py | Python | apache-2.0 | 1,220 | 0.005738 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache Licen | se, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals | )
from pants.util.dirutil import safe_mkdtemp, safe_rmtree
from pants.backend.jvm.tasks.bundle_create import BundleCreate
from pants_test.task_test_base import TaskTestBase
sample_ini_test_1 = """
[DEFAULT]
pants_distdir = /tmp/dist
"""
class BundleCreateTest(TaskTestBase):
@classmethod
def task_type(cls):
... |
makinacorpus/ionyweb | ionyweb/plugin_app/plugin_text/views.py | Python | bsd-3-clause | 222 | 0.004505 | # -*- coding: utf-8 -*-
from ionyweb.website.ren | dering.utils import render_view
def index_view(request, | plugin):
return render_view(
plugin.get_templates('plugin_text/index.html'),
{'object': plugin})
|
etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-umap.py | Python | gpl-3.0 | 517 | 0 | # -------------------------------------------------- | ----------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPDX-License-Identifier: GPL-2.0-or-later
# -----------... | p-learn')
|
GNOME/conduit | conduit/modules/BoxDotNetModule/BoxDotNetModule.py | Python | gpl-2.0 | 11,179 | 0.008677 | """
BoxDotNet Module
"""
import os, sys
import traceback
import md5
import logging
log = logging.getLogger("modules.BoxDotNet")
import conduit
import conduit.utils as Utils
import conduit.Web as Web
import conduit.dataproviders.DataProvider as DataProvider
import conduit.Exceptions as Exceptions
from conduit.datatypes... | urn "http://box.net/api/1.0/download/%s/%s" % (self.token, fileID)
#------------------------------------------
# Upload functions
#------------------------------------------
def _upload_file (self, file_path, filename):
"""
Upload the file to box.net
@returns: uid of the file
... | h_token=self.token,
folder_id=self.folder_id,
share=0,
filename=filename
)
uid = rsp.files[0].file[0].attrib['id']
return uid
def _replace_file (self, fileID, url, name):
"""
Box.net a... |
danielmellado/tempest | tempest/api/image/v2/test_images_negative.py | Python | apache-2.0 | 3,822 | 0 | # Copyright 2013 OpenStack Foundation
# All Rights Reserved.
# Copyright 2013 IBM Corp.
#
# 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/LIC... |
# under the License.
import uuid
from tempest_lib import exceptions as lib_exc
from tempest.api.image import base
from tempest import test
class ImagesNegativeTest(base.BaseV2ImageTest):
"""
here we have -ve tests for get_image and delete_image api
Tests
** get non-existent image
... | d image
** delete non-existent image
** delete rimage with image_id=NULL
** delete the deleted image
"""
@test.attr(type=['negative'])
@test.idempotent_id('668743d5-08ad-4480-b2b8-15da34f81d9f')
def test_get_non_existent_image(self):
# get the non-existent image
... |
noelevans/sandpit | bayesian_methods_for_hackers/LoLN_convergence_examples_ch04.py | Python | mit | 867 | 0 | import numpy as np
import matplotlib.pyplot as plt
import pymc as pm
def main():
sample_size = 100000
expected_value = lambda_ = 4.5
N_samples = range(1, sample_size, 100)
for k in range(3):
samples = | pm.rpoisson(lambda_, size=sample_size)
partial_average = [samples[:i].mean() for i in N_samples]
label = "average of $n$ samples; seq. %d" % k
plt.plot(N_samples, partial_average, lw=1.5, label=label)
plt.plot(N_samples, expected_value * np.ones_like(partial_average),
ls="--"... | plt.ylabel("average of $n$ samples")
plt.xlabel("# of samples, $n$")
plt.legend()
plt.show()
if __name__ == '__main__':
main()
|
stripecoin/stripecoin | share/qt/clean_mac_info_plist.py | Python | mit | 901 | 0.016648 | #!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the stripecoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt m | ac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
inFile = bitcoinDir+"/share/qt/Info.plist"
outFile = "stripecoin-Qt.app/Contents/Info.plist"
version = "unknown";
fileForGrabbingVersion = bitcoinDir+"bitcoin-qt.p | ro"
for line in open(fileForGrabbingVersion):
lineArr = line.replace(" ", "").split("=");
if lineArr[0].startswith("VERSION"):
version = lineArr[1].replace("\n", "");
fIn = open(inFile, "r")
fileContent = fIn.read()
s = Template(fileContent)
newFileContent = s.substitute(VERSION=version,YEAR=date.today().year)
fO... |
JSBCCA/pythoncode | early_projects/perfcountertest.py | Python | mit | 135 | 0 | imp | ort time
import find_remove_find5
import sort_then_find3
import walk_through7
def time_find_two_smallest(find_func, lst):
| ...
|
MalwareLabHagenberg/ambrosia | ambrosia_plugins/network/__init__.py | Python | gpl-3.0 | 2,143 | 0.000467 | # -*- coding: utf-8 -*-
###############################################################################
# #
# Ambrosia - a tool to visualize ANANAS results #
# | #
# Copyright (C) 2015 Wolfgang Ettlinger and the ANANAS Team #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Pu... | |
dreispt/department | analytic_department/__init__.py | Python | agpl-3.0 | 16 | 0 | import | anal | ytic
|
reidswan/Checkit | checkit/wsgi.py | Python | mit | 392 | 0 | """
WSGI config for checkit project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"" | "
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "checkit.settings")
application = get_wsgi_application( | )
|
commtrack/temp-aquatest | apps/xformmanager/admin.py | Python | bsd-3-clause | 817 | 0.0306 | from django.contrib import admin
from xformmanager.models import *
class FormDefModelAdmin(admin.ModelAdmin):
list_display = ('id','uploaded_by', 'domain', 'form_display_name','form_name', 'submit_time',)
list_filter = ["domain"]
class MetaDataModelAdmin(admin.ModelAdmin):
list_display = ( 'fo... | mname','formversion','deviceid','timestart','timeend','username','chw_id','uid', 'attachment', 'raw_data', 'formdefmodel')
list_filter = ( 'formname','formversion','deviceid','timestart','timeend','username','chw_id','formdefmodel')
admin.site.register(FormDefModel,FormDefModelAdmin)
admin.site.register(Elemen... | .register(FormDataGroup)
|
uclaros/QGIS | python/plugins/processing/algs/gdal/GridInverseDistanceNearestNeighbor.py | Python | gpl-2.0 | 9,771 | 0.003787 | # -*- coding: utf-8 -*-
"""
***************************************************************************
GridInverseDistanceNearestNeighbor.py
---------------------
Date : September 2017
Copyright : (C) 2017 by Alexander Bruy
Email : alexander dot bruy at gm... | r('The radius of the search circle'),
type=QgsProcessingParameterNumber.Double,
minValue=0.0,
defaultValue=1.0))
self.addParameter(QgsProcessingPar... | ta points to use'),
type=QgsProcessingParameterNumber.Integer,
minValue=0,
defaultValue=12))
self.addParameter(QgsProcessingParameterNumber(self.MI... |
SU-ECE-17-7/hotspotter | hotspotter/report_results2.py | Python | apache-2.0 | 40,958 | 0.004346 | #!/usr/env python
from __future__ import division, print_function
from hscom import __common__
(print, print_, print_on, print_off, rrr, profile, printDBG) =\
__common__.init(__name__, '[rr2]', DEBUG=False)
# Matplotlib
import matplotlib
matplotlib.use('Qt4Agg')
# Python
import os
import sys
import textwrap
import fnma... | self.hs = hs
self.qcx2_res = qcx2_res
self.SV = SV
self.rankres_str = None
self.title_suffix = None
self.scalar_mAP_str = '# mAP score = NA\n'
self.scal | ar_summary = None
self.problem_false_pairs = None
self.problem_true_pairs = None
self.greater1_cxs = None
self.greater5_cxs = None
self.matrix_str = None
def get_orgres2_distances(allres, *args, **kwargs):
return _get_orgres2_distances(allres, *args, *... |
raju249/oppia | core/domain/feedback_services_test.py | Python | apache-2.0 | 27,168 | 0.00011 | # Copyright 2014 The Oppia 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 applicable ... | lf.USER_EMAIL)
user_services.get_or_create_user(self.user_id, self.USER_EMAIL)
self.signup(self.USER_EMAIL, self.USERNAME)
# Open thread with suggestion.
thread1 = feedback_models.FeedbackThreadModel(
id=feedback_models.FeedbackThreadModel.generate_full_thread_id(
... | original_author_id=self.user_id,
subject='SUGGESTION',
has_suggestion=True)
# Closed threads with suggestion.
thread2 = feedback_models.FeedbackThreadModel(
id=feedback_models.FeedbackThreadModel.generate_full_thread_id(
self.EXP_ID1, self.THREAD_ID2... |
Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_06_01/operations/_azure_firewalls_operations.py | Python | mit | 26,909 | 0.004645 | # 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 may ... | ""
models = _models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def _delete_initial(
self,
resource_group_name, # type: str
... | = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-06-01"
# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
path_format_argument... |
jmptrader/duktape | tools/duk_meta_to_strarray.py | Python | mit | 1,076 | 0.002788 | #!/usr/bin/env python2
#
# Create an array of C strings with Duktape built-in strings.
# Useful when using external strings.
#
import os
import sys
import json
def to_c_string(x):
res = '"'
| term = False
for i, c in enumerate(x):
if term:
term = False
res += '" "'
o = ord(c)
if o < 0x20 or o > 0x7e or c in '\'"\\':
# Terminate C string so tha | t escape doesn't become
# ambiguous
res += '\\x%02x' % o
term = True
else:
res += c
res += '"'
return res
def main():
f = open(sys.argv[1], 'rb')
d = f.read()
f.close()
meta = json.loads(d)
print('const char *duk_builtin_strings[] = {... |
WeakGroup/twitter-rec | interface/website/website/settings.py | Python | gpl-2.0 | 2,100 | 0 | """
Django settings for website project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | ngo.contrib.staticfiles',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.mi | ddleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'website.urls'
WSGI_APPLICATION = 'website.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATA... |
rajrohith/blobstore | azure/storage/_http/__init__.py | Python | apache-2.0 | 2,461 | 0.00122 | #-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... | ---------
class HTTPError(Exception):
'''
Represents an HTTP Exception when response status code >= 300.
:ivar int status:
the status code of the response
:ivar str message:
the message
:i | var list headers:
the returned headers, as a list of (name, value) pairs
:ivar bytes body:
the body of the response
'''
def __init__(self, status, message, respheader, respbody):
self.status = status
self.respheader = respheader
self.respbody = respbody
Excep... |
coshkun/6.00.1x-MITx-Course-Training-Lab-Notes | anaconda/6.00.1x.hello.py | Python | mit | 126 | 0.007937 | # -*- coding: utf-8 -*-
"""
Spyde | r Editor
This is a temporary script file.
"" | "
print('hello python!')
print('I like 6.00.1x') |
tongwang01/tensorflow | tensorflow/python/training/supervisor.py | Python | apache-2.0 | 41,789 | 0.004068 | # 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... | Model is initialized. If yes, it just creates a session and
returns it to the training code that proceeds normally. If the model needs
to b | e initialized, the chief task takes care of reinitializing it; the other
tasks just wait for the model to have been initialized.
NOTE: This modified program still works fine as a single program.
The single program marks itself as the chief.
#### What `master` string to use
Whether you are running on your m... |
maoy/zknova | nova/compute/resource_tracker.py | Python | apache-2.0 | 23,300 | 0.000429 | # Copyright (c) 2012 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 requi... | openstack.common import cfg
from nova.openstack.common import importutils
from nova.openstack.common import jsonutils
from nova.openstack.common import lockutils
from nova.openstack.common import log as logging
resource_tracker_opts = [
cfg.IntOpt('reserved_host_disk_mb', default=0,
help='Amount of ... | the host'),
cfg.IntOpt('reserved_host_memory_mb', default=512,
help='Amount of memory in MB to reserve for the host'),
cfg.StrOpt('compute_stats_class',
default='nova.compute.stats.Stats',
help='Class that will manage stats for the local compute host')
]
CONF = cfg... |
amitsaha/learning | python/search/find_missing_number.py | Python | unlicense | 228 | 0.039474 | """"
Find the missing number from a sequence of
numbers
"""
def find_missing(arr):
n = len(arr)+1
s = n*(n+1.0)/2.0
return s - sum(arr)
print find_m | issing([5,4,2,1])
print | find_missing([10,9,2,1, 8, 7, 6, 5, 4])
|
nicorellius/pdxpixel | pdxpixel/apps/blog/migrations/0002_post_tags.py | Python | mit | 602 | 0.001661 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-30 15:39
from __future__ import unicode_literal | s
from django.db import migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0002_auto_20150616_2121'),
('blog', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='post',
name='tags',
... | tem', to='taggit.Tag', verbose_name='Tags'),
),
]
|
chelberserker/mipt_cs_on_python | exes/ex4.py | Python | gpl-2.0 | 93 | 0.021505 | max = A[ | 1]
for i in range(len(A)):
if A.count(A[i]) > A.count(max):
max = A[i]
print | (max)
|
prasannav7/ggrc-core | src/ggrc/migrations/versions/20131113030336_3df9e3188977_remove_control_type_.py | Python | apache-2.0 | 991 | 0.005045 | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: [email protected]
# Maintained By: [email protected]
"""R | emove Control.type, add Control assessors
Revision ID: 3df9e3188977
Revises: 2277e3978eb5
Create Date: 2013-11-13 03:03:36.585160
"""
# revision identifiers, used by Alembic.
revision = '3df9e3188977'
down_revision = '2277e3978eb5'
from alembic import op
imp | ort sqlalchemy as sa
def upgrade():
op.add_column('controls', sa.Column('principal_assessor_id', sa.Integer(), nullable=True))
op.add_column('controls', sa.Column('secondary_assessor_id', sa.Integer(), nullable=True))
op.drop_column('controls', u'type_id')
def downgrade():
op.add_column('controls', ... |
hengyicai/OnlineAggregationUCAS | python/pyspark/statcounter.py | Python | apache-2.0 | 4,354 | 0.001608 | #
# 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... | # Add a value into this StatCounter, updating the internal statistics.
def merge(self, value):
delta = value - self.mu
self.n += 1
self.mu += delta / self.n
self.m2 += delta * (value - self.mu)
| self.maxValue = maximum(self.maxValue, value)
self.minValue = minimum(self.minValue, value)
return self
# Merge another StatCounter into this one, adding up the internal statistics.
def mergeStats(self, other):
if not isinstance(other, StatCounter):
raise Exception("C... |
fujicoin/fujicoin | test/functional/wallet_coinbase_category.py | Python | mit | 2,302 | 0.000869 | #!/usr/bin/env python3
# Copyright (c) 2014-2018 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test coinbase transactions return the correct categories.
Tests listtransactions, listsinceblock, and... | dress, txid, 99)
# Mine one more block
self.nodes[0].generate(1)
# Coinbase transaction is now matured, so category is "generate"
self.assert_category("generate", address, txid, 100)
# Orphan block that paid to address
self.nodes[0].invalidateblock(hash)
# Coinb... | ", address, txid, 100)
if __name__ == '__main__':
CoinbaseCategoryTest().main()
|
UTSA-ICS/keystone-SID | keystone/tests/test_v3_oauth1.py | Python | apache-2.0 | 25,789 | 0.000039 | # Copyright 2013 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 agreed to in... | eaders, body = client.sign(self.base_url + endpoint,
http_method='POST')
headers.update({'Content-Type': 'application/json'})
return endpoint, headers
def _get_oauth_token(self, consumer, token):
client = oauth1.Client(consumer['key'],
... | e_owner_key=token.key,
resource_owner_secret=token.secret,
signature_method=oauth1.SIG_HMAC)
endpoint = '/auth/tokens'
url, headers, body = client.sign(self.base_url + endpoint,
http_method='POST')
... |
Jokymon/hpcs | test_input/test_while.py | Python | gpl-3.0 | 36 | 0.027778 | i = 0
while i < 25:
| i = i + 1
| |
Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_06_01/aio/operations/_subnets_operations.py | Python | mit | 35,492 | 0.0051 | # 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 may ... | rameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
re | quest = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.statu... |
FeroxTL/pynginxconfig | test.py | Python | mit | 3,830 | 0.002872 | #coding: utf8
import unittest
#from conf import NginxConfig
from blocks import KeyValueOption, KeyOption, Block
'''
s = """server {
nameserver 123;
}"""
s = """server 123;"""
a = NginxConfig()
a.load(s)
print(a.server)
#print(a.server.nameserver)
'''
class NgKVB(Block):
kv = KeyValueOption('kv_value')
cl... | ame'), '\nkvb_name {\n kv kv_value;\n}')
| kvb.kv = 'kv_another_value'
self.assertEqual(type(kvb.kv), KeyValueOption)
self.assertEqual(str(kvb.kv), 'kv_another_value')
self.assertEqual(kvb.kv.render('kv'), '\nkv kv_another_value;')
self.assertEqual(kvb.render('kvb_name'), '\nkvb_name {\n kv kv_another_value;\n}')
... |
lhellebr/GreenTea | tttt/urls.py | Python | gpl-2.0 | 3,215 | 0.001555 | from django.conf import settings
from django.conf.urls import include, patterns, url
from django.contrib import admin
from django.views.decorators.cache import cache_page
import apps.api.urls
from apps.core.views import (HomePageView, JobDetailView, JobHistoryView,
JobsDiffView, JobsListVi... | JobsDiffView.as_view(), name='jobs-diff'),
url(r'^(Automation/?)?$',
| HomePageView.as_view(), name='homepage'),
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:],
'django.views.static.serve',
{"document_root": settings.MEDIA_ROOT}),
url(r'^%s(?P<path>.*)$' % settings.STATIC_URL[1:],
... |
Davideddu/kivy-forkedtouch | kivy/uix/listview.py | Python | mit | 40,161 | 0.0001 | '''
List View
===========
.. versionadded:: 1.5
.. warning::
This code is still experimental, and its API is subject to change in a
future version.
The :class:`~kivy.uix.listview.ListView` widget provides a scrollable/pannable
viewport that is clipped to the scrollview's bounding box which contains
list ite... | hApp
runTouchApp(MainView(width=800))
Or, we could declare the listview using the kv language::
from kivy.uix.modalview import ModalView
from kivy.uix.listview import ListView
from kivy.uix.gr | idlayout import GridLayout
from kivy.lang import Builder
Builder.load_string("""
<ListViewModal>:
size_hint: None, None
size: 400, 400
ListView:
size_hint: .8, .8
item_strings: [str(index) for index in range(100)]
""")
class ListViewModal(ModalView)... |
all-umass/superman | superman/baseline/mario.py | Python | mit | 3,423 | 0.013439 | from __future__ import absolute_import, print_function
import numpy as np
import warnings
from numpy.polynomial.hermite import hermvander
from six.moves import xrange
from .common import Baseline
try:
from cvxopt import matrix as cvx_matrix, solvers
except ImportError:
from scipy.optimize import linprog
HAS_CVXO... | options=opts,
callback=callback)
res = {'status': res.message, 'x': res.x if res.success else None}
return res, P
def _linprog_callback(xk, nit=0, phase=0, tableau=None, **kwargs):
obj = -tableau[-1, -1]
new_state = False
if _callback_state['last_phase'] != phase:
new_state = True
_... | llback_state['last_phase'] = phase
if phase == 1:
if new_state:
print('--- Phase 1: Find a feasible point. ---')
print('Iter\tObjective')
_callback_state['last_nit'] = nit
print('%d\t%g' % (nit, obj))
else:
if new_state:
print('--- Phase 2: Minimize using simplex. ---')
print... |
theDevilsVoice/milton | summarize.py | Python | mit | 3,315 | 0.023228 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
'''
#title : summarize.py
#description : summarize for each IP listed, all of the ports being used,
# and where possible to do a port range (don't want to
# list out thousands of individual port numbers)
#author :
#date ... | )
end = start
for num in myiter:
if num == end + 1:
end = num
else:
yield (start, end)
start = num
end = num
yield (start, end)
def main():
"""main function"""
results_dict = {}
for filename in os.listdir(data_di | r):
filename = data_dir + "/" + filename
print("Processing " + filename)
try:
lines = [line.rstrip('\n') for line in open(filename)]
for each_line in lines:
ip, port = each_line.split(",")
if ip in results_dict:
""" no need to sanitize ip at this point """
po... |
ddong8/ihasy | lib/variables.py | Python | bsd-3-clause | 1,059 | 0.008499 | #!/usr/bin/env python
# coding=utf-8
#
# Copyright 2017 ihasy.com
# Do have a faith in what you're doing.
# Make your life a story worth telling.
import t | ime
import re
import random
from htmlentity import unescape
from HTMLParser import HTMLParser
def date(timestamp, formatter):
return time.strftime(formatter, time.gmtime(float(timestamp)))
def build_uri(u | ri, param, value):
regx = re.compile("[\?&](%s=[^\?&]*)" % param)
find = regx.search(uri)
split = "&" if re.search(r"\?", uri) else "?"
if not find: return "%s%s%s=%s" % (uri, split, param, value)
return re.sub(find.group(1), "%s=%s" % (param, value), uri)
def strip_tags(html):
html = html.stri... |
0x00f/pelican | pelican/tools/pelican_import.py | Python | agpl-3.0 | 11,582 | 0.003626 | #!/usr/bin/env python
import argparse
import os
import subprocess
import sys
import time
from codecs import open
from pelican.utils import slugify
def wp2fields(xml):
"""Opens a wordpress XML file, and yield pelican fields"""
try:
from BeautifulSoup import BeautifulStoneSoup
except ImportError:... | p:status')[0].contents[0] == "publish":
try:
title = item.title.contents[0]
except IndexError:
continue
content = item.fetc | h('content:encoded')[0].contents[0]
filename = item.fetch('wp:post_name')[0].contents[0]
raw_date = item.fetch('wp:post_date')[0].contents[0]
date_object = time.strptime(raw_date, "%Y-%m-%d %H:%M:%S")
date = time.strftime("%Y-%m-%d %H:%M", date_object)
autho... |
Jannes123/inasafe | safe/impact_statistics/aggregator.py | Python | gpl-3.0 | 69,859 | 0.000115 | # coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid - **Aggregator.**
Contact : [email protected]
.. note:: 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 Foundati... | unction results.
"""
def __init__(self, extent, aggregation_layer):
"""Director for aggregation based operations.
:param aggregation_layer: Layer representing clipped aggregation
areas. This will be converted to a memory layer inside this class.
see self.layer
:... | r
"""
QtCore.QObject.__init__(self)
self.hazard_layer = None # Used in deintersect() method
self.exposure_layer = None # Used in deintersect() method
self.safe_layer = None # Aggregation layer in SAFE format
self.prefix = 'aggr_'
self.attributes = {}
... |
stackforge/watcher | watcher/common/config.py | Python | apache-2.0 | 1,465 | 0 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... | F ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from watcher.common import rpc
from watcher import version
def parse_args(argv, default_config_files=None, default_config_dirs=None):
de... | ault_config_dirs = (default_config_dirs or
cfg.find_config_dirs(project='watcher'))
rpc.set_defaults(control_exchange='watcher')
cfg.CONF(argv[1:],
project='watcher',
version=version.version_info.release_string(),
default_config_dirs=default_conf... |
mozilla-metrics/hadoop-etls | fhr/v3/base_etl_job.py | Python | bsd-2-clause | 1,464 | 0.007514 | #!/usr/bin/env python
import sys, os
import codecs
import datetime
import mrjob.job
import mrjob.protocol
try: # workaround
from fhrdata import FHRData
import util
except ImportError:
pass
class BaseETLJob(mrjob.job.MRJob):
HADOOP_INPUT_FORMAT = 'SequenceFileAsTextInputFormat'
OUTPUT_PROTOCOL... | , line):
rec = raw_json = None
try:
raw_json = line.split("\t",1)[1]
| except:
self.mark_invalid_input()
return
try:
rec = FHRData(raw_json)
except:
self.mark_invalid_json()
return
return rec
|
utkarshsins/baadal-libvirt-python | examples/event-test.py | Python | gpl-2.0 | 22,504 | 0.004799 | #!/usr/bin/python -u
#
#
#
#################################################################################
# Start off by implementing a general purpose event loop for anyones use
#################################################################################
import sys
import getopt
import os
import libvirt
impor... | eup = False
self.runningPoll = False
self.nextHandleID = 1
| self.nextTimerID = 1
self.handles = []
self.timers = []
self.quit = False
# The event loop can be used from multiple threads at once.
# Specifically while the main thread is sleeping in poll()
# waiting for events to occur, another thread may come along
#... |
adexin/Python-Machine-Learning-Samples | Naive_bayes_mnist/nb.py | Python | mit | 2,416 | 0.001656 |
import numpy as np
import util
from datetime import datetime
from scipy.stats import norm
import better_exceptions
from scipy.stats import multivariate_normal as mvn
class NaiveBayers(object):
def __init__(self):
# Gaussian deviation
self.gaussians = dict()
# Class priors
self.pri... | K = len(self.gaussians)
# Fill by Zeros
P = np.zeros((N, K))
# for each class and mean/covariance
for c, g in self.ga | ussians.items():
mean, var = g['mean'], g['var']
log = np.log(self.priors[c])
# Calculate Log of the probability density function, all at once
P[:, c] = mvn.logpdf(X, mean=mean, cov=var) + log
return np.argmax(P, axis=1)
if __name__ == '__main__':
# Get trai... |
hackerberry/ooni-probe | old-to-be-ported-code/old-api/httpt.py | Python | bsd-2-clause | 3,102 | 0.002901 | """
This is a self genrated test created by scaffolding.py.
you will need to fill it up with all your necessities.
Safe hacking :).
"""
from zope.interface import implements
from twisted.python import usage
from twisted.plugin import IPlugin
from ooni.plugoo.tests import ITest, OONITest
from ooni.plugoo.assets import A... | of the report.
log.msg("Running control")
return {}
def load_assets(self):
if self.local_options and self.local_options['urls']:
return {'url': Asset(self.local_options['urls'])}
else:
return {}
# We need to instantiate it otherwise getPlugins does not de | tect it
# XXX Find a way to load plugins without instantiating them.
#httpt = httptTest(None, None, None)
|
laprice/ducttape | setup.py | Python | isc | 433 | 0 | from setuptools import setup, find_ | packages
setup(
name='ducttape',
version='0.1',
url='http://github.com/adamrt/ducttape/',
license='ISC',
author='Adam Patterson',
author_email='[email protected]',
description='Server deployment tools based on fabric.',
packages=find_packages(),
include_package_data=True,
zip_safe... | lse,
platforms='any',
install_requires=[
'fabric'
],
)
|
OCA/knowledge | document_page/__manifest__.py | Python | agpl-3.0 | 1,086 | 0 | # Copyright (C) 2004-2010 Tiny SPRL (<http://tin | y.be>).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Document Page",
"version": "13.0.1.1.0",
"category": "Knowledge Management",
"author": "OpenERP SA, Odoo Community Association (OCA)",
"images": [
"images/category_list.png",
"images/create_category.... | m/OCA/knowledge",
"license": "AGPL-3",
"depends": ["mail", "knowledge"],
"data": [
"security/document_page_security.xml",
"security/ir.model.access.csv",
"wizard/document_page_create_menu.xml",
"wizard/document_page_show_diff.xml",
"views/document_page.xml",
"... |
foss-ag/workshop_minecraft-python | src/astroids/Astroid.py | Python | gpl-3.0 | 2,132 | 0.001876 | import pygame
import random
class Astroid:
def __init__(self, x, y, scale):
"""
Create Astroid object.
:param x:
Start position X.
:param y:
Start position Y.
:param scale:
Astroid size scale.
"""
# astroid position
... | ze = self.__img.get_size()
self.__img = pygame.transform.scale(self.__img, (size[0] * self.__scale, siz | e[1] * self.__scale))
self.__astroid_rect = pygame.Rect(self.__img.get_rect())
@staticmethod
def create_astroid(state, size):
"""
Create new random astroid and add it to the astroids list in the game state.
:param state:
Game state with astroids list.
:param... |
frmichel/vo-support-tools | CE/monitor-ce/processors/running_ratio_per_ce.py | Python | mit | 3,434 | 0.023879 | #!/usr/bin/python
#
# This tool exploits the data of csv files produced by script collect-ce-job-status.py,
# to compute the running ratio R/(R+W) for each CE, as a function of time.
#
# Results are stored in files named results/CE/<CE queue>.csv.
import sys
import os
import csv
from operator import itemgetter, attrg... | -----------------------------------------------------------------------
# Try to figure out good and bad CEs: compute the list of CE queues
# Input:
# dataFiles: list of tuples: (fileName, datetime, date, hour, rows, sum_VO_Waiting, sum_VO_Running)
# where
# - datetime is formated as "YYYY-MM-DD HH:MM:SS"
#... | only the hour HH (used for filtering data in excel file)
# - rows is a dictionnary wich keys are the hostnames and values are another dictionnary with the following keys:
# 'Site'
# 'ImplName', 'ImplVer'
# 'CE_Total', 'VO_Total'
# 'CE_Running', 'VO_Running'
# 'CE_Waiting', 'VO_Waiting'
# ... |
QiJune/Paddle | python/paddle/fluid/tests/unittests/test_merge_ids_op.py | Python | apache-2.0 | 1,489 | 0 | # Copyright (c) 2018 PaddlePaddle 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 app... | x | 2 = np.array([[0.4, 0.5], [0.4, 0.5], [0.5, 0.6],
[0.5, 0.6]]).astype('float32')
out = np.array([[0.1, 0.2], [0.4, 0.5], [0.4, 0.5], [0.2, 0.3],
[0.5, 0.6], [0.5, 0.6], [0.3, 0.4]]).astype('float32')
self.inputs = {'Ids': ids, "X": [('x0', x0), ('x1', x1), ... |
Southpaw-TACTIC/Team | src/python/Lib/site-packages/win32com/client/tlbrowse.py | Python | epl-1.0 | 8,026 | 0.03065 | import win32ui
import win32con
import win32api
import string
import commctrl
import pythoncom
from pywin.mfc import dialog
error = "TypeLib browser internal error"
FRAMEDLG_STD = win32con.WS_CAPTION | win32con.WS_SYSMENU
SS_STD = win32con.WS_CHILD | win32con.WS_VISIBLE
BS_STD = SS_STD | win32con.WS_TABST... | nd([131, None, self.IDC_PARAMLIST, (190, 20, 75, 80), LBS_STD])
lvStyle = SS_STD | commctrl.LVS_REPORT | commctrl.LVS_AUTOARRANGE | commctrl.LVS_ALIGNLEFT | win32con.WS_BORDER | win32con.WS_TABSTOP
template.append(["SysListView32", "", self.IDC_LISTVIEW, (10, 110, 255, 65), lvStyle])
return template
i... | ry:
win32api.GetConsoleTitle()
dlg.DoModal()
except:
dlg.CreateWindow(win32ui.GetMainFrame())
|
pkuwwt/pydec | pydec/math/tests/test_graph.py | Python | bsd-3-clause | 2,078 | 0.008662 | #from pydec.testing import *
#
#import numpy
#from scipy.sparse import coo_matrix, csr_matrix
#
#from pydec.math.graph import maximal_independent_set
#
#
#class test_maximal_independent_set(TestCase):
# def is_MIS(self,graph,mis):
# mis = set(mis)
# unmarked = set(range(graph.shape[0]))
# graph ... | #
# def check_random(self):
# numpy.random.seed(0)
#
# def rand_sparse(m,n,nnz_per_row):
# """
# Return a sparse csr with a given number of random nonzero entries per row.
#
# The actual number of nonzeros may be less than expected due to overwriting.
# ... |
# rows = numpy.arange(m).repeat(nnz_per_row)
# cols = numpy.random.random_integers(low=0,high=n-1,size=nnz_per_row*m)
# vals = numpy.random.random_sample(m*nnz_per_row)
# return coo_matrix((vals,(rows,cols)),(m,n)).tocsr()
#
# for n in [2,10,20,50,200]... |
frappe/erpnext | erpnext/payroll/doctype/gratuity/test_gratuity.py | Python | gpl-3.0 | 7,019 | 0.02536 | # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
import frappe
from frappe.utils import add_days, flt, get_datetime, getdate
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.hr.doctype.expense_claim.test_expense_claim import get_pa... | lary_slip("[email protected]", "Monthly")
salary_slip.submit()
salary_slip = salary_slip.name
else:
salary_slip = get_last_salary_slip(employee)
if not frappe.db.get_value("Employee", "[email protected]", "holiday_list"):
from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_hol... | Test Holiday List")
return employee, salary_slip
|
ArduPilot/MAVProxy | MAVProxy/modules/mavproxy_arm.py | Python | gpl-3.0 | 8,432 | 0.00759 | #!/usr/bin/env python
'''arm/disarm command handling'''
import time, os
from MAVProxy.modules.lib import mp_module
from pymavlink import mavutil
# note that the number of bits here is contrained by the float
# transport mechanism. 25 bits is the limit. Given the transport
# limit, if all bits are set, or all but t... | e allegedly safe)")
return
if args[0] == "safetyoff":
self.master.mav.set_mode_send(self.target_system,
| mavutil.mavlink.MAV_MODE_FLAG_DECODE_POSITION_SAFETY,
0)
return
print(usage)
def cmd_disarm(self, args):
'''disarm motors'''
p2 = 0
if len(args) == 1 and args[0] == 'force':
p2 = 21196
... |
rcgee/oq-hazardlib | openquake/hazardlib/source/area.py | Python | agpl-3.0 | 7,581 | 0.000132 | # The Hazard Library
# Copyright (C) 2012-2016 GEM Foundation
#
# 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.
#... | ocation (first point of the polygon's mesh) but different
# magnitudes, nodal planes, hypocenters' depths a | nd occurrence rates
ref_ruptures = []
for (mag, mag_occ_rate) in self.get_annual_occurrence_rates():
for (np_prob, np) in self.nodal_plane_distribution.data:
for (hc_prob, hc_depth) in self.hypocenter_distribution.data:
hypocenter = Point(latitude=epicente... |
kaapstorm/trc_me | src/trc_me/api/forms.py | Python | agpl-3.0 | 937 | 0.003202 | # This file is part of trc.me.
#
# trc.me 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.
#
# trc.me is distributed in the hope that it... | mplied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# trc.me. If not, see <http://www.gnu.org/licenses/>.
#
from django import forms
from trc_me.core.models impo... | = ('user', 'img_width', 'img_height', 'created_at')
|
kunxi/docxgen | tests/__init__.py | Python | mit | 302 | 0.006623 | import re
from six.moves import zip
def check_tag(root, expected):
pattern = re.compile(r"{.*}([a-zA-Z]+)")
for tag, el in zip(expected, | root.iter()):
| m = pattern.match(el.tag)
assert m is not None
assert m.group(1) == tag, "Expect tag=%s, get %s" % (tag, m.group(1))
|
Hehwang/Leetcode-Python | code/524 Longest Word in Dictionary through Deleting.py | Python | mit | 654 | 0.035168 | class Solution:
def helper(self,target,string):
i,j=0,0
while i<len(target) and j<len(string):
if target[i]==s | tring[j]:
i+=1
j+=1
else:
i+=1
return j==len(string)
def findLongestWord(self, s, d):
"""
:type s: str
| :type d: List[str]
:rtype: str
"""
res=''
for string in d:
if self.helper(s,string):
if len(string)>len(res):
res=string
elif len(string)==len(res) and string<res:
res=string
return res |
imageworks/OpenShadingLanguage | testsuite/example-deformer/run.py | Python | bsd-3-clause | 387 | 0.007752 | #!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
command += run_app ("cmake --config Release data >> build.txt", | silent=True)
command += run_app ("cmake --build . >> build.txt", silen | t=True)
command += run_app ("bin/osldeformer >> out.txt")
|
ncliam/serverpos | openerp/addons/mrp/report/price.py | Python | agpl-3.0 | 11,687 | 0.008129 | # -*- 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... | bom, currency_id, factor=1):
xml = '<row>'
sum = 0
sum_strd = 0
prod = product_pool.browse(cr, uid, bom['product_id'])
prod_name = to_xml(bom['name'])
prod_qtty = factor * bom['product_qty']
product_uom = product_uom_pool.browse(cr, ui... | d_price = '','',''
sellers, sellers_price = '',''
if prod.seller_id:
main_sp_name = '- <b>'+ to_xml(prod.seller_id.name) +'</b>\r\n'
pricelist = prod.seller_id.property_product_pricelist_purchase
price = pricelist_pool.price_get(cr,uid,[pricelist... |
Bugheist/website | website/migrations/0024_userprofile.py | Python | agpl-3.0 | 1,273 | 0.003142 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2017-02-03 14:44
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
def add_profiles(apps, schema_editor):
UserProfile = apps.get_model('website', 'UserProfile')
user_app, user_model = settings.AUT... | ns = [
migrations.CreateModel(
name='UserProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID') | ),
('user_avatar', models.ImageField(blank=True, null=True, upload_to=b'avatars/')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='userprofile',
to=settings.AUTH_USER_MODEL)),
],
... |
izquierdo/django-taggit | setup.py | Python | bsd-3-clause | 1,278 | 0.002347 | from setuptools import find_packages, setup
import taggit
with open('README.rst') as f:
readme = f.read()
setup(
name='django-taggit',
version='.'.join(str(i) for i in taggit.VERSION),
description='django-taggit is a reusable Django application for simple tagging.',
long_description=readme,
... | 'locale/*/LC_MESSAGES/*',
],
},
license='BSD',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environm | ent :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming La... |
zhihaoSong/spring-practices | demo/src/main/java/demo/docker/entry.py | Python | apache-2.0 | 91 | 0.010989 | __author__ | = 'wentian'
test = "123"
print(test)
input_A = input("I | nput: ")
print(input_A) |
anryko/ansible | lib/ansible/modules/network/f5/bigip_device_trust.py | Python | gpl-3.0 | 12,094 | 0.000827 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# 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': '1.1',
... | dress of the t | rusted peer.
returned: changed
type: str
sample: 10.0.2.15
peer_hostname:
description: The remote hostname used to identify the trusted peer.
returned: changed
type: str
sample: test-bigip-02.localhost.localdomain
'''
import re
from ansible.module_utils.basic import AnsibleModule
try:
from library.... |
zas/picard | picard/const/appdirs.py | Python | gpl-2.0 | 1,741 | 0.002298 | # -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2021 Philipp Wolfer
#
# This program is free sof | tware; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is d | istributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; ... |
rabernat/xgcm | xgcm/test/datasets.py | Python | mit | 13,360 | 0.001647 | from __future__ import print_function
from future.utils import iteritems
import pytest
import xarray as xr
import numpy as np
# example from comodo website
# https://web.archive.org/web/20160417032300/http://pycomodo.forge.imag.fr/norm.html
# netcdf example {
# dimensions:
# ni = 9 ;
# ... | riodic_1d_right"])
def periodic_1d(request):
ds, periodic = datasets_with_periodicity[request.param]
return ds, periodic, expected_values[request.param]
@pyt | est.fixture(
scope="module",
params=[
"periodic_2d_left",
"nonperiodic_2d_left",
"xperiodic_2d_left",
"yperiodic_2d_left",
],
)
def all_2d(request):
ds, periodic = datasets_with_periodicity[request.param]
return ds, periodic, expected_values[request.param]
@pytest.f... |
lyft/huxley | huxley/steps.py | Python | apache-2.0 | 6,736 | 0.002227 | # Copyright (c) 2013 Facebook
#
# 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,... | pt('return document.ac | tiveElement.id;')
if id is None or id == '':
run.d.execute_script(
'document.activeElement.id = %r;' % self.KEY_ID
)
id = self.KEY_ID
run.d.find_element_by_id(id).send_keys(self.key)
class ScreenshotTestStep(TestStep):
def... |
Spiderlover/Toontown | toontown/town/TownLoader.py | Python | mit | 16,978 | 0.001944 | from pandac.PandaModules import *
from toontown.battle.BattleProps import *
from toontown.battle.BattleSounds import *
from toontown.distributed.ToontownMsgTypes import *
from toontown.toonbase.ToontownGlobals import *
from direct.gui.DirectGui import cleanupDialog
from direct.directnotify import DirectNotifyGlobal
fro... | self.renameFloorPolys(self.nodeList)
self.createAnimatedProps(self.nodeList)
self | .holidayPropTransforms = {}
|
bigoldboy/repository.bigoldboy | script.tvguide.fullscreen/play.py | Python | gpl-3.0 | 1,273 | 0.007855 | import sys
import xbmc,xbmcaddon
import sqlite3
from vpnapi import VPNAPI
ADDON = xbmcaddon.Addon(id='script.tvguide.fullscreen')
channel = sys.argv[1]
start = sys.argv[2]
path = xbmc.translatePath('special://profile/addon_data/script.tvguide.fullscreen/source.db')
try:
conn = sqlite3.connect(path, detect_types=... | )"):
try:
if ADDON.getSetting('vpnmgr.connect') == "true":
vpndefault = False
if ADDON.getSetting('vpnmgr.default') == "true":
vpndefault = True
api = VPNAPI()
if url[0:9] == 'plugin://':
api.filt... | xecutebuiltin('PlayMedia(%s)' % url) |
kytvi2p/Sigil | src/Resource_Files/plugin_launchers/python/launcher.py | Python | gpl-3.0 | 11,319 | 0.003534 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# Copyright (c) 2014 Kevin B. Hendricks, John Schember, and Doug Massay
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following ... | stream.encoding
self.ps = ps
self.stype = stype
if self.encoding == None:
self.encoding = 'utf-8'
def write(self, data):
if isinstance(data, text_type):
data = data.encode('utf-8')
elif self.encoding not in ['utf-8','UTF-8','cp65001','CP65001']:
... | == 'stdout':
self.ps.stdouttext.append(data)
if PY3:
self.stream.buffer.write(data)
else:
self.stream.write(data)
else:
self.ps.stderrtext.append(data)
def __getattr__(self, attr):
if attr == 'mode':
return '... |
joac/klein | src/klein/__init__.py | Python | mit | 572 | 0.001748 | from __future__ import absolute_import, division
from klein.app import Klein, run, route, resource
from klein._plating import Plating
from ._version import __version__ | as _incremental_version
# Make it a str, for backwards compatibility
__version__ = _incremental_version.base()
__author__ = "The Klein contributors (see AUTHORS)"
__license__ = "MIT"
__copyright__ = "Copyright 2016 {0}".format(__author__)
__all__ = [
'Klein',
'Plating',
'__author__',
'__copyright__... | te',
'run',
]
|
ubuntu/ubuntu-make | tests/data/duplicatedframeworks/samecategory.py | Python | gpl-3.0 | 1,683 | 0.001783 | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Canonical
#
# Authors:
# Didier Roche
#
# 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.
#
# This program is distributed in the hope that ... |
def setup(self, install_path=None, auto_accept_license=False):
super().setup()
def remove(self):
super().remove()
class FrameworkD(umake.frameworks.BaseFramework):
def __init__(self, **kwargs):
super().__init__(name="Framework D", description="Description for framework D",
... | def remove(self):
super().remove()
|
moreandres/bottleneck | setup.py | Python | gpl-2.0 | 1,379 | 0.026831 | #! /usr/bin/env python
import os
from setuptools import setup
readme = os.path.join(os.path.dirname(__file__), 'README.md')
setup(name = 'bottleneck',
version = '0.1.0',
description = 'performance report generator for OpenMP programs in GNU/Linux',
long_description = open(readme).read(),
auth... | ',
'Operating System :: POSIX',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Software Development :: Quality Assurance',
'Topic :: System... | tilities',
],
zip_safe = False,
test_suite = 'tests',
# include_package_data = True,
# install_requires=[ 'numpy', 'scipy', 'matplotlib' ],
)
|
cfelton/minnesota | setup.py | Python | gpl-3.0 | 1,770 | 0.013559 | #
# Copyright (c) 2013 Christopher L. Felton
#
# 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 Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This p... | h this program. If not, see <http://www.gnu.org/licenses/>.
try:
from setuptools import setup
from setuptools import find_packages
except ImportError:
from distutils.core import setup
from pkgutil import walk_packages
impo | rt mn
# many pypy installs don't have setuptools (?)
def _find_packages(path='.', prefix=''):
yield prefix
prefix = prefix + "."
for _, name, ispkg in walk_packages(path,
prefix,
onerror=lam... |
watermelo/libcloud | libcloud/test/loadbalancer/test_dimensiondata.py | Python | apache-2.0 | 26,630 | 0.00154 | # 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 use ... | id='234',
name='test',
state=State.RUNNING,
ip='1.2.3.4',
port=1234,
driver=self.driver,
ext | ra=extra
)
member = Member(
id=None,
ip='112.12.2.2',
port=None,
balancer=balancer,
extra=None)
member = self.driver.balancer_attach_member(balancer, member)
self.assertEqual(member.id, '3dd806a2-c2c8-4c0c-9a4f-5219ea9266c0')
... |
ProjectSWGCore/NGECore2 | scripts/mobiles/spawnareas/dantooine_south_mixed_3.py | Python | lgpl-3.0 | 356 | 0.022472 | # Spawn Area file created with PSWG P | lanetary Spawn Tool
import sys
from java.util import Vector
def addSpawnArea(core):
mixedGroups = Vector()
mixedGroups.add('quenker_lair_group_1')
mixedGroups.add('huurton_lair_group_1')
mixedGroups.add('dantooine_quenker')
core.spawnServic | e.addMixedSpawnArea(mixedGroups, 1495, -3502, 2396, 'dantooine')
return
|
Shalantor/Connect4 | server/matchMakingThread.py | Python | mit | 4,679 | 0.013251 | #This will be the thread responsible for the matchmaking which operates as follows:
#There are four lists where the players are divided into based on their rank.
#List 1 is for ranks 0,1,2.
#List 2 is for ranks 3,4,5.
#List 3 is for ranks 6,7,8.
#List 4 is for ranks 9,10.
#When a player waits for a match too long, this... | mes then do it again
while loopCounter < MAX_LOOPS:
try:
#Get new player and add him to a list according to his rank
newPlayer = inputQueue.get(False)
playerR | ank = newPlayer.get('rank')
listIndex = playerRank // 3
newPlayer['entryTime'] = time.time()
playerList[listIndex].append(newPlayer)
print 'MMTHREAD : Got user '
print 'MMTHREAD: USER RANK IS %d ' % playerRank
except Queue.Empt... |
JacobFischer/Joueur.py | games/stumped/job.py | Python | mit | 3,479 | 0.003162 | # Job: Information about a beaver's job.
# DO NOT MODIFY THIS FILE
# Never try to directly create an instance of this class, or modify its member variables.
# Instead, you should only be reading its variables and calling its functions.
from typing import Optional
from games.stumped.game_object import GameObject
# <<... | f successful, None otherwise.
"""
return self._run_on_server('recruit', | {
'tile': tile
})
# <<-- Creer-Merge: functions -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.
# if you want to add any client side logic (such as state checking functions) this is where you can add them
# <<-- /Creer-Merge: functi... |
net-titech/VidSum | src/packages/aistats-flid/code/functions/dpp.py | Python | mit | 2,448 | 0.001225 | from __future__ import division
from __future__ import print_function
import numpy as np
from scipy.special import expit
import numpy.linalg
from functions.function import Function
class DPP(Function):
def __init__(self, V, K=None):
self.V = V
if K is None:
self.K = np.eye(len(V))
... | )
given = set(given)
n = self.K.shape[0]
K_diag = np.diag(self.K)
diag_idxs = np.diag_indices(n)
K = np.copy(self.K)
probs = np.zeros(len(candidates))
for i, el in enumerate(candidates):
S = list(given.union(set([ | el])))
K[diag_idxs] = K_diag - 1.
K[(diag_idxs[0][S], diag_idxs[1][S])] += 1.
probs[i] = np.abs(np.linalg.det(K))
return candidates[np.argsort(probs)[::-1]]
|
Dunkas12/BeepBoopBot | lib/youtube_dl/extractor/telequebec.py | Python | gpl-3.0 | 1,419 | 0.002819 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
smuggle_url,
)
class TeleQuebecIE(InfoExtractor):
_VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)'
_TEST = {
'url': 'http://zonevideo.telequebec.tv/... | t': {
'id': '20984',
'ext': 'mp4',
'title': 'Le couronnement de New York',
| 'description': 'md5:f5b3d27a689ec6c1486132b2d687d432',
'upload_date': '20160220',
'timestamp': 1455965438,
}
}
def _real_extract(self, url):
media_id = self._match_id(url)
media_data = self._download_json(
'https://mnmedias.api.telequebec.tv/... |
alex-ip/agdc | api/source/test/python/datacube/api/test_query.py | Python | bsd-3-clause | 12,587 | 0.003019 | #!/usr/bin/env python
# ===============================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
... | cube.api.query import list_cells_vector_file_as_list
from datacube.api.query import MONTHS_BY_SEASON, Season
fro | m datacube.api.query import LS7_SLC_OFF_EXCLUSION, LS7_SLC_OFF_ACQ_MIN
from datacube.api.query import LS8_PRE_WRS_2_EXCLUSION, LS8_PRE_WRS_2_ACQ_MAX
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s')
_log = logging.getLogger()
TEST_CELL_X = 120
TEST_CELL_Y = -25
TEST_YEAR = 2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.