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 |
|---|---|---|---|---|---|---|
from sqlalchemy.schema import Column
from sqlalchemy.types import Integer
from sqlalchemy.sql.expression import select, func
from openspending.core import db
from openspending.model.attribute import Attribute
from openspending.model.common import TableHandler, ALIAS_PLACEHOLDER
from openspending.model.constants import... | USStateDept/FPA_Core | openspending/model/dimension.py | Python | agpl-3.0 | 20,686 | 0.00116 |
import os, h5py, numpy
from scipy.sparse import csc_matrix
import ml2h5.task
from ml2h5 import VERSION_MLDATA
from ml2h5.converter import ALLOWED_SEPERATORS
class BaseHandler(object):
"""Base handler class.
It is the base for classes to handle different data formats.
It implicitely handles HDF5.
@c... | open-machine-learning/mldata-utils | ml2h5/converter/basehandler.py | Python | gpl-3.0 | 11,241 | 0.006939 |
"""Tomography with TV regularization using the ProxImaL solver.
Solves the optimization problem
min_{0 <= x <= 1} ||A(x) - g||_2^2 + 0.2 || |grad(x)| ||_1
Where ``A`` is a parallel beam forward projector, ``grad`` the spatial
gradient and ``g`` is given noisy data.
"""
import numpy as np
import odl
import prox... | kohr-h/odl | examples/solvers/proximal_lang_tomography.py | Python | mpl-2.0 | 2,158 | 0 |
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root@localhost:3306/microblog'
SQLALCHEMY_TRACK_MODIFICATIONS = False
REDIS_HOST = 'localhost'
REDIS_PORT = 6379
DEBUG = False
| yejianye/microblog | asura/conf/dev.py | Python | mit | 170 | 0 |
import sqlite3
from datetime import datetime
from pprint import pprint
import sys
import numpy as np
conn = sqlite3.connect('C:/projects/dbs/SP2_data.db')
c = conn.cursor()
#sp2b_file TEXT, eg 20120405x001.sp2b
#file_index INT,
#instr TEXT, eg UBCSP2, ECSP2
#instr_locn TEXT, eg WHI, DMT, POLAR6
#parti... | annahs/atmos_research | sqlite_test.py | Python | mit | 1,520 | 0.028289 |
"""The tests for the notify yessssms platform."""
import logging
import unittest
from unittest.mock import patch
import pytest
import requests_mock
from homeassistant.components.yessssms.const import CONF_PROVIDER
import homeassistant.components.yessssms.notify as yessssms
from homeassistant.const import CONF_PASSWOR... | leppa/home-assistant | tests/components/yessssms/test_notify.py | Python | apache-2.0 | 12,228 | 0.001063 |
#!/usr/bin/env python
import json
import sys
import os
from bottle import route, run, get
import time
import httplib
server = "127.0.0.1"
statport = "18081"
host = "%s:18001" % server
staturl = "http://%s:%s/status" % (server,statport)
blob = {"id": "bar", "url": staturl}
data = json.dumps(blob)
connection = httplib... | looprock/Megaphone | sample_service.py | Python | isc | 1,823 | 0.016456 |
#
# @lc app=leetcode id=594 lang=python3
#
# [594] Longest Harmonious Subsequence
#
# https://leetcode.com/problems/longest-harmonious-subsequence/description/
#
# algorithms
# Easy (51.44%)
# Total Accepted: 97.9K
# Total Submissions: 190.2K
# Testcase Example: '[1,3,2,2,5,2,3,7]'
#
# We define a harmonious array ... | vermouth1992/Leetcode | python/594.longest-harmonious-subsequence.py | Python | mit | 1,636 | 0.014059 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | chen0031/nupic | tests/unit/nupic/encoders/random_distributed_scalar_test.py | Python | agpl-3.0 | 19,698 | 0.004315 |
#!env python
import os
import sys
sys.path.append(
os.path.join(
os.environ.get( "SPLUNK_HOME", "/opt/splunk/6.1.3" ),
"etc/apps/framework/contrib/splunk-sdk-python/1.3.0",
)
)
from collections import Counter, OrderedDict
from math import log
from nltk import tokenize
import execnet
import json
from splunkl... | nlproc/splunkml | bin/nlcluster.py | Python | apache-2.0 | 4,186 | 0.029384 |
#!/usr/bin/env python
"""
Created on Mon 2 Dec 2013
Plotter grunntilstanden for en harmonisk oscillator.
@author Benedicte Emilie Brakken
"""
from numpy import *
from matplotlib.pyplot import *
# Kun for aa teste
omega = 1 # [rad / s]
# Fysiske parametre
hbarc = 0.1973 # [MeV pm]
E0p = 938.27 ... | ahye/FYS2140-Resources | examples/plotting/plot_initial.py | Python | mit | 964 | 0.018672 |
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
# don't remove this function it is used in tests
def test_method():
'''test function'''
return 'overridden'
| mhbu50/erpnext | erpnext/regional/france/utils.py | Python | gpl-3.0 | 222 | 0.018018 |
# Copyright (c) 2019-2022, Manfred Moitzi
# License: MIT License
from typing import TYPE_CHECKING
import logging
from ezdxf.lldxf import validator
from ezdxf.lldxf.attributes import (
DXFAttr,
DXFAttributes,
DefSubclass,
XType,
RETURN_DEFAULT,
group_code_mapping,
)
from ezdxf.lldxf.const import... | mozman/ezdxf | src/ezdxf/entities/view.py | Python | mit | 5,728 | 0.000698 |
from waldur_core.core import WaldurExtension
class OpenStackTenantExtension(WaldurExtension):
class Settings:
# wiki: https://opennode.atlassian.net/wiki/display/WD/OpenStack+plugin+configuration
WALDUR_OPENSTACK_TENANT = {
'MAX_CONCURRENT_PROVISION': {
'OpenStackTenan... | opennode/nodeconductor-openstack | src/waldur_openstack/openstack_tenant/extension.py | Python | mit | 1,984 | 0.000504 |
# Copyright 2014 Red Hat 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 ag... | bigswitch/nova | nova/objects/instance_numa_topology.py | Python | apache-2.0 | 8,588 | 0.000116 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" sysdiag
Pierre Haessig — September 2013
"""
from __future__ import division, print_function
def _create_name(name_list, base):
'''Returns a name (str) built on `base` that doesn't exist in `name_list`.
Useful for automatic creation of subsystems or wires
... | pierre-haessig/sysdiag | sysdiag.py | Python | mit | 21,428 | 0.007049 |
from .base import DebugPanel
from ..utils import STATIC_ROUTE_NAME
__all__ = ['MiddlewaresDebugPanel']
class MiddlewaresDebugPanel(DebugPanel):
"""
A panel to display the middlewares used by your aiohttp application.
"""
name = 'Middlewares'
has_content = True
template = 'middlewares.jinja2'
... | realer01/aiohttp-debugtoolbar | aiohttp_debugtoolbar/panels/middlewares.py | Python | apache-2.0 | 1,143 | 0 |
"""Filters allows to match the output against a regex and use the match for statistic purpose."""
import re
import typing
from lib_hook.auto_number import AutoNumber
from .stage import Str_to_stage, Stage
class InvalidStage(Exception):
"""A filter was applied at a wrong stage."""
pass
class FilterMode(Aut... | s-i-newton/clang-hook | lib_hook/filter.py | Python | apache-2.0 | 1,601 | 0.004372 |
#!/usr/bin/python
import sys
from klampt import *
from klampt.vis import GLSimulationProgram
class MyGLViewer(GLSimulationProgram):
def __init__(self,files):
#create a world from the given files
world = WorldModel()
for fn in files:
res = world.readFile(fn)
if not r... | YilunZhou/Klampt | Python/demos/gltemplate.py | Python | bsd-3-clause | 1,532 | 0.02611 |
from typing import Any, Dict, List, Union
from flask import abort, flash, g, render_template, url_for
from flask_babel import format_number, lazy_gettext as _
from werkzeug.utils import redirect
from werkzeug.wrappers import Response
from openatlas import app
from openatlas.database.connect import Transaction
from op... | craws/OpenAtlas-Python | openatlas/views/types.py | Python | gpl-2.0 | 4,440 | 0 |
from .sizedist import *
from .WD01 import make_WD01_DustSpectrum
| eblur/dust | astrodust/distlib/__init__.py | Python | bsd-2-clause | 67 | 0 |
from relation_iterator import RelationIterator
from true_expression import TrueExpression
from operation_status import OperationStatus
from data_input_stream import DataInputStream
from insert_row import InsertRow
from column import Column
import simple_dbms
class TableIterator(RelationIterator, object):
"""
... | nddsg/SimpleDBMS | simple_dbms/table_iterator.py | Python | gpl-3.0 | 9,205 | 0.000869 |
from ulp.urlextract import escape_ansi, parse_input
import os
TEST_DIR = os.path.dirname(os.path.realpath(__file__))
def test_parse_no_url_input():
assert len(parse_input("")) == 0
multiline_text = """
text
without URLs
and
multiple lines """
assert len(parse_input(multiline_text)) == 0
... | victal/ulp | test/test_urlextract.py | Python | mit | 1,212 | 0.00495 |
from flask import Flask
from flask import request
from subprocess import call
import git, json, os, sys
newname = "gitlistener"
from ctypes import cdll, byref, create_string_buffer
libc = cdll.LoadLibrary('libc.so.6') #Loading a 3rd party library C
buff = create_string_buffer(len(newname)+1) #Note: One larger ... | WilliamMarti/gitlistener | gitlistener.py | Python | mit | 1,001 | 0.02997 |
# coding: utf-8
from smartbot import Behaviour
from smartbot import Utils
from smartbot import ExternalAPI
import re
import os
import random
class JokeBehaviour(Behaviour):
def __init__(self, bot):
super(JokeBehaviour, self).__init__(bot)
self.language = self.bot.config.get('main', 'language') if... | pedrohml/smartbot | smartbot/joke_behaviour.py | Python | mit | 2,199 | 0.005462 |
class Solution:
def trailingZeroes(self, n: int) -> int:
powers_of_5 = []
for i in range(1, 10):
powers_of_5.append(5 ** i)
return sum(n // power_of_5 for power_of_5 in powers_of_5)
| 1337/yesterday-i-learned | leetcode/172e.py | Python | gpl-3.0 | 222 | 0 |
# 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 ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/models/_models.py | Python | mit | 848,302 | 0.003644 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import datetime
from django.conf import settings
from haystack.backends import BaseEngine
from haystack.backends.elasticsearch_backend import ElasticsearchSearchBackend, ElasticsearchSearchQuery
from haystack.c... | steventimberman/masterDebater | venv/lib/python2.7/site-packages/haystack/backends/elasticsearch2_backend.py | Python | mit | 14,291 | 0.003149 |
from time import sleep
import os
import shutil
import merfi
from merfi import logger
from merfi import util
from merfi.collector import RepoCollector
from merfi.backends import base
class RpmSign(base.BaseBackend):
help_menu = 'rpm-sign handler for signing files'
_help = """
Signs files with rpm-sign. Crawls ... | alfredodeza/merfi | merfi/backends/rpm_sign.py | Python | mit | 5,502 | 0.000364 |
import os
from fabric.api import run, sudo, cd, env, task, settings
from ..literals import FABFILE_MARKER
def delete_mayan():
"""
Delete Mayan EDMS files from an Linux system
"""
sudo('rm %(virtualenv_path)s -Rf' % env)
def install_mayan():
"""
Install Mayan EDMS on an Linux system
... | appsembler/mayan_appsembler | fabfile/platforms/linux.py | Python | gpl-3.0 | 922 | 0.004338 |
# Copyright 2016 Rackspace
#
# 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, s... | cisco-openstack/tempest | tempest/cmd/workspace.py | Python | apache-2.0 | 9,103 | 0 |
from django.core.mail import send_mail
from django.template.loader import render_to_string
from wanawana.utils import get_base_url
def send_admin_link_on_event_creation(request, event):
if not event.admin_email:
return
email_body = render_to_string("emails/new_event.txt", {
"url_scheme": req... | Psycojoker/wanawana | events/emails.py | Python | gpl-3.0 | 2,656 | 0.006401 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Character ranges of letters
letters = 'a-zA-Z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u0103\u0106\u0107\
\u010c-\u010f\u0112-\u0115\u011a-\u012d\u0131\u0141\u0142\u0147\u0148\
\u0150-\u0153\u0158-\u0161\u0164\u0165\u016e-\u0171\u017d\u01... | bnjones/Mathics | mathics/core/characters.py | Python | gpl-3.0 | 43,648 | 0 |
# encoding: utf-8
# Simple example for PatternSelector
from yast import import_module
import_module('UI')
from yast import *
class PatternSelectorEmptyClient:
def main(self):
if not UI.HasSpecialWidget("PatternSelector"):
UI.OpenDialog(
VBox(
Label("Error: This UI doesn't suppor... | yast/yast-python-bindings | examples/PatternSelector-empty.py | Python | gpl-2.0 | 722 | 0.01385 |
# Name: Main.py
# Author: Shawn Wilkinson
# Imports
from random import choice
# Welcome Message
print("Welcome to the Isolation Game!")
# Make Board
board = [['' for col in range(4)] for row in range(4)]
# Print Board Functin
def show():
# Tmp string
tmpStr = ""
# Loop through board
tmpStr += "\nBoard:"
tmpSt... | super3/PyDev | Class/IsoGame/main.py | Python | mit | 2,825 | 0.044248 |
#!/usr/bin/python3
import sys, getpass, urllib.request, urllib.error, json
def mgmt(cmd, data=None, is_json=False):
# The base URL for the management daemon. (Listens on IPv4 only.)
mgmt_uri = 'http://127.0.0.1:10222'
setup_key_auth(mgmt_uri)
req = urllib.request.Request(mgmt_uri + cmd, urllib.parse.urlencode(d... | Toilal/mailinabox | tools/mail.py | Python | cc0-1.0 | 4,331 | 0.027938 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from requests import RequestException
from flexget import plugin
from flexget.event import event
from flexget.utils import json
from flexget.utils.template impo... | oxc/Flexget | flexget/plugins/output/rapidpush.py | Python | mit | 6,452 | 0.00124 |
import uuid
class RemoteProcessGroup(object):
def __init__(self, url, name=None):
self.uuid = uuid.uuid4()
if name is None:
self.name = str(self.uuid)
else:
self.name = name
self.url = url
def get_name(self):
return self.name
def get_uuid... | dtrodrigues/nifi-minifi-cpp | docker/test/integration/minifi/core/RemoteProcessGroup.py | Python | apache-2.0 | 353 | 0 |
import time
script = u'''
// Time stamp: %s
// (This ensures the source text is *not* a byte-for-byte match with any
// previously-fetched version of this script.)
// This no-op fetch handler is necessary to bypass explicitly the no fetch
// handler optimization by which this service worker script can be skipped.
add... | scheib/chromium | third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/update-claim-worker.py | Python | bsd-3-clause | 661 | 0.001513 |
import xbmc
import xbmcgui
import xbmcaddon
import xbmcvfs
from PIL import Image, ImageOps
ADDON = xbmcaddon.Addon(id = 'script.stargate.guide')
def autocrop_image(infile,outfile):
infile = xbmc.translatePath(infile)
image = Image.open(infile)
border = 0
size = image.size
bb_image = image
bbox... | TheWardoctor/Wardoctors-repo | script.stargate.guide/ResizeLogos.py | Python | apache-2.0 | 1,738 | 0.010357 |
from scrapy.http import Response
from scrapy.selector import Selector
def xmliter_lxml(obj, nodename, namespace=None, prefix='x'):
from lxml import etree
reader = _StreamReader(obj)
tag = '{%s}%s' % (namespace, nodename) if namespace else nodename
iterable = etree.iterparse(reader, tag=tag, encoding=r... | Partoo/scrapy | scrapy/contrib_exp/iterators.py | Python | bsd-3-clause | 1,404 | 0.000712 |
import os
#: The title of this site
SITE_TITLE = 'Job Board'
#: Database backend
SQLALCHEMY_DATABASE_URI = 'postgresql:///hasjob_testing'
SERVER_NAME = 'hasjob.travis.local:5000'
#: LastUser server
LASTUSER_SERVER = 'https://hasgeek.com/'
#: LastUser client id
LASTUSER_CLIENT_ID = os.environ.get('LASTUSER_CLIENT_ID', ... | hasgeek/hasjob | instance/testing.py | Python | agpl-3.0 | 602 | 0 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
('users', '0001_initial'),
)
def forwards(self, orm):
# Adding field 'RawDocument.user'
db.add_column... | FinalsClub/karmaworld | karmaworld/apps/document_upload/migrations/0002_auto__add_field_rawdocument_user.py | Python | agpl-3.0 | 6,785 | 0.008106 |
# -*- coding: utf-8 -*-
"""
pyalgs
~~~~~
pyalgs provides the python implementation of the Robert Sedgwick's Coursera course on Algorithms (Part I and Part II).
:copyright: (c) 2017 by Xianshun Chen.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.0.14' | chen0040/pyalgs | pyalgs/__init__.py | Python | bsd-3-clause | 291 | 0.006873 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from .. import config as _config
class Conf(_config.ConfigNamespace):
"""
Configuration parameters for `astropy.table`.
"""
auto_colname = _config.ConfigItem(
'col{0}',
'The template that determines the name of a column ... | funbaker/astropy | astropy/table/__init__.py | Python | bsd-3-clause | 2,381 | 0.00378 |
"""An Itemexporter for scrapy that writes elasticsearch bulk format"""
from scrapy.contrib.exporter import BaseItemExporter
from scrapy.contrib.exporter import JsonLinesItemExporter
class ElasticSearchBulkItemExporter(JsonLinesItemExporter):
def export_item(self, item):
requestdict = { "index": { "type": ite... | skade/scrapy-elasticsearch-bulk-item-exporter | scrapyelasticsearch.py | Python | bsd-3-clause | 473 | 0.023256 |
#! /usr/bin/env python
import csv
import json
import os
import sys
import time
from collections import OrderedDict
from locust import main, events
from locust.exception import StopUser
from requests.exceptions import HTTPError
from bzt.utils import guess_csv_dialect
class LocustStarter(object):
def __init__(sel... | greyfenrir/taurus | bzt/resources/locustio-taurus-wrapper.py | Python | apache-2.0 | 4,812 | 0.001455 |
from unittest import TestCase
from operator import itemgetter
import simplejson as json
class TestItemSortKey(TestCase):
def test_simple_first(self):
a = {'a': 1, 'c': 5, 'jack': 'jill', 'pick': 'axe', 'array': [1, 5, 6, 9], 'tuple': (83, 12, 3), 'crate': 'dog',
'zeak': 'oh'}
self.as... | itielshwartz/BackendApi | lib/simplejson/tests/test_item_sort_key.py | Python | apache-2.0 | 1,154 | 0.004333 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Functions to load the test cases ("koans") that make up the
Path to Enlightenment.
'''
import io
import unittest
# The path to enlightenment starts with the following:
KOANS_FILENAME = 'koans.txt'
def filter_koan_names(lines):
'''
Strips leading and traili... | haroldtreen/python_koans | runner/path_to_enlightenment.py | Python | mit | 1,482 | 0 |
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# SECURITY WARNING: keep t... | seccom-ufsc/hertz | hertz/settings.py | Python | mit | 3,237 | 0.001236 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# send mail utf-8 using gmail smtp server /w jpegs
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.Header import Header
from email.Utils import formatdate
import smtplib
def send_email... | karaage0703/denpa-gardening | send_mail.py | Python | mit | 1,390 | 0.003644 |
#!/usr/bin/env python
"""
@author: delagarza
"""
from CTDopts.CTDopts import ModelError
class CLIError(Exception):
# Generic exception to raise and log different fatal errors.
def __init__(self, msg):
super(CLIError).__init__(type(self))
self.msg = "E: %s" % msg
def __str__(self):
... | WorkflowConversion/CTDConverter | ctdconverter/common/exceptions.py | Python | gpl-3.0 | 884 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2013 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import os
import unittest
import sys
from splinter import Browser
from .base import BaseBrowserTests
from .fake_webapp import EXAMPLE_A... | bmcculley/splinter | tests/test_zopetestbrowser.py | Python | bsd-3-clause | 5,355 | 0.000378 |
# -*- coding: utf-8 -*-
'''
Created on May 3, 2014
@author: andy
'''
#list Tuple
if __name__ == '__main__':
pass | goday-org/learnPython | src/Arrays.py | Python | gpl-3.0 | 119 | 0.02521 |
import graphAttack as ga
import numpy as np
import pickle
"""Control script"""
def run(simulationIndex, X, Y=None):
"""Run the model"""
print("Training with:", simulationIndex)
seriesLength, nFeatures = X.shape
# ------ it is important that the exampleLength is the same as
# ------ the number if ... | jgolebiowski/graphAttack | controlTrainRNN.py | Python | mit | 5,411 | 0.000924 |
from sys import version_info
py3 = version_info[0] > 2
if py3:
response = input("Please enter your name: ")
else:
response = raw_input("Please enter your name: ")
print("Hello " + response) | SonyStone/pylib | Practical Maya Programming/input.py | Python | mit | 199 | 0.005025 |
import os, scrapy, argparse
from realclearpolitics.spiders.spider import RcpSpider
from scrapy.crawler import CrawlerProcess
parser = argparse.ArgumentParser('Scrap realclearpolitics polls data')
parser.add_argument('url', action="store")
parser.add_argument('--locale', action="store", default='')
parser.add_argument('... | dpxxdp/berniemetrics | private/scrapers/realclearpolitics-scraper/scraper.py | Python | mit | 1,355 | 0.005904 |
from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.i18n import JavaScriptCatalog
from ... | nephila/djangocms-apphook-setup | tests/test_utils/urls.py | Python | bsd-3-clause | 842 | 0.002375 |
# The primary purpose of this module is to run data hashing and comparison functions
# It is also called during the intialization of modules to register their hashing and comparison functions.
# Try to leave all the boilerplate calls like DB access and JSON decoding in the main.py file
import hijackingprevention.sessi... | michardy/account-hijacking-prevention | hijackingprevention/api.py | Python | mit | 4,967 | 0.02879 |
class AuthenticationError(Exception):
pass
| kuldeep-k/pySocialFactory | socialFactory/core/AuthenticationError.py | Python | mit | 56 | 0.017857 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# Event
# -------------
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def get_cal_events(m_st, m_end):
# load owned events
res1 = frappe.db.sql("""select name from `tabEvent`
WHERE... | gangadharkadam/shfr | frappe/widgets/event.py | Python | mit | 1,523 | 0.0348 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import http.server
import itertools
import json
import logging
import mimetypes
import os... | twitter/pants | src/python/pants/reporting/reporting_server.py | Python | apache-2.0 | 17,903 | 0.00849 |
import chess
chess.run() | renatopp/liac-chess | main.py | Python | mit | 25 | 0.04 |
import logging
from google.appengine.ext import ndb
from endpoints_proto_datastore.ndb.model import EndpointsModel, EndpointsAliasProperty
class UserModel(EndpointsModel):
email = ndb.StringProperty()
name = ndb.StringProperty() | LookThisCode/DeveloperBus | Season 2013/Bogota/Projects/06.Agile_Business/backend/app/models/user.py | Python | apache-2.0 | 231 | 0.021645 |
# MIT License
# Copyright (c) 2016 https://github.com/sndnv
# See the project's LICENSE file for the full text
def get_header_files_size_data(sources_dir, header_files_by_size, rows_count):
"""
Builds table rows list containing data about header files sizes (largest/smallest).
:param sources_dir: configur... | sndnv/cadb | cadb/utils/Stats.py | Python | mit | 9,700 | 0.005773 |
"""Urls for the Zinnia entries"""
from django.conf.urls import url
from django.conf.urls import patterns
from zinnia.views.entries import EntryDetail
urlpatterns = patterns(
'',
url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
EntryDetail.as_view(),
name='zinnia_ent... | pczhaoyun/obtainfo | zinnia/urls/entries.py | Python | apache-2.0 | 335 | 0 |
from mercurial import cmdutil
_hgignore_content = """\
syntax: glob
*~
*.pyc
*.pyo
*.bak
cache/*
databases/*
sessions/*
errors/*
"""
def commit():
app = request.args[0]
path = apath(app, r=request)
uio = ui.ui()
uio.quiet = True
if not os.environ.get('HGUSER') and not uio.config("ui", "usernam... | henkelis/sonospy | web2py/applications/admin/controllers/mercurial.py | Python | gpl-3.0 | 1,107 | 0.00813 |
#!/usr/bin/python
import os
import json
from pprint import pprint
from os import environ as env
import glanceclient.exc
from collections import Counter
import novaclient.v1_1.client as nvclient
import glanceclient.v2.client as glclient
import keystoneclient.v2_0.client as ksclient
def get_nova_credentials():
... | kionetworks/openstack-api-scripts | tenant_glance_images.py | Python | apache-2.0 | 1,996 | 0.002004 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
class Atan(Base):
@staticmethod
def export(): # type: () -> None
... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/onnx-tensorrt/third_party/onnx/onnx/backend/test/case/node/atan.py | Python | apache-2.0 | 767 | 0 |
"""
ManyMan - A Many-core Visualization and Management System
Copyright (C) 2012
University of Amsterdam - Computer Systems Architecture
Jimi van der Woning and Roy Bakker
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
t... | FlorisTurkenburg/ManyMan | SCC_backend/server.py | Python | gpl-2.0 | 14,884 | 0.000336 |
"""
BIC for LINEAR light curve
--------------------------
Figure 10.19
BIC as a function of the number of frequency components for the light curve
shown in figure 10.18. BIC for the two prominent frequency peaks is shown. The
inset panel details the area near the maximum. For both frequencies, the BIC
peaks at between... | nhuntwalker/astroML | book_figures/chapter10/fig_LINEAR_BIC.py | Python | bsd-2-clause | 3,400 | 0.001176 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pcapcffi
----------------------------------
Tests for `pcapcffi` module.
"""
import pytest
import pcapcffi
from pcapcffi.wrappers import PcapError
def test_findalldevs():
devs = pcapcffi.wrappers.pcap_findalldevs()
assert devs
def test_pcap():
p... | GertBurger/pcapcffi | tests/test_pcapcffi.py | Python | bsd-3-clause | 542 | 0 |
# Prepare per-patient clinical data
# TODO: Possibly incorporate Palumbo data
import os
from load_patient_data import load_per_patient_data
import numpy as np
import pandas as pd
pd.options.mode.chained_assignment = None
# Load input data
data, per_patient_dict, per_patient_fields = load_per_patient_data()
# Dictio... | xpspectre/multiple-myeloma | prep_patient_data.py | Python | mit | 8,458 | 0.002365 |
# coding: utf-8
from django.contrib import admin
from hub.models import ExtraUserDetail
from .models import AuthorizedApplication
# Register your models here.
admin.site.register(AuthorizedApplication)
admin.site.register(ExtraUserDetail)
| onaio/kpi | kpi/admin.py | Python | agpl-3.0 | 241 | 0 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import tem... | scode/pants | tests/python/pants_test/backend/jvm/subsystems/test_shader.py | Python | apache-2.0 | 7,708 | 0.007654 |
#!/usr/bin/python
#
# Fabien Chereau fchereau@eso.org
#
import gzip
import os
def writePolys(pl, f):
"""Write a list of polygons pl into the file f.
The result is under the form [[[ra1, de1],[ra2, de2],[ra3, de3],[ra4, de4]], [[ra1, de1],[ra2, de2],[ra3, de3]]]"""
f.write('[')
for idx, poly in enumer... | Stellarium/stellarium | util/skyTile.py | Python | gpl-2.0 | 4,700 | 0.004681 |
#!/usr/bin/python
# pl2dir - Generates a directory structure based on your Traktor playlists.
# Copyright (C) 2015 Erik Stambaugh
# 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 versio... | poorsquinky/traktor-tools | pl2dir.py | Python | gpl-3.0 | 4,990 | 0.012024 |
# File: TscTelnetLib.py ; This file is part of Twister.
# version: 2.002
#
# Copyright (C) 2012 , Luxoft
#
# Authors:
# Adrian Toader <adtoader@luxoft.com>
#
#
# 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... | twister/twister.github.io | lib/TscTelnetLib.py | Python | apache-2.0 | 17,030 | 0.003288 |
import adaptive_binning_chisquared_2sam
import os
systematics_fraction = 0.01
dim_list = [1,2,3,4,5,6,7,8,9,10]
adaptive_binning=True
CPV = True
PLOT = True
if CPV:
orig_name="chi2_gauss_0_95__0_95_CPV_not_redefined_syst_"+str(systematics_fraction).replace(".","_")+"_"
orig_title="Gauss 0.95 0.95 syst{} adaptbi... | weissercn/learningml | learningml/GoF/chi2/gauss/miranda_adaptive_binning_systematics_Gaussian_same_projection_evaluation_of_optimised_classifiers.py | Python | mit | 3,491 | 0.030077 |
"""
Illustrates various methods of associating multiple types of
parents with a particular child object.
The examples all use the declarative extension along with
declarative mixins. Each one presents the identical use
case at the end - two classes, ``Customer`` and ``Supplier``, both
subclassing the ``HasAddresses`... | wfxiang08/sqlalchemy | examples/generic_associations/__init__.py | Python | mit | 748 | 0.005348 |
#!/usr/bin/env python3
#
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | googleapis/storage-testbench | tests/test_error.py | Python | apache-2.0 | 3,099 | 0.001291 |
"""
Script used to convert data into sparse matrix format that
can easily be imported into MATLAB.
Use like this
python convertToSparseMatrix.py ../../../../../data/train_triplets.txt 1000 ../../../../../data/eval/year1_test_triplets_visible.txt ../../../../../data/eval/year1_test_triplets_hidden.txt 100
"""
import sys... | EmilienDupont/cs229project | convertToSparseMatrix.py | Python | mit | 3,343 | 0.007777 |
###########################################################################
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | google/starthinker | dags/itp_audit_dag.py | Python | apache-2.0 | 35,487 | 0.026968 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/reactor/shared_rct_sds_imperial_1.iff"
result.attri... | anhstudios/swganh | data/scripts/templates/object/tangible/ship/components/reactor/shared_rct_sds_imperial_1.py | Python | mit | 482 | 0.045643 |
from __future__ import unicode_literals
import numpy as np
import param
from ..core import (HoloMap, DynamicMap, CompositeOverlay, Layout,
GridSpace, NdLayout, Store)
from ..core.util import (match_spec, is_number, wrap_tuple, basestring,
get_overlay_spec, unique_iterator,... | vascotenner/holoviews | holoviews/plotting/util.py | Python | bsd-3-clause | 10,673 | 0.002342 |
#!/usr/bin/python2.4
# Copyright (c) 2006-2008 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.
'''Handling of the <message> element.
'''
import re
import types
from grit.node import base
import grit.format.rc_header
imp... | kuiche/chromium | tools/grit/grit/node/message.py | Python | bsd-3-clause | 9,031 | 0.009412 |
"""Kytos Core-Defined Exceptions."""
class KytosCoreException(Exception):
"""Exception thrown when KytosCore is broken."""
def __str__(self):
"""Return message of KytosCoreException."""
return 'KytosCore exception: ' + super().__str__()
class KytosSwitchOfflineException(Exception):
"""E... | kytos/kytos | kytos/core/exceptions.py | Python | mit | 3,168 | 0 |
# -*- coding: utf-8 -*-
""" Vented box enclosure """
import numpy as np
from . import air
class VentedBox(object):
""" Model a vented box loudspeaker enclosure """
def __init__(self, Vab, fb, Ql):
self._Vab = Vab
#: Acoustic compliance of box :math:`C_{ab}`
#:
#: .. note:: Do ... | Psirus/altay | altai/lib/vented_box.py | Python | bsd-3-clause | 1,632 | 0 |
from django.conf.urls.defaults import patterns, url, include
from django.contrib import admin
from django.conf import settings
from django.views.generic.simple import direct_to_template
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^', include('reciblog.blog.urls')),
url(r'^about$', direct_to_tem... | wraithan/reciblog | urls.py | Python | bsd-2-clause | 617 | 0.003241 |
# encoding: utf-8
from __future__ import unicode_literals
import os
import re
import sys
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import (
compat_etree_fromstring,
compat_urllib_parse_unquote,
compat_urlparse,
compat_xml_parse_error,
)
from ..utils import (
d... | Rudloff/youtube-dl | youtube_dl/extractor/generic.py | Python | unlicense | 99,048 | 0.002343 |
#!/usr/bin/env python
"""
@file rebuildSchemata.py
@author Michael Behrisch
@date 2011-07-11
@version $Id: rebuildSchemata.py 11671 2012-01-07 20:14:30Z behrisch $
Let all SUMO binarie write the schema for their config
SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
Copyright (C) 2011-2012... | smendez-hi/SUMO-hib | tools/xml/rebuildSchemata.py | Python | gpl-3.0 | 848 | 0.005896 |
# -*- coding: utf-8 -*-
# There are tests here with unicode string literals and
# identifiers. There's a code in ast.c that was added because of a
# failure with a non-ascii-only expression. So, I have tests for
# that. There are workarounds that would let me run tests for that
# code without unicode identifiers and ... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/test/test_fstring.py | Python | apache-2.0 | 47,266 | 0.000783 |
'''
BSD Licence
Copyright (c) 2012, Science & Technology Facilities Council (STFC)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright n... | kusamau/cedaMarkup | ceda_markup/markup.py | Python | bsd-3-clause | 2,962 | 0.009453 |
# https://djangosnippets.org/snippets/2566/
from django import template
from django.template import resolve_variable, NodeList
from django.contrib.auth.models import Group
register = template.Library()
@register.tag()
def ifusergroup(parser, token):
""" Check to see if the currently logged in user belongs to a ... | mupi/tecsaladeaula | core/templatetags/usergroup.py | Python | agpl-3.0 | 1,920 | 0.001563 |
# Generated by Django 1.11.7 on 2018-05-21 09:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('waldur_jira', '0017_project_action'),
]
operations = [
migrations.AddField(
model_name='project',
name='runtime_stat... | opennode/nodeconductor-assembly-waldur | src/waldur_jira/migrations/0018_project_runtime_state.py | Python | mit | 465 | 0 |
import json
import enum
from urllib.parse import urlencode
from urllib.request import urlopen
from urllib import request
class APINonSingle:
def __init__(self, api_key, agent = "webnews-python", webnews_base = "https://webnews.csh.rit.edu/"):
self.agent = agent
self.api_key = api_key
self.... | AndrewHanes/Python-Webnews | webnews/api.py | Python | mit | 2,609 | 0.004983 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.d... | UnrememberMe/pants | src/python/pants/backend/docgen/register.py | Python | apache-2.0 | 1,019 | 0.004907 |
def main():
print("Hello!")
| BobbyJacobs/cs3240-demo | hello.py | Python | mit | 30 | 0.033333 |
# Copyright 2021 The Meson development team
# SPDX-license-identifier: Apache-2.0
from __future__ import annotations
import re
import os
import typing as T
from ...mesonlib import version_compare
from ...interpreterbase import (
ObjectHolder,
MesonOperator,
FeatureNew,
typed_operator,
noArgsFlatt... | mesonbuild/meson | mesonbuild/interpreter/primitives/string.py | Python | apache-2.0 | 6,549 | 0.003207 |
def flatten(dictionary):
stack = [((), dictionary)]
result = {}
while stack:
path, current = stack.pop()
for k, v in current.items():
if isinstance(v, dict) and bool(v):
stack.append((path + (k,), v))
else:
whatadd = ""... | nesterione/problem-solving-and-algorithms | problems/Checkio/TheFlatDictionary.py | Python | apache-2.0 | 1,262 | 0.003962 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.