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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
from pylab import *
from Simplex_optimization import Simplex
from ClampedCubicSpline import *
from Random_optimization import MCBias_Run,MCBias2_Run
nnodes = 12
nsplines = nnodes + 1
perNode = 10
nsamp = (nsplines)*perNode
Gen= [0.0]*2*nnodes
def R2omega(R):
return sqrt(1.0/R*... | ProkopHapala/SimpleSimulationEngine | python/pySimE/space/exp/OrbitalTransferOpt/OrbOpt_map/OrbitalTransfer_non_uniform.py | Python | mit | 8,038 | 0.046778 |
"""!
@brief Unit-tests for X-Means algorithm.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
import unittest
# Generate images without having a window appear.
import matplotlib
matplotlib.use('Agg')
from pyclustering.cluster.tests.xmeans_templates im... | annoviko/pyclustering | pyclustering/cluster/tests/unit/ut_xmeans.py | Python | gpl-3.0 | 23,984 | 0.004128 |
from django.conf import settings
import requests
import logging
graphite_api = settings.GRAPHITE_API
user = settings.GRAPHITE_USER
password = settings.GRAPHITE_PASS
graphite_from = settings.GRAPHITE_FROM
auth = (user, password)
def get_data(target_pattern):
resp = requests.get(
graphite_api + 'render', a... | BillGuard/cabot | cabot/cabotapp/graphite.py | Python | mit | 2,507 | 0.000399 |
from __future__ import unicode_literals
from .abc import ABCIE
from .abc7news import Abc7NewsIE
from .academicearth import AcademicEarthCourseIE
from .addanime import AddAnimeIE
from .adobetv import AdobeTVIE
from .adultswim import AdultSwimIE
from .aftonbladet import AftonbladetIE
from .aljazeera import AlJazeeraIE
f... | rzhxeo/youtube-dl | youtube_dl/extractor/__init__.py | Python | unlicense | 17,033 | 0.000059 |
"""This Cloud Function leverages Looker Python SDK to manage user provision.
It takes an email address as an input, then checks if this email has been
associated with an existing Looker user. If a current user is found, then an
email to reset the password will be sent. Otherwise, a new user will be created,
and a s... | looker-open-source/sdk-codegen | examples/python/cloud-function-user-provision/main.py | Python | mit | 4,360 | 0.016743 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create the RenderWindow, Renderer and both Actors
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetR... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Rendering/Core/Testing/Python/CamBlur.py | Python | gpl-3.0 | 1,969 | 0.00965 |
# coding=utf-8
"""
Collect the elasticsearch stats for the local node
#### Dependencies
* urlib2
"""
import urllib2
import re
try:
import json
json # workaround for pyflakes issue #13
except ImportError:
import simplejson as json
import diamond.collector
RE_LOGSTASH_INDEX = re.compile('^(.*)-\d\d\... | metamx/Diamond | src/collectors/elasticsearch/elasticsearch.py | Python | mit | 11,323 | 0.001148 |
# coding: utf8
# lingoesparse.py
# 1/15/2013 jichi
#
# LD2 and LDX
# http://code.google.com/p/lingoes-extractor/source/browse/trunk/src/cn/kk/extractor/lingoes/LingoesLd2Extractor.java
# https://code.google.com/p/dict4cn/source/browse/trunk/importer/src/LingoesLd2Reader.java
# http://devchina.wordpress.com/2012/03/01/l... | Dangetsu/vnr | Frameworks/Sakura/py/libs/lingoes/lingoesparse.py | Python | gpl-3.0 | 6,775 | 0.020245 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | covrom/django_sample | mysite/mysite/settings.py | Python | mit | 3,237 | 0.002162 |
# wpa_supplicant control interface
# Copyright (c) 2014, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
from remotehost import remote_compatible
import logging
logger = logging.getLogger()
import os
import socket
import subprocess
import t... | s0lst1c3/eaphammer | local/hostapd-eaphammer/tests/hwsim/test_wpas_ctrl.py | Python | gpl-3.0 | 96,304 | 0.00216 |
import copy
import logging
from great_expectations.datasource.data_connector.configured_asset_sql_data_connector import (
ConfiguredAssetSqlDataConnector,
)
from great_expectations.datasource.new_datasource import BaseDatasource
logger = logging.getLogger(__name__)
class SimpleSqlalchemyDatasource(BaseDatasourc... | great-expectations/great_expectations | great_expectations/datasource/simple_sqlalchemy_datasource.py | Python | apache-2.0 | 3,666 | 0.002182 |
"""Support for information from HP iLO sensors."""
from datetime import timedelta
import logging
import hpilo
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_HOST,
CONF_MONITORED_VARIABLES,
CONF_NAME,
CONF_PASSWORD,
CONF_P... | leppa/home-assistant | homeassistant/components/hp_ilo/sensor.py | Python | apache-2.0 | 6,330 | 0.000316 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'builder.ui'
#
# Created: Mon May 22 10:30:45 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_pandapower(object):
def setupUi(s... | Tooblippe/pandapower_gui | resources/ui/builder.py | Python | bsd-3-clause | 35,136 | 0.00296 |
import os
from gzip import GzipFile
from io import BytesIO
import numpy as np
from .tools import download_with_progress_bar
from . import get_data_home
DATA_URL = ('https://github.com/astroML/astroML-data/raw/main/datasets/'
'ADR3.dat.gz')
ARCHIVE_FILE = 'moving_objects.npy'
ADR4_dtype = [('moID', 'a6')... | astroML/astroML | astroML/datasets/moving_objects.py | Python | bsd-2-clause | 4,948 | 0 |
from __future__ import unicode_literals
from datetime import date, time, datetime
import unittest
from django.utils.dateparse import parse_date, parse_time, parse_datetime
from django.utils.timezone import get_fixed_timezone
class DateParseTests(unittest.TestCase):
def test_parse_date(self):
# Valid in... | diegoguimaraes/django | tests/utils_tests/test_dateparse.py | Python | bsd-3-clause | 2,232 | 0.003584 |
from config import Config
from models.usuario import Usuario
class Administrador:
tabla = "administradores"
def __init__(self, identificador):
self.id = identificador
self.privilegios = Usuario.getTipo(self.id)
'''
#actualizar (se puede actualizar un administrador actualizando como usuario)
def save(self):
... | carojasq/Evaluaciones-bases-de-datos-2 | models/administrador.py | Python | mit | 3,310 | 0.038671 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/subnet_association.py | Python | mit | 1,260 | 0 |
class Boleto:
def __init__(self, ano_mes, vencimento, mensalidade, dependencia, desconto, liquido, situacao):
self.ano_mes = ano_mes
self.vencimento = vencimento
self.mensalidade = mensalidade
self.dependencia = dependencia
self.desconto = desconto
self.liquido = liqu... | SamuelTM/univapi | stm/univapi/modelos/boleto.py | Python | mit | 357 | 0.002801 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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
#... | wrouesnel/ansible | lib/ansible/modules/cloud/ovirt/ovirt_hosts.py | Python | gpl-3.0 | 22,692 | 0.001719 |
# Copyright 2022 The Brax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | google/brax | brax/envs/env.py | Python | apache-2.0 | 2,766 | 0.011931 |
'''
The idea is that we record the commands sent to the debugger and reproduce them from this script
(so, this works as the client, which spawns the debugger as a separate process and communicates
to it as if it was run from the outside)
Note that it's a python script but it'll spawn a process to r... | JDSchmitzMedia/pydev | pysrc/tests_python/test_debugger.py | Python | epl-1.0 | 30,357 | 0.013605 |
__source__ = 'https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/verify-preorder-sequence-in-binary-search-tree.py
# Time: O(n)
# Space: O(1)]
# Stack
#
# Description: Leetcode # 255. Verify Preorder Sequence in Binary Se... | JulyKikuAkita/PythonPrac | cs15211/VerifyPreorderSequenceinBinarySearchTree.py | Python | apache-2.0 | 4,042 | 0.003711 |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
This script generates Finnish omorfi database to lexc format, given that
they contain at least following information for each word:
* the word lemma or the dictionary form
* the word inflection classification in one of the known format.
Additional data may be av... | redox-alpha/omorfi | src/python/generate-lexcs.py | Python | gpl-3.0 | 14,293 | 0.00063 |
import sys
import copy
import functools
import datetime
import decimal
from functools import update_wrapper
from inspect import getargspec
from django import forms
from django.utils.encoding import force_unicode
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import Val... | cgcgbcbc/django-xadmin | xadmin/views/base.py | Python | bsd-3-clause | 20,760 | 0.001541 |
from test_utils import testCaseSetUp
from test_utils import testCaseTearDown
from test_utils import getUnitTestUserEmail
from src.models import Host
from src.models import Link
from src.models import UserHasLink
from src.memcache_utils import MemCacheKeyGen
from src.error_message import ErrorMessages
import urllib2
i... | cloud-io/CloudUp | tests/test_my_views.py | Python | mit | 8,048 | 0.003106 |
from enum import Enum
# Message Enums
#
class MessageType(Enum):
GenericDevice = 0
GenericPiezo = 1
GenericMotor = 2
GenericDCMotor = 3
GenericSimpleMotor = 4
RackDevice = 5
Laser = 6
TECCtlr = 7
Quad = 8
NanoTrak = 9
Specialized = 10
Solenoid = 11
class GenericDevice... | mabuchilab/Instrumental | instrumental/drivers/motion/_kinesis/common.py | Python | gpl-3.0 | 2,398 | 0.002085 |
# 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... | ghchinoy/tensorflow | tensorflow/contrib/learn/python/learn/datasets/base.py | Python | apache-2.0 | 8,304 | 0.006142 |
#!/usr/bin/env python
# coding: utf-8
import re
import sys
import typing
import time
from collections import OrderedDict, abc
""" A Python implementation for java.util.Properties """
__all__ = ['Properties']
# Constants ###################################################################
###########################... | wangyifan1985/sampan | sampan/properties.py | Python | mit | 5,148 | 0.00136 |
from __future__ import absolute_import, division, unicode_literals
import unittest
import mock
from cola.models import selection
class SelectionTestCase(unittest.TestCase):
def test_union(self):
t = mock.Mock()
t.staged = ['a']
t.unmerged = ['a', 'b']
t.modified = ['b', 'a', 'c'... | javierrodriguezcuevas/git-cola | test/models_selection_test.py | Python | gpl-2.0 | 515 | 0 |
from redwind import app, db, util
from redwind.models import Post
import itertools
db.engine.execute('alter table post add column historic_path varchar(256)')
db.engine.execute('update post set historic_path = path')
for post in Post.query.all():
print(post.historic_path)
if not post.slug:
post.slug =... | thedod/redwind | migrations/20141017-permalinks.py | Python | bsd-2-clause | 531 | 0 |
# enigma2 reactor: based on pollreactor, which is
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Maintainer: U{Felix Domke<mailto:tmbinc@elitedvb.net>}
"""
# System imports
import select, errno, sys
# Twisted imports
from twisted.python import log, failure
from twisted.interne... | ACJTeam/enigma2 | e2reactor.py | Python | gpl-2.0 | 5,223 | 0.036378 |
import maya.cmds as cmds
def setRenderGlobals():
"""
Sets the base defaults for the renderglobals for playblasting.
"""
print 'Set your custom renderglobals here for playblasting.' | jamesbdunlop/tk-jbd-submit-mayaplayblast | python/lib/renderGlobals.py | Python | apache-2.0 | 197 | 0.010152 |
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | jcsp/manila | manila/api/openstack/wsgi.py | Python | apache-2.0 | 44,832 | 0.000022 |
#!/usr/bin/env python
from flask.ext.script import Manager
from flask_frozen import Freezer
import discovery
import logging
out = logging.StreamHandler()
out.setFormatter(logging.Formatter())
out.setLevel(logging.DEBUG)
logging.getLogger('freepto-web').setLevel(logging.INFO)
logging.getLogger('freepto-web').addHandler... | vinc3nt/freepto-web | manage.py | Python | gpl-2.0 | 842 | 0.002375 |
#!/usr/bin/python
import logging
import os
import re
import shlex
import shutil
import signal
import subprocess
import sys
import time
def non_zero_min(values):
"Return the min value but always prefer non-zero values if they exist"
if len(values) == 0:
raise TypeError('non_zero_min expected 1 argumen... | andymccurdy/tested-transcoder | transcoder.py | Python | mit | 12,971 | 0.000463 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import with_statement
from collections import defaultdict
from copy import deepcopy
import axiom_rules
import fact_groups
import instantiate
import pddl
import sas_tasks
import simplify
import timers
# TODO: The translator may generate trivial derived v... | dpattiso/igraph | lama/translate/translate_old.py | Python | gpl-2.0 | 31,909 | 0.007083 |
from ark.tasks.task_check_for_update import Task_CheckForUpdates
from ark.tasks.task_list_players import Task_ListPlayers
from ark.tasks.task_get_chat import Task_GetChat
from ark.tasks.task_daily_restart import Task_DailyRestart
from ark.tasks.task_daily_restart import Task_DailyRestartRepopulate
from ark.tasks.task_s... | f4ble/Arkon | configs/tasks_default.py | Python | apache-2.0 | 707 | 0.007072 |
import sys
import praw
import unicodedata
user_agent='bloppit_app'
if len(sys.argv) == 2:
script, filename, subreddit = argv
else:
subreddit = "opensource"
filename = subreddit + ".txt"
r = praw.Reddit(user_agent)
submissions = r.get_subreddit(subreddit).get_hot(limit=100)
target = open(filename, 'w')
for x in... | asears/bloppit | gethot.py | Python | mit | 547 | 0.02925 |
'''
Created on Feb 4, 2017
@author: Jake
'''
import numpy as np
import random
import Population
class Connection(object):
inNeuron = None
outNeuron = None
weight = None
enabled = None
ID = None
def __init__(self,ID,inNeuron,outNeuron,weight,enabled = True):
self.inNeuron = inNeuron... | JakeShulman/G-Neat | Connection.py | Python | apache-2.0 | 1,393 | 0.045226 |
#
# Copyright (c) SAS Institute, 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 ... | sassoftware/mirrorball | updatebot/artifactory.py | Python | apache-2.0 | 11,601 | 0.000603 |
from functools import reduce
def vartype(var):
if var.is_discrete:
return 1
elif var.is_continuous:
return 2
elif var.is_string:
return 3
else:
return 0
def progress_bar_milestones(count, iterations=100):
return set([int(i*count/float(iterations)) for i in range(i... | marinkaz/orange3 | Orange/widgets/utils/__init__.py | Python | bsd-2-clause | 811 | 0.004932 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class EventType(models.Model):
_inherit = "event.type"
community_menu = fields.Boolean(
"Community Menu", compute="_compute_community_menu",
readonly=False,... | ygol/odoo | addons/website_event_track_online/models/event_type.py | Python | agpl-3.0 | 551 | 0 |
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
import base64
from typing import List
from xdrlib import Packer, Unpacker
from ..type_checked import type_checked
from .ledger_header_history_entry import LedgerHeaderHistoryEntry
from .scp_history_entry import SCPHistoryEntry
... | StellarCN/py-stellar-base | stellar_sdk/xdr/ledger_close_meta_v0.py | Python | apache-2.0 | 5,160 | 0.000581 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | jirikuncar/invenio-ext | tests/test_ext_registry.py | Python | gpl-2.0 | 2,613 | 0 |
from models import Connection
from django import forms
class ConnectionForm(forms.ModelForm):
class Meta:
model = Connection
exclude = ('d_object_id',)
| CIGNo-project/CIGNo | cigno/mdtools/forms.py | Python | gpl-3.0 | 173 | 0.00578 |
# Copyright 2011 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... | e0ne/cinder | cinder/api/contrib/volume_transfer.py | Python | apache-2.0 | 8,571 | 0 |
__author__ = 'sweemeng'
from rest_framework import status
from popit.signals.handlers import *
from popit.models import *
from popit.tests.base_testcase import BasePopitAPITestCase
class PersonLinkAPITestCase(BasePopitAPITestCase):
def test_view_person_link_list_unauthorized(self):
response = self.client... | Sinar/popit_ng | popit/tests/test_person_misc_api.py | Python | agpl-3.0 | 32,087 | 0.002961 |
from lcs.strategies.subsumption import does_subsume
def add_classifier(child, population, new_list, theta_exp: int) -> None:
"""
Looks for subsuming / similar classifiers in the population of classifiers
and those created in the current ALP run (`new_list`).
If a similar classifier was found it's qua... | ParrotPrediction/pyalcs | lcs/strategies/anticipatory_learning_process.py | Python | mit | 1,363 | 0 |
#
# Copyright (c) 2008--2020 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | shastah/spacewalk | spacewalk/certs-tools/rhn_bootstrap_strings.py | Python | gpl-2.0 | 16,095 | 0.001864 |
#!/usr/bin/env python3
# Copyright (C) 2013-2018 Samuel Damashek, Peter Foley, James Forcier, Srijay Kasturi, Reed Koser, Christopher Reffett, and Tris Wilson
#
# 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 Softwa... | tjcsl/cslbot | bot.py | Python | gpl-2.0 | 1,125 | 0.001778 |
import json
import struct
import os
origen = open("./FK.ind", "rb")
destino = open("./extra_data","w")
origen.read(256 + 7) # saco header
cantidad_mapas = struct.unpack('<H', (origen.read(2)))[0] # l1
x = 1
while (x < cantidad_mapas +1):
# numero X = numero de mapa
lluvia = struct.unpack('<B', (origen.read(1)))... | horacioMartinez/dakara-client | tools/misc/traductor de indices y mapas/mapas/extra_data_generator/lluvia_extra_data_generator.py | Python | mit | 601 | 0.028286 |
#!/usr/bin/env venv/bin/python
__author__ = 'dimv36'
from webtests import app
if __name__ == "__main__":
app.debug = True
app.run() | dimV36/webtests | run.py | Python | gpl-2.0 | 141 | 0.007092 |
#pylint: disable=C0301, C0103, W0212
"""
.. module:: radical.pilot.scheduler.Interface
:platform: Unix
:synopsis: The abstract interface class for all schedulers.
.. moduleauthor:: Ole Weidner <ole.weidner@rutgers.edu>
"""
__copyright__ = "Copyright 2013-2014, http://radical.rutgers.edu"
__license__ = "MIT"
... | JensTimmerman/radical.pilot | src/radical/pilot/scheduler/interface.py | Python | mit | 2,025 | 0.014321 |
# -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... | mrquim/repository.mrquim | script.module.pycryptodome/lib/Crypto/Hash/SHA1.py | Python | gpl-2.0 | 3,063 | 0.003265 |
"""Sparse Equations and Least Squares.
The original Fortran code was written by C. C. Paige and M. A. Saunders as
described in
C. C. Paige and M. A. Saunders, LSQR: An algorithm for sparse linear
equations and sparse least squares, TOMS 8(1), 43--71 (1982).
C. C. Paige and M. A. Saunders, Algorithm 583; LSQR: Sparse... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/utils/_scipy_sparse_lsqr_backport.py | Python | mit | 18,021 | 0.000388 |
from enigma import ePicLoad, eTimer, getDesktop, gMainDC, eSize
from Screens.Screen import Screen
from Tools.Directories import resolveFilename, pathExists, SCOPE_MEDIA, SCOPE_CURRENT_SKIN
from Components.Pixmap import Pixmap, MovingPixmap
from Components.ActionMap import ActionMap, NumberActionMap
from Components.So... | kingvuplus/ops | lib/python/Plugins/Extensions/PicturePlayer/ui.py | Python | gpl-2.0 | 22,711 | 0.027211 |
# -*- coding: utf-8 -*-
"""
If you know error code, use `get_for_code(code)` to retrieve exception instance.
"""
__all__ = ['Success', 'InvalidOperation', 'HostNotFound', 'ConnectionRefused',
'SendError', 'ReceiveError', 'RecordExists', 'RecordNotFound',
'MiscellaneousError', 'get_for_code']
c... | neithere/pyrant | pyrant/exceptions.py | Python | apache-2.0 | 1,671 | 0.007181 |
from aces.materials.POSCAR import structure as Material
class structure(Material):
def getPOSCAR(self):
return self.getMinimized()
def csetup(self):
from ase.dft.kpoints import ibz_points
#self.bandpoints=ibz_points['hexagonal']
import numpy as np
x=0.5*np.cos(np.arange(8)/8.0*2.0*np.pi)
y=0.5*np... | vanceeasleaf/aces | aces/materials/MoN2_alpha_rect.py | Python | gpl-2.0 | 1,320 | 0.036364 |
import flask
from ..app import bokeh_app
## This URL heirarchy is important, because of the way we build bokehjs
## the source mappings list the source file as being inside ../../src
@bokeh_app.route('/bokehjs/static/<path:filename>')
def bokehjs_file(filename):
""" Return a specific BokehJS deployment file
... | almarklein/bokeh | bokeh/server/views/statics.py | Python | bsd-3-clause | 844 | 0.004739 |
# Commands
# License {{{1
# Copyright (C) 2016-2022 Kenneth S. Kundert
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... | KenKundert/avendesora | avendesora/command.py | Python | gpl-3.0 | 59,621 | 0.001275 |
from django.conf.urls import url
from .views import OrderReturnView, StatusChangedNotificationView
urlpatterns = [
url(r'^return/$', OrderReturnView.as_view(), name='return_url'),
url(r'^update_order/$', StatusChangedNotificationView.as_view(), name='status_changed'),
]
| edoburu/django-oscar-docdata | oscar_docdata/urls.py | Python | apache-2.0 | 281 | 0.003559 |
import re
from .common import InfoExtractor
class TrailerAddictIE(InfoExtractor):
_VALID_URL = r'(?:http://)?(?:www\.)?traileraddict\.com/(?:trailer|clip)/(?P<movie>.+?)/(?P<trailer_name>.+)'
_TEST = {
u'url': u'http://www.traileraddict.com/trailer/prince-avalanche/trailer',
u'file': u'76184.... | ashutosh-mishra/youtube-dl | youtube_dl/extractor/traileraddict.py | Python | unlicense | 2,278 | 0.00878 |
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': 'Analytic Plan-Actual Analysis',
'version': '10.0.1.1.0',
'author': 'Eficent, Odoo Community Association (OCA),'
'Proje... | sysadminmatmoz/pmis | analytic_plan_analysis/__manifest__.py | Python | agpl-3.0 | 633 | 0 |
# -*- coding: utf-8 -*-
from flask import Flask,request, jsonify
from dbmanager import Database
db = Database()
db.start_engine()
app = Flask(__name__)
@app.route('/api/v1.0/data',methods=['GET','POST'])
def index():
if request.method == 'GET':
#Fetch data
username = request.args.get('... | mreider/multi-user-encryption | app.py | Python | mit | 1,685 | 0.020178 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "downloadmusic.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| irvingprog/gmusic | manage.py | Python | lgpl-3.0 | 256 | 0 |
"""Constants for Sonarr."""
DOMAIN = "sonarr"
# Config Keys
CONF_BASE_PATH = "base_path"
CONF_DAYS = "days"
CONF_INCLUDED = "include_paths"
CONF_UNIT = "unit"
CONF_UPCOMING_DAYS = "upcoming_days"
CONF_WANTED_MAX_ITEMS = "wanted_max_items"
# Data
DATA_HOST_CONFIG = "host_config"
DATA_SONARR = "sonarr"
DATA_SYSTEM_STAT... | rohitranjan1991/home-assistant | homeassistant/components/sonarr/const.py | Python | mit | 436 | 0 |
import json
import sure # noqa # pylint: disable=unused-import
import moto.server as server
from moto import mock_timestreamwrite
@mock_timestreamwrite
def test_timestreamwrite_list():
backend = server.create_backend_app("timestream-write")
test_client = backend.test_client()
headers = {"X-Amz-Target":... | spulec/moto | tests/test_timestreamwrite/test_server.py | Python | apache-2.0 | 514 | 0 |
from core import ungzip
from core import ungzip_html
| mutarock/python-utils | compress/__init__.py | Python | mit | 53 | 0 |
# Copyright (c) 2018 Red Hat, Inc.
#
# This file is part of ARA: Ansible Run Analysis.
#
# ARA 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 l... | dmsimard/ara | ara/clients/offline.py | Python | gpl-3.0 | 3,306 | 0.00121 |
# -*- coding: iso-8859-15 -*-
# -*- Mode: Python; py-ident-offset: 4 -*-
# vim:ts=4:sw=4:et
# Copyright (c) M�rio Morgado
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retai... | yasharmaster/scancode-toolkit | src/packagedcode/pyrpm/rpm.py | Python | apache-2.0 | 10,566 | 0.001136 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import sys
import time
import pytest
try:
import yajl
except ImportError:
yajl = None
try:
import simplejson
except ImportError:
simplejson = None
try:
import json
except ImportError:
json = None
try:
import rapidjson
except I... | thedrow/cyrapidjson | tests/test_benchmarks.py | Python | bsd-3-clause | 7,481 | 0.000544 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class URLItem(scrapy.Item):
url = scrapy.Field()
protocol = scrapy.Field()
domain = scrapy.Field()
path = scrapy.Field()
page = scra... | vhazali/cs5331 | assignment3/crawler/items.py | Python | mit | 747 | 0.002677 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | majetideepak/arrow | dev/archery/archery/utils/command.py | Python | apache-2.0 | 2,217 | 0 |
lol = []
vvs = []
with open("yeast2000.txt") as the_file:
first = True
idx = 0
cnt = 0
lcnt = 0
var = []
for line in the_file:
ll = [item.strip() for item in line.split()]
lcnt += 1
if first:
lol.append(ll[:len(ll)-2])
first = False
continue
var.append(ll)
cnt += 1
if cnt == 200:
cnt = 0... | verdverm/pypge | pypge/benchmarks/yeast.py | Python | mit | 719 | 0.037552 |
"""
DotStar_Emulator
config.py in current working directory will be automatically read and loaded.
Author: Christopher Ross
License: MIT Something Rather
"""
from DotStar_Emulator.manage import manage
if __name__ == "__main__":
manage()
| chrisrossx/DotStar_Emulator | DotStar_Emulator/emulator/init/manage.py | Python | mit | 245 | 0 |
import scurve.progress as progress
import StringIO
class TestInplace:
def test_basic(self):
s = StringIO.StringIO()
c = progress.Inplace(stream=s)
assert s.getvalue() == ''
c.tick(10)
assert s.getvalue() == '\r10'
c.tick(10000)
assert s.getvalue() == '\r10... | butterworth1492/Visualizing-Cavity-Viruses | scurve/test/test_progress.py | Python | bsd-2-clause | 748 | 0.005348 |
# Copyright 2015 PLUMgrid, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | openstack/networking-plumgrid | networking_plumgrid/neutron/plugins/drivers/fake_plumlib.py | Python | apache-2.0 | 5,565 | 0 |
from __future__ import print_function
import sys
import os
# from setuptools import Distribution
from pkg_resources import get_distribution, working_set, VersionConflict
def samefile(path, other):
"""
Workaround for missing ``os.path.samefile`` in Windows Python 2.7.
"""
return os.path.normcase(os.p... | userzimmermann/zetup.py | setup.py | Python | lgpl-3.0 | 2,147 | 0.000466 |
import logging
from pymongo import MongoClient
import json
from bson import json_util
import time
import datetime
logger = logging.getLogger(__name__)
class UIPusher:
def __init__(self,core,parm):
# register event handler
core.registerEventHandler("controlleradapter", self.controllerHandler)
# register webso... | starbops/OpenADM | core/src/floodlight_modules/uipusher.py | Python | gpl-2.0 | 6,838 | 0.041533 |
# Copyright (C) 2010 Canonical
#
# Authors:
# Didier Roche <didrocks@ubuntu.com>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 3.
#
# This program is distributed in the hope that it... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/oneconf/packagesethandler.py | Python | gpl-3.0 | 6,034 | 0.008452 |
from pyramid.security import ALL_PERMISSIONS, Allow, Authenticated
from .models import DBSession, Distro, Package, Upstream, User
from uptrack.schemas import DistroSchema, UpstreamSchema, UserSchema
resources = {}
class RootFactory(object):
__name__ = 'RootFactory'
__parent__ = None
__acl__ = [(Allow, ... | network-box/uptrack | uptrack/resources.py | Python | agpl-3.0 | 1,492 | 0 |
# In the 20x20 grid below, four numbers along a diagonal line have been marked in red.
# 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
# 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
# 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
# 52 70 95 23 04 60 11 42 69 24 68 56 01 32 56... | cloudzfy/euler | src/11.py | Python | mit | 3,512 | 0.004841 |
#!/usr/bin/env python
"""
<Program Name>
formats.py
<Author>
Geremy Condra
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
Refactored April 30, 2012. -vladimir.v.diaz
<Copyright>
See LICENSE for licensing information.
<Purpose>
A central location for all format-related checking of TUF objects.
No... | team-ferret/pip-in-toto | pip/toto/ssl_crypto/formats.py | Python | mit | 25,848 | 0.013966 |
# coding=utf-8
from __future__ import unicode_literals
from django.contrib.auth.models import User
from rest_framework import serializers
__author__ = 'ad'
__date__ = '20/08/16'
class SignInSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('username', 'password')
... | ad-lebedev/django-todo-rest | todo-project/todo_api/serializers.py | Python | mit | 359 | 0 |
import copy
import types
from django.core.urlresolvers import reverse
from django.db.models.query import QuerySet
registry = []
def register(*args):
"""
Register urls, views, model instances and QuerySets to be potential
pages for menu items.
Example::
import simplemenu
simpleme... | elpaso/django-simplemenu | simplemenu/pages.py | Python | bsd-3-clause | 2,730 | 0.003663 |
'''
Created on 24.10.2011
@author: michi
'''
from PyQt4.QtCore import QObject, QMutexLocker
from landmarkabstractrequest import LandmarkAbstractRequest #@UnresolvedImport
from landmarkfilter import LandmarkFilter #@UnresolvedImport
class LandmarkFetchRequest(LandmarkAbstractRequest):
'''
The QLandmarkFetchR... | mtils/ems | ems/qt4/location/landmarks/landmarkfetchrequest.py | Python | mit | 4,739 | 0.009074 |
import datetime
import time
import os
import json
import re
import psycopg2 as dbapi2
from flask import Flask
from flask import redirect
from flask import request
from flask import render_template
from flask.helpers import url_for
from store import Store
from fixture import *
from sponsors import *
from championship i... | itucsdb1509/itucsdb1509 | server.py | Python | gpl-3.0 | 27,509 | 0.00927 |
import os.path
from PyQt4 import QtCore, QtGui
import vlc.vlc as vlc
class MovieData:
libvlc = vlc.Instance(["--no-audio","--no-xlib"])
def __init__(self, basePath, dict):
self.basePath = basePath
self.data = dict
# load poster pixmap
PngBase64 = "data:image/png;base64... | mmpi/SvgPresenter | qt/movie/MovieData.py | Python | gpl-3.0 | 1,178 | 0.011036 |
from django.test import TestCase
from django.db import DataError
from django.db import IntegrityError
from pizzaplace.models import PizzaPlace
class TestPizzaPlace(TestCase):
def setUp(self):
self.prince_street_pizza_url = 'https://www.yelp.com/biz/prince-st-pizza-new-york'
self.pizza_name1 = 'Such Pizza'... | nicole-a-tesla/meetup.pizza | pizzaplace/tests/test_pizza_place.py | Python | mit | 1,885 | 0.008488 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redist... | adrienpacifico/openfisca-france-data | openfisca_france_data/tests/test_yaml.py | Python | agpl-3.0 | 14,154 | 0.01194 |
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
# Authors: Christoph Klein
# Contributors:
#
# MDTraj is free software: yo... | swails/mdtraj | mdtraj/tests/test_xyz.py | Python | lgpl-2.1 | 3,492 | 0.002577 |
# Timed mute: !tm <player> <seconds> <reason>
# default time 5 minutes, default reason None
# by topologist June 30th 2012
from scheduler import Scheduler
from commands import add, admin, get_player, join_arguments, name
@name('tm')
@admin
def timed_mute(connection, *args):
protocol = connection.protocol
... | Architektor/PySnip | contrib/scripts/timedmute.py | Python | gpl-3.0 | 1,733 | 0.021927 |
#!/usr/bin/env python3
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import numpy as np
np.set_printoptions(threshold=np.nan)
import tensorflow as tf
import time
# seeding for debug purposes --- dont forget to remove
SEED = 12345
np.random.seed(SEED)
tf.set_random_seed(SEED)
def convolve_inner_layers(x, W, b):
... | michaelneuder/image_quality_analysis | bin/nets/old/pixel_diff_conv_net_automated.py | Python | mit | 5,287 | 0.015131 |
# Copyright (c) 2019 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 appli... | tensor-tang/Paddle | python/paddle/fluid/tests/unittests/test_parallel_executor_seresnext_base_cpu.py | Python | apache-2.0 | 1,446 | 0 |
from flask import Blueprint, request, jsonify, current_app
from alerta.app.utils.api import absolute_url
from alerta.app.exceptions import ApiError
api = Blueprint('api', __name__)
from . import alerts, blackouts, customers, heartbeats, keys, permissions, users, oembed
@api.before_request
def only_json():
if ... | satterly/alerta5 | alerta/app/views/__init__.py | Python | apache-2.0 | 939 | 0.007455 |
"""
Configure URL endpoints for the djangoapp
"""
from django.urls import re_path
from django.conf import settings
from .views import CombinedDiscussionsConfigurationView, DiscussionsConfigurationSettingsView, DiscussionsProvidersView
urlpatterns = [
re_path(
fr'^v0/{settings.COURSE_KEY_PATTERN}$',
... | eduNEXT/edx-platform | openedx/core/djangoapps/discussions/urls.py | Python | agpl-3.0 | 752 | 0.00133 |
#
# Copyright (C) 2004 SIPfoundry Inc.
# Licensed by SIPfoundry under the GPL license.
#
# Copyright (C) 2004 SIP Forum
# Licensed to SIPfoundry under a Contributor Agreement.
#
#
# This file is part of SIP Forum User Agent Basic Test Suite which
# belongs to the SIP Forum Test Framework.
#
# SIP Forum User Agent Basic... | VoIP-co-uk/sftf | UserAgentBasicTestSuite/case202.py | Python | gpl-2.0 | 4,465 | 0.018365 |
__all__ = []
| commonsmachinery/rdf_metadata | src/RDFMetadata/test/__init__.py | Python | gpl-2.0 | 14 | 0 |
#!/usr/bin/env python3
'''
.train <train station>
get irish rail train state times
'''
import requests
import re
from operator import itemgetter
from xml.etree import ElementTree
from formatting import *
__author__ = 'izaakf'
COMMAND = 'train'
NAMESPACES = {'realtime': 'http://api.irishrail.ie/realtime/'}
REALTIME... | sentriz/steely | steely/plugins/train.py | Python | gpl-3.0 | 2,407 | 0.001248 |
# What should be exported from module
from download_music import run_midi_load
| MikhailMS/Final_Project | download_music/__init__.py | Python | bsd-2-clause | 79 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.