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 |
|---|---|---|---|---|---|---|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import add_days, cstr, getdate
from webnotes.model.doc import addchild
from webnotes.model.bean import getlist
f... | gangadhar-kadam/nassimapp | support/doctype/maintenance_schedule/maintenance_schedule.py | Python | agpl-3.0 | 10,225 | 0.034425 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import uuid
import base64
import string
import random
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import AbstractUser
from django.core.cache import cache
from django.db import models
from django.... | zsjohny/jumpserver | apps/users/models/user.py | Python | gpl-2.0 | 18,955 | 0.000106 |
#pylint: disable=C0103,R0903
from ansi.colour.base import Graphic
from ansi.colour.fx import bold
# ECMA-048 standard names
black = Graphic('40')
red = Graphic('41')
green = Graphic('42')
yellow = Graphic('43')
blue = Graphic('44')
magenta = Graphic('45')
cy... | tehmaze/ansi | ansi/colour/bg.py | Python | mit | 1,639 | 0.025625 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unit tests for gluon.cache
"""
import os
import unittest
from fix_path import fix_sys_path
fix_sys_path(__file__)
from storage import Storage
from cache import CacheInRam, CacheOnDisk, Cache
oldcwd = None
def setUpModule():
global oldcwd
if oldcwd is ... | shashisp/blumix-webpy | app/gluon/tests/test_cache.py | Python | mit | 3,558 | 0.003092 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | chemelnucfin/tensorflow | tensorflow/python/feature_column/feature_column_v2.py | Python | apache-2.0 | 183,637 | 0.005015 |
"""
Based on this example -> https://github.com/open-power/pdbg/blob/master/.build.sh
TEMPDIR=`mktemp -d ${HOME}/pdbgobjXXXXXX`
RUN_TMP="docker run --rm=true --user=${USER} -w ${TEMPDIR} -v ${HOME}:${HOME} -t ${CONTAINER}"
${RUN_TMP} ${SRCDIR}/configure --host=arm-linux-gnueabi
${RUN_TMP} make
rm -rf ${TEMPDIR}
"... | litex-hub/lxbe-tool | lxbe_tool/providers/docker.py | Python | apache-2.0 | 323 | 0.006192 |
"""Pytrafikverket module."""
# flake8: noqa
from pytrafikverket.trafikverket import (AndFilter, FieldFilter, FieldSort,
Filter, FilterOperation, NodeHelper,
OrFilter, SortOrder, Trafikverket)
from pytrafikverket.trafikverket_train import ... | AnderssonPeter/pytrafikverket | pytrafikverket/__init__.py | Python | mit | 708 | 0 |
#!/usr/bin/python
# Copyright 2015 Comcast Cable Communications Management, 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 ... | Comcast/rulio | examples/stockfs.py | Python | apache-2.0 | 4,418 | 0.005885 |
"""Support for Firmata switch output."""
import logging
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
from .const import (
CONF_INITIAL_STATE,
CONF_NEGATE_STA... | tchellomello/home-assistant | homeassistant/components/firmata/switch.py | Python | apache-2.0 | 2,287 | 0 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... | klahnakoski/TestLog-ETL | vendor/jx_sqlite/expressions/number_op.py | Python | mpl-2.0 | 1,194 | 0.000838 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.core import exceptions
class InspectorRuntime(object):
def __init__(self, inspector_backend):
self._inspector_backend = inspector_backe... | 7kbird/chrome | tools/telemetry/telemetry/core/backends/chrome/inspector_runtime.py | Python | bsd-3-clause | 2,006 | 0.008973 |
# Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
from digits.utils import subclass
@subclass
class Error(Exception):
pass
@subclass
class BadNetworkError(Error):
"""
Errors that occur when validating a network
"""
def __init__(self, message):
self.message = message
def... | batra-mlp-lab/DIGITS | digits/frameworks/errors.py | Python | bsd-3-clause | 825 | 0.006061 |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""Module docstring.
This serves as a long usage message.
"""
import configargparse
from cli_app import log
LOG = log.Logger.get()
class Options(object):
def __init__(self):
self.parser = configargparse.ArgParser(
default_config_files=['./conf... | xamurej/py3-cli-skel | cli_app/options.py | Python | mit | 888 | 0 |
from django.core.management.base import BaseCommand
from django.db import connections, reset_queries
from ...models import *
class Command(BaseCommand):
def handle(self, *args, **options):
self.table_autocomplete()
def table_autocomplete(self):
#tabela cache para autocomplete
#pegand... | diegobill/django-cities | cities/management/commands/table_autocomplete.py | Python | mit | 1,726 | 0.009849 |
# /***************************************************************************
# * *
# * 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... | gltn/stdm | stdm/composer/custom_items/label.py | Python | gpl-2.0 | 2,466 | 0.001217 |
import json
import time
import re
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.sites.models import Site
from unfold.page import Page
from manifold.core.query ... | onelab-eu/myslice | portal/resources.py | Python | gpl-3.0 | 1,955 | 0.01688 |
import pymysql
import sys
import time
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
def getPost() :
html = Request('http://news.naver.com/main/list.nhn?mode=LS2D&mid=shm&sid1=105&sid2=230', headers={'User-Agent':'Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322;... | YongJang/PythonTelegram | examples/referenced/bs4NaverITNews.py | Python | gpl-2.0 | 1,503 | 0.019398 |
import logging
import os
import sys
import time
import json
import jsonschema
import pprint
import pytest
import requests
from ray._private.test_utils import (
format_web_url,
wait_for_condition,
wait_until_server_available,
)
from ray.dashboard import dashboard
from ray.dashboard.tests.conftest import * ... | ray-project/ray | dashboard/modules/snapshot/tests/test_job_submission.py | Python | apache-2.0 | 5,558 | 0.001439 |
VERSION = (0, 5, 'pre')
# NOTE: This method was removed in 0.4.0, but restored in 0.4.2 after use-cases were
# reported that were impossible by merely subclassing MPTTModel.
def register(*args, **kwargs):
"""
Registers a model class as an MPTTModel, adding MPTT fields and adding MPTTModel to __bases__.
T... | rtts/qqq | mptt/__init__.py | Python | gpl-3.0 | 879 | 0.005688 |
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
class Comment(models.Model):
author = models.ForeignKey(User, null=True, related_na... | rizumu/dialogos | dialogos/models.py | Python | bsd-3-clause | 880 | 0 |
"""Single slice vgg with normalised scale.
"""
import functools
import lasagne as nn
import numpy as np
import theano
import theano.tensor as T
import data_loader
import deep_learning_layers
import image_transform
import layers
import preprocess
import postprocess
import objectives
import theano_printer
import update... | 317070/kaggle-heart | configurations/j7_jeroen_ch.py | Python | mit | 10,276 | 0.005936 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | tkaitchuck/nupic | examples/bindings/svm_how_to.py | Python | gpl-3.0 | 8,034 | 0.013069 |
import numpy as np
import sys
from trw_utils import *
from heterogenous_crf import inference_gco
from pyqpbo import binary_general_graph
from scipy.optimize import fmin_l_bfgs_b
def trw(node_weights, edges, edge_weights, y,
max_iter=100, verbose=0, tol=1e-3,
get_energy=None):
n_nodes, n_states =... | kondra/latent_ssvm | smd.py | Python | bsd-2-clause | 3,199 | 0.006877 |
# Generated by Django 1.11.16 on 2018-11-28 19:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_duration_limits', '0002_auto_20181119_0959'),
]
operations = [
migrations.AlterField(
model_name='coursedurationlimitc... | eduNEXT/edx-platform | openedx/features/course_duration_limits/migrations/0003_auto_20181128_1407.py | Python | agpl-3.0 | 601 | 0.001664 |
# (C) Fractal Industries, Inc. 2016
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
from collections import namedtuple
from fnmatch import fnmatch
import os
import time
# 3rd party
try:
import rrdtool
except ImportError:
rrdtool = None
import ... | pmav99/praktoras | checks.d/cacti.py | Python | bsd-3-clause | 8,178 | 0.001712 |
#!/usr/bin/env python3
# -*-coding:UTF-8 -*
"""
The Submit paste module
================
This module is taking paste in redis queue ARDB_DB and submit to global
"""
##################################
# Import External packages
##################################
import os
import sys
import gzip
import io
import redi... | CIRCL/AIL-framework | bin/modules/submit_paste.py | Python | agpl-3.0 | 15,703 | 0.004776 |
from __future__ import print_function
import os
import sys
from datetime import datetime
import portage
import gentoolkit.pprinter as pp
from gentoolkit.query import Query
from gentoolkit.package import Package
from euscan import CONFIG, BLACKLIST_PACKAGES
from euscan import handlers, output
from euscan.out import ... | iksaif/euscan | pym/euscan/scan.py | Python | gpl-2.0 | 5,444 | 0 |
"""
Django settings for recomendation project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
from __... | bkosawa/admin-recommendation | admin_recommendation/settings.py | Python | apache-2.0 | 6,881 | 0.001017 |
from third_party.bi_att_flow.my.tensorflow import * | google/active-qa | third_party/bi_att_flow/my/tensorflow/__init__.py | Python | apache-2.0 | 51 | 0.019608 |
"""
**************
Graph Matching
**************
Given a graph G = (V,E), a matching M in G is a set of pairwise non-adjacent
edges; that is, no two edges share a common vertex.
`Wikipedia: Matching <https://en.wikipedia.org/wiki/Matching_(graph_theory)>`_
"""
import networkx as nx
__all__ = ["min_maximal_matching"]... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/external/networkx/algorithms/approximation/matching.py | Python | gpl-3.0 | 1,155 | 0 |
# -*- coding: utf-8 -*-
# from openerp import api, fields, models, _
from openerp.osv import osv, fields
from openerp.addons.website.models.website import slug
from openerp import SUPERUSER_ID
import requests
class FbBlogPost(osv.Model):
_inherit = 'blog.post'
_columns = {
'fb_content': fields.html... | lem8r/website-themes | facebook_instant_article/models/website_blog.py | Python | lgpl-3.0 | 659 | 0 |
from socket import *
import sys, time
if len(sys.argv) <= 1:
print 'Usage: "python proxy.py server_ip"\n[server_ip : It is the IP Address of the Proxy Server'
sys.exit(2)
# Create a server socket, bind it to a port and start listening
tcpSERVERPort = 8080
tcpSERVERSock = socket(AF_INET, SOCK_STREAM)
fp = open... | Varun-Teja/Projects | Proxy/Proxy.py | Python | mit | 3,866 | 0.010347 |
from .gosubl import about
from .gosubl import gs
from .gosubl import gsq
from .gosubl import gsshell
from .gosubl import mg9
from .gosubl import sh
from .gosubl.margo import mg
from .gosubl.margo_state import actions
import datetime
import json
import os
import re
import shlex
import string
import sublime
import sublim... | DisposaBoy/GoSublime | gs9o.py | Python | mit | 19,161 | 0.035489 |
import distutils.version
import importlib
import types
import warnings
# Update install.rst when updating versions!
VERSIONS = {
"bs4": "4.6.0",
"bottleneck": "1.2.1",
"fastparquet": "0.2.1",
"gcsfs": "0.2.2",
"lxml.etree": "3.8.0",
"matplotlib": "2.2.2",
"numexpr": "2.6.2",
"odfpy": "... | toobaz/pandas | pandas/compat/_optional.py | Python | bsd-3-clause | 3,494 | 0.000859 |
from mock import *
from gp_unittest import *
from gpconfig_modules.database_segment_guc import DatabaseSegmentGuc
from gpconfig_modules.file_segment_guc import FileSegmentGuc
from gpconfig_modules.guc_collection import GucCollection
class GucCollectionTest(GpTestCase):
def setUp(self):
self.subject = GucC... | cjcjameson/gpdb | gpMgmt/bin/gppylib/test/unit/test_unit_guccollection.py | Python | apache-2.0 | 12,742 | 0.003061 |
'''
available factories:
feed_forward_perceptron
'''
import numpy
from mlpdata import MLPData
class zero_matrix(object):
def __init__(self, rows, cols):
self.__rows = rows
self.__cols = cols
def rows(self):
return self.__rows
def cols(self):
return self.__c... | aolsux/DeepThought | deepthought/factories.py | Python | gpl-3.0 | 1,527 | 0.00131 |
#
# Copyright (C) 2010 Norwegian University of Science and Technology
# Copyright (C) 2011-2015 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by
# ... | sigmunau/nav | python/nav/portadmin/snmputils.py | Python | gpl-2.0 | 31,038 | 0.000161 |
'''
sc_studio.string_view
Author: Ming Tsang
Copyright (c) 2014-2015 HKUST SmartCar Team
Refer to LICENSE for details
'''
import binascii
import logging
import time
import tkinter
from tkinter import Tk, Text
from sc_studio import config
from sc_studio.view import View
class StringView(View):
def __init__(self, par... | hkust-smartcar/sc-studio | src/sc_studio/string_view.py | Python | mit | 1,489 | 0.032236 |
import re
from datetime import date
def get_or_none(model, **kwargs):
try:
return model.objects.get(**kwargs)
except model.DoesNotExist:
return None
def validar_cnpj(cnpj):
cnpj = ''.join(re.findall('\d', str(cnpj)))
if (not cnpj) or (len(cnpj) < 14):
return False
intei... | JadsonReis/sistema-nacional-cultura | planotrabalho/utils.py | Python | agpl-3.0 | 880 | 0.001136 |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | crossroadchurch/paul | openlp/core/ui/firsttimewizard.py | Python | gpl-2.0 | 17,462 | 0.00315 |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('myproject.myapp.views',
url(r'^list/$', 'list', name='list'),
)
| minaevmike/praktica | Diplom/Samples/minimal-django-file-upload-example-master/src/for_django_1-5/myproject/myproject/myapp/urls.py | Python | gpl-2.0 | 169 | 0.005917 |
#!/usr/bin/env python
def print_banner(s):
print('##------------------------------------------------------------------------------')
print(f'## {s}')
print('##------------------------------------------------------------------------------')
print_banner('First implementation')
class Base:
def foo(self... | eroicaleo/LearningPython | PythonTricks/ch04_05.py | Python | mit | 1,316 | 0.007599 |
import math
def max_sub_array(array, begin=None, end=None):
def max_sub_array_mid(arr, begin_m, end_m, middle):
l_sum, l_max_index, l_max_sum = 0, None, None
l_local = middle - 1
while l_local >= begin_m:
l_sum += arr[l_local]
if l_max_index is None:
... | ShengGuangzhi/SummerTree | algorithm/python_version/basic/max_sub_array.py | Python | mit | 2,257 | 0.001329 |
"""
Axilent Client functionality for Dox.
"""
from sharrock.client import HttpClient, ResourceClient, ServiceException
from dox.config import get_cfg
from dox.utils import slugify
def _get_resource(app,resource,library=True):
"""
Gets a resource client.
"""
cfg = get_cfg()
apikey_setting = 'library... | Axilent/Dox | dox/client.py | Python | bsd-3-clause | 2,050 | 0.019512 |
from tqdm import tqdm
from collections import defaultdict
import h5py
import networkx as nx
import struct
import numpy as np
# hl = None
# ml = None
# with h5py.File('/usr/people/it2/seungmount/research/datasets/blended_piriform_157x2128x2128/all/human_semantic_labels.h5','r') as f:
# hl = f['main'][:]
# with h5py.F... | tartavull/tigertrace | tigertrace/util/rehuman_semantics.py | Python | mit | 1,483 | 0.011463 |
#
# UpdateLogger.py
#
"""
package oompa.tracking
TODO: stil waffling about whether to log two-columns - "datetime {json}" or "{json-with-datetime-field}"
"""
import json
import os
from datetime import datetime
class UpdateLogger:
"""
records updates for later replay
"""
def __init__(self, c... | sjtsp2008/oompa | oompa/tracking/UpdateLogger.py | Python | apache-2.0 | 6,922 | 0.010546 |
#!/usr/bin/env python2
#
# Copyright 2018 Google, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following... | vineodd/PIMSim | GEM5Simulation/gem5/src/systemc/tests/verify.py | Python | gpl-3.0 | 19,486 | 0.00195 |
from checkio_referee import RefereeCodeGolf
from checkio_referee import covercodes, validators, representations
import settings_env
from tests import TESTS
class AutoPaintingValidator(validators.BaseValidator):
def validate(self, outer_result):
steps, k, n = self._test["validation_data"]
if not ... | Empire-of-Code-Puzzles/checkio-empire-auto-painting | verification/src/referee.py | Python | gpl-2.0 | 2,173 | 0.001381 |
#!coding: utf-8
"""
Usage:
main.py <host> <username> <password> [-r] [--port=<port>] [--hub=<hub>] [--pppoe-username=<username>] [--pppoe-password=<password>] [--output=<output>]
Options:
-h --help Show help
-r Change route to make connect to Packetix Server alwa... | zhongpei/softether-client | endpoints/main.py | Python | gpl-3.0 | 6,782 | 0.010764 |
# ------------------------------------------------------------------------------
# This file is part of PyTango (http://pytango.rtfd.io)
#
# Copyright 2006-2012 CELLS / ALBA Synchrotron, Bellaterra, Spain
# Copyright 2013-2014 European Synchrotron Radiation Facility, Grenoble, France
#
# Distributed under the terms of ... | jairomoldes/PyTango | tango/exception.py | Python | lgpl-3.0 | 6,718 | 0.002233 |
#encoding: utf-8
from flask.ext.restful import Resource, reqparse
class Test(Resource):
def __init__(self):
self.parser = reqparse.RequestParser()
self.parser.add_argument('id', type=int)
super(AccountAPI, self).__init__()
def get(self):
return {'id': id}
def post(self)... | chenke91/ckPermission | app/api_v1/resources/tests.py | Python | mit | 403 | 0.009926 |
# -*- coding: utf-8 -*-
"""THIS DIRECTORY IS TO HOLD BOT SCRIPTS THAT NO LONGER ARE MAINTAINED."""
| PersianWikipedia/pywikibot-core | scripts/archive/__init__.py | Python | mit | 99 | 0 |
from django.conf.urls import include, url
from django.views.generic.base import RedirectView
from server.views import app
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
# Uncomment the next line to enable the admin:
url(r'^admin/', i... | mwillmott/techbikers | server/urls.py | Python | mit | 482 | 0 |
# Generated by Django 3.1 on 2020-08-25 12:15
import django.db.models.deletion
from django.db import migrations, models
import s3upload.fields
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Cat",
fie... | yunojuno/django-s3-upload | example/migrations/0001_initial.py | Python | mit | 1,676 | 0.002983 |
# This module definitely remains in 1.0.x, probably in versions after that too.
import warnings
warnings.warn('gevent.coros has been renamed to gevent.lock', DeprecationWarning, stacklevel=2)
from gevent.lock import *
from gevent.lock import __all__
| matthappens/taskqueue | taskqueue/venv_tq/lib/python2.7/site-packages/gevent/coros.py | Python | mit | 251 | 0.011952 |
# coding: utf-8
#
# 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 requi... | brianrodri/oppia | core/domain/user_domain.py | Python | apache-2.0 | 46,090 | 0.000195 |
import copy
description = "test sort"
arr = [ 10, 3, 44, 15, 40 , -10, -1000, 0, 0, 3000]
arr2 = [ -10.2, 4.33, 1.999, -399.22, -10000.1001, 10.9, 3.922, 59.01, -33.11, 0.3, 0.2, 0.1, 0.001, -0.001, -0.2, -0.4, -0.3, -0.222 ]
arr3 = [ { "key" : k } for k in arr2 ]
filedata = """{$
locals { v : %(arr)s, v2 : []... | airfrog/okws | test/regtest/cases/85.py | Python | gpl-2.0 | 1,198 | 0.038397 |
'''
Created on 22/ago/2011
@author: norby
'''
from core.moduleexception import ModuleException, ProbeException, ExecutionException, ProbeSucceed
from core.moduleguess import ModuleGuess
from core.argparse import ArgumentParser, StoredNamespace
from core.argparse import SUPPRESS
from ast import literal_eval
import rand... | JeyZeta/Dangerous | Dangerous/Weevely/modules/shell/sh.py | Python | mit | 3,972 | 0.012085 |
from click.testing import CliRunner
from furrytrain.nettoips import main
def test_main():
cases = [(' 10.234.10.0/30 ',
'10.234.10.0\n10.234.10.1\n10.234.10.2\n10.234.10.3\n'),
('1000.234.10.0/30',
'error: 1000.234.10.0/30\n'),
('1000.234.10.0/30 ',
... | sozforex/furry-train | tests/test_nettoips.py | Python | mit | 1,059 | 0.002833 |
"""
Test breakpoint command for different options.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class BreakpointOptionsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test(self):
"""Test bre... | llvm-mirror/lldb | packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py | Python | apache-2.0 | 3,765 | 0.000531 |
from __future__ import generators
"""
httplib2
A caching http interface that supports ETags and gzip
to conserve bandwidth.
Requires Python 2.3 or later
Changelog:
2007-08-18, Rick: Modified so it's able to use a socks proxy if needed.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright... | jbu/personis | personis/examples/aelog/httplib2/__init__.py | Python | gpl-3.0 | 68,094 | 0.005698 |
def rate(Likes, Comments, Tags):
a = 0.0143
b = 0.0413
c = 0.0367
return Likes * a + Comments * b + Tags * c
| pedsm/deepHack | old/rating/main.py | Python | mit | 126 | 0.007937 |
#******************************************************************************
# FILE: calibrate_vic.py
# AUTHOR: Kel Markert
# EMAIL: kel.markert@nasa.gov
# ORGANIZATION: NASA-SERVIR, UAH/ESSC
# MODIFIED BY: n/a
# CREATION DATE: 22 Feb. 2017
# LAST MOD DATE: 03 Apr. 2017
# PURPOSE: This script performs a simple calib... | KMarkert/servir-vic-training | scripts/calibrate_vic.py | Python | gpl-3.0 | 6,662 | 0.01486 |
import funk
from funk import expects
from funk import allows
from funk.tools import assert_that
import funk.matchers as m
from abuse.generate import RuleSet
from abuse.generate import NonTerminal
from abuse.parse import parse
from abuse.parse import MissingArrow
from abuse.parse import MissingClosingBrace
from abuse.p... | mwilliamson/abuse | python/test/abuse/test_parse.py | Python | bsd-2-clause | 5,846 | 0.008724 |
# Generated by Django 1.11.11 on 2018-03-20 18:38
from django.db import migrations, models
import grandchallenge.jqfileupload.models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="StagedFile",
fields... | comic/comic-django | app/grandchallenge/jqfileupload/migrations/0001_initial.py | Python | apache-2.0 | 1,357 | 0.000737 |
#!/usr/bin/python3
import subprocess, shutil, os, sqlite3, re
import utils
from email_validator import validate_email as validate_email_, EmailNotValidError
import idna
def validate_email(email, mode=None):
# Checks that an email address is syntactically valid. Returns True/False.
# Until Postfix supports SMTPUTF8,... | choltha/mailinabox | management/mailconfig.py | Python | cc0-1.0 | 21,317 | 0.028193 |
# binary mining.
# say we have a pair of binary encoded predicates, and we have have a sample of the truth values of them
# we want to learn if some logic exist between the two predicates. A->B or B->A. Nothing more.
# given bayesian null prior, establish a confidence method to hypothesize and learn.
# Just a sanity ch... | Fuchai/Philosophy-Machine | vae_mining/binary_mining.py | Python | apache-2.0 | 1,418 | 0.022567 |
# Copyright (C) 2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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 versio... | mkuron/espresso | testsuite/scripts/tutorials/test_04-lattice_boltzmann_part2.py | Python | gpl-3.0 | 1,053 | 0 |
"""Kraken - objects.operators.operator module.
Classes:
Operator - Base operator object.
"""
import re
from kraken.core.configs.config import Config
from kraken.core.objects.scene_item import SceneItem
class Operator(SceneItem):
"""Operator representation."""
def __init__(self, name, parent=None, metaData=... | oculusstorystudio/kraken | Python/kraken/core/objects/operators/operator.py | Python | bsd-3-clause | 12,620 | 0.001189 |
from flask import Flask, render_template
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.script import Manager
from flask.ext.bootstrap import Bootstrap
app = Flask(__name__)
app.config.from_object('config')
db =... | SteveMcGrath/Concord | registration/app.py | Python | gpl-2.0 | 1,312 | 0.000762 |
##Copyright 2009-2015 Thomas Paviot (tpaviot@gmail.com)
##
##This file is part of pythonOCC.
##
##pythonOCC 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
##(... | sven-hm/pythonocc-core | examples/core_topology_edge.py | Python | lgpl-3.0 | 3,032 | 0.004947 |
#!/usr/bin/env python
# ===================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# See license.txt for license information.
# ===================================
import os
import sys
import imp
protocol = imp.load_source('protocol', '../protocol.py')
nxDSCLog = imp.load_source('n... | MSFTOSSMgmt/WPSDSCLinux | Providers/Scripts/2.4x-2.5x/Scripts/nxEnvironment.py | Python | mit | 9,103 | 0.002087 |
R = [x for x in range(97, 123) if chr(x) not in 'tfpeqwzgnib']
b = 0x56, 0x2B, 0x0F, 0xC5
number = 0
for x0 in R:
for x1 in R:
for x3 in R:
_00 = b[0] ^ x0
_11 = b[1] | x1
Y0 = _00 ^ _11
Y1 = b[3] ^ _11
Y3 = b[2] & (_00 & x3)
... | phantom-root/tasks | hashes/300_homemade_hash/other/botanlq/calc_script.py | Python | mit | 814 | 0.003686 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2020, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | subutai/nupic.research | src/nupic/research/frameworks/pytorch/regularization.py | Python | agpl-3.0 | 2,505 | 0.003593 |
../../gladevcp/hitcounter.py | CalvinHsu1223/LinuxCNC-EtherCAT-HAL-Driver | configs/sim/gladevcp/hitcounter.py | Python | gpl-2.0 | 28 | 0.035714 |
# Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | idaholab/raven | tests/framework/PostProcessors/TSACharacterizer/TrainingData/generators.py | Python | apache-2.0 | 3,313 | 0.009055 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-08 15:45
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
('djcelery', '0001_initial'),
]
operatio... | zamattiac/SHARE | providers/edu/opensiuc/migrations/0001_initial.py | Python | apache-2.0 | 661 | 0 |
# vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2003, Mathieu Fenniak
# 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 abov... | wb253/goapp | app/pingback.py | Python | gpl-3.0 | 5,006 | 0.005793 |
#! /usr/bin/env python
# by gjr; 021514
"""
Plot PCoA results from pcoa in mothur
% python plot-pcoa.py <file.pcoa.axis> <file.pcoa.loadings> <outfile>
"""
import sys, os
import matplotlib
matplotlib.use('Agg')
#matplotlib.use('Pdf')
import matplotlib.pyplot as plt
import numpy as np
import brewer2mpl
import pandas... | jiarong/SSUsearch | scripts/plot-pcoa.py | Python | bsd-3-clause | 2,303 | 0.012158 |
# Authors: Nicolas Goix <nicolas.goix@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
from __future__ import division
import numpy as np
import scipy as sp
from warnings import warn
from scipy.sparse import issparse
import numbers
from ..external... | waterponey/scikit-learn | sklearn/ensemble/iforest.py | Python | bsd-3-clause | 11,906 | 0.000168 |
'''
---------------------------
models.py
---------------------------
Created on 24.04.2015
Last modified on 13.01.2016
Author: Marc Wieland, Michael Haas
Description: Defines the database model
----
'''
from webapp import db
from flask_security import RoleMixin, UserMixin
from geoalchemy2 import Geometry
from sqla... | GFZ-Centre-for-Early-Warning/REM_RRVS | webapp/models.py | Python | bsd-3-clause | 6,057 | 0.006604 |
import win32api
import win32wnet
import sys
from winnetwk import *
import os
possible_shares = []
def _doDumpHandle(handle, level = 0):
indent = " " * level
while 1:
items = win32wnet.WNetEnumResource(handle, 0)
if len(items)==0:
break
for item in items:
try:
if item.dwDisplayType == RESOURC... | sserrot/champion_relationships | venv/Lib/site-packages/win32/Demos/win32wnet/testwnet.py | Python | mit | 3,461 | 0.030338 |
#
# Copyright 2016-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | EdDev/vdsm | lib/vdsm/throttledlog.py | Python | gpl-2.0 | 3,750 | 0 |
from flask import g
def return_null_if_not_logged_in(func):
def return_none(*args, **kwargs):
if g.user is None:
return "You must be logged in to perform this action.", 401
return func(*args, **kwargs)
return return_none
def return_null_if_not_staff(func):
def return_none(*a... | Tvlistings/tuxtrax | penguicontrax/api/functions.py | Python | gpl-3.0 | 593 | 0 |
#!/usr/bin/env python
'''
Need to put your tty into utf8 mode? see utf-8(7) man page
The official ESC sequence to switch from an ISO 2022 encoding scheme (as used for
instance by VT100 terminals) to UTF-8 is ESC % G ("\x1b%G"). The corresponding
return sequence from UTF-8 to ISO 2022 is ESC % @ ("\x1b%@")... | Blue-Labs/utf8-percentage-complete-bar | completion-status-bar.py | Python | apache-2.0 | 3,154 | 0.011097 |
__author__ = 'rhay'
| RussTheAerialist/zensitting | daemon/zend/__init__.py | Python | gpl-2.0 | 20 | 0 |
#!/usr/bin/env python
"""Tests for HTTP API."""
import json
from grr.gui import api_aff4_object_renderers
from grr.gui import api_call_renderers
from grr.gui import http_api
from grr.lib import flags
from grr.lib import registry
from grr.lib import test_lib
from grr.lib import utils
from grr.lib.rdfvalues import s... | pchaigno/grr | gui/http_api_test.py | Python | apache-2.0 | 6,014 | 0.004656 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Dane Summers <dsummers@pinedesk.biz>
# Copyright: (c) 2013, Mike Grozak <mike.grozak@gmail.com>
# Copyright: (c) 2013, Patrick Callahan <pmc@patrickcallahan.com>
# Copyright: (c) 2015, Evan Kaufman <evan@digitalflophouse.com>
# Copyright: (c) 2015, Luca... | indrajitr/ansible | lib/ansible/modules/cron.py | Python | gpl-3.0 | 25,911 | 0.00274 |
from nose_parameterized import parameterized
from unittest import TestCase
from tensorrec import TensorRec
from tensorrec.representation_graphs import (
LinearRepresentationGraph, NormalizedLinearRepresentationGraph, FeaturePassThroughRepresentationGraph,
WeightedFeaturePassThroughRepresentationGraph, ReLURepr... | jfkirk/tensorrec | test/test_representation_graphs.py | Python | apache-2.0 | 2,973 | 0.004709 |
# Copyright 2017 Google 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 applicable law or a... | google/upvote_py2 | upvote/gae/utils/user_utils.py | Python | apache-2.0 | 901 | 0.00333 |
""" 1. Parse log file of a webserver
2. Print the filename and number of bytes delivered for 200 responses
"""
import re
import sys
from os import path
import operator
import itertools
log_file_path = "server.log"
log_data = []
pattern = re.compile(r'\[(?P<time>.+)\](\s+\")(?P<requestType>\w+)(\s+)(?P<fileName>.... | mudragada/util-scripts | PyProblems/LogFileProcessing/logFileParser.py | Python | mit | 1,318 | 0.002276 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import argparse
from nesasm.compiler import compile_file
def main(argv=None):
parser = argparse.ArgumentParser(
prog="nesasm",
description='NESasm - NES Assembly Compiler',
epilog='')
subparsers = parser.add_subparsers(
... | gutomaia/nesasm_py | nesasm/__init__.py | Python | bsd-3-clause | 985 | 0 |
#!/usr/bin/env python
# Copyright (c) 2006
# Colin Dewey (University of Wisconsin-Madison)
# cdewey@biostat.wisc.edu
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the Li... | hyphaltip/cndtools | util/rotateTabDelim.py | Python | gpl-2.0 | 1,070 | 0.001869 |
from corehq.apps.sms.api import send_sms_to_verified_number
from corehq.util.translation import localize
from django.utils.translation import ugettext as _
class KeywordHandler(object):
def __init__(self, user, domain, args, verified_contact, msg):
self.user = user
self.domain = domain
se... | puttarajubr/commcare-hq | custom/ilsgateway/tanzania/handlers/keyword.py | Python | bsd-3-clause | 786 | 0.001272 |
import sys
import pickle
from nltk.tokenize import word_tokenize
from cleaneddata.remove_stopwords_nltk import read_words, clean_review
from model.generateModel import generatemodel
from validation.validate import predict
review = raw_input("Enter a review to classify: ")
try:
paramfile = open("model/savedmodel.p... | vishnupriyam/review-classification | classify.py | Python | cc0-1.0 | 1,294 | 0.016229 |
import pytest
from opentrons.protocol_api import ProtocolContext
from opentrons.protocols.execution import execute, execute_python
from opentrons.protocols.parse import parse
def test_api2_runfunc():
def noargs():
pass
with pytest.raises(SyntaxError):
execute_python._runfunc_ok(noargs)
d... | Opentrons/labware | api/tests/opentrons/protocols/execution/test_execute_python.py | Python | apache-2.0 | 2,472 | 0 |
# -*- encoding: utf-8 -*-
# Module iadctmatrix
from numpy import *
def iadctmatrix(N):
from iameshgrid import iameshgrid
x, u = iameshgrid(range(N), range(N)) # (u,x)
alpha = ones((N,N)) * sqrt(2./N)
alpha[0,:] = sqrt(1./N) # alpha(u,x)
A = alpha * cos((2*x+1)*u*pi / (2.*N)) # Cn(u,x)
return A... | robertoalotufo/ia636 | ia636/iadctmatrix.py | Python | bsd-3-clause | 322 | 0.021739 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | Francis-Liu/animated-broccoli | nova/utils.py | Python | apache-2.0 | 53,116 | 0.00032 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, Brian Coca <bcoca@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | camradal/ansible | lib/ansible/modules/system/runit.py | Python | gpl-3.0 | 9,034 | 0.007084 |
import os
import sys
import glob
from os.path import join, basename
from numpy.distutils import log
from numscons import get_scons_build_dir
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration,dot_join
from numpy.distutils.command.scons import get_scons_pkg... | efiring/numpy-work | numpy/core/setupscons.py | Python | bsd-3-clause | 4,414 | 0.004304 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.