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 |
|---|---|---|---|---|---|---|
import copy
import cPickle
import json
import logging
import os
import sys
from nltk.corpus import stopwords as nltk_stopwords
from pymachine.definition_parser import read_defs
from pymachine.machine import Machine
from pymachine.control import ConceptControl
from pymachine.utils import MachineGraph, MachineTraverser
... | kornai/4lang | src/fourlang/lexicon.py | Python | mit | 15,540 | 0.000193 |
import numpy as np
class Perceptron(object):
"""Perceptron classifier.
Parameters
------------
eta : float
Learning rate (between 0.0 and 1.0)
n_iter : int
Passes over the training dataset.
Attributes
-----------
w_ : 1d-array
Weights after fitting.
errors_... | xdnian/pyml | code/ch02/perceptron.py | Python | mit | 1,571 | 0.000637 |
import io
import unittest
from unittest.mock import patch
from kattis import k_hnumbers
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input(self):
'''Run and asser... | ivanlyon/exercises | test/test_k_hnumbers.py | Python | mit | 1,101 | 0.001817 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Kcov(CMakePackage):
"""Code coverage tool for compiled programs, Python and Bash which use... | iulian787/spack | var/spack/repos/builtin/packages/kcov/package.py | Python | lgpl-2.1 | 1,192 | 0.001678 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | xorpaul/shinken | shinken/webui/plugins_skonf/action/action.py | Python | agpl-3.0 | 2,125 | 0.001882 |
# TODO:
# - Figure out when to use previous runs' information
# - merge this module's parse_clustermerging and
# newick.parse_clustermerging
from StringIO import StringIO
from os import remove
import shutil
import os.path as op
import subprocess as sp
import sys
import numpy as np
CM_FILE = 'ClusterMerging.txt'
c... | runiq/modeling-clustering | find-correct-cluster-number/clustering_run.py | Python | bsd-2-clause | 6,261 | 0.003035 |
import unittest
from katas.kyu_6.write_number_in_expanded_form import expanded_form
class ExpandedFormTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(expanded_form(12), '10 + 2')
def test_equal_2(self):
self.assertEqual(expanded_form(42), '40 + 2')
def test_equal_3... | the-zebulan/CodeWars | tests/kyu_6_tests/test_write_number_in_expanded_form.py | Python | mit | 394 | 0 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | cschenck/blender_sim | fluid_sim_deps/blender-2.69/2.69/scripts/freestyle/style_modules/nature.py | Python | gpl-3.0 | 1,715 | 0.001749 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# (c) 2014 Rajat Agarwal
import os, sys
import unittest
import sqoot
if 'PUBLIC_API_KEY' in os.environ and 'PRIVATE_API_KEY' in os.environ:
PUBLIC_API_KEY = os.environ['PUBLIC_API_KEY']
PRIVATE_API_KEY = os.environ['PRIVATE_API_KEY']
else:
try:
from _... | ragarwal6397/sqoot | sqoot/tests/__init__.py | Python | mit | 757 | 0.002642 |
import sys
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'satori.core.settings')
application = get_wsgi_application()
# initialize thrift server structures - takes a long time and it's better
# to do it on startup than during the first request
import sato... | zielmicha/satori | satori.core/satori/core/wsgi.py | Python | mit | 343 | 0.005831 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Intel Corp.
#
"""
Interface for all resource control plugins.
"""
from abc import ABCMeta, abstractmethod
from ..plugin import DeclareFramework
@DeclareFramework('provisioner')
class Provisioner(object, metaclass=ABCMeta):
PROVISIONER_KEY = "provisioner"
PROVISIO... | intel-ctrlsys/actsys | actsys/control/provisioner/provisioner.py | Python | apache-2.0 | 3,948 | 0.001773 |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... | davideuler/foursquared | util/gen_parser.py | Python | apache-2.0 | 4,392 | 0.006831 |
#!/usr/bin/python -tt
from graph.node import Node, FileNode
def endswith(s, pats):
return any(s.endswith(p) for p in pats)
def create_graph(files):
return Node(None)
| shaded-enmity/feaders | feader/utils.py | Python | mit | 173 | 0.023121 |
# Copyright (c) 2013 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | wolverineav/neutron | neutron/extensions/external_net.py | Python | apache-2.0 | 2,051 | 0 |
#!/usr/bin/env python
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
setup(name='moviepy',
version='0.2.1.6.9',
author='Zulko 2013',
description='Module for script-based video editing',
long_description=open('README.rst').read(),
license='LICENSE.txt',
... | ShaguptaS/moviepy | setup.py | Python | mit | 419 | 0.016706 |
#
# Location-related classes for simplification of GPS traces.
# Author: James P. Biagioni (jbiagi1@uic.edu)
# Company: University of Illinois at Chicago
# Created: 5/16/11
#
import os
class Location:
def __init__(self, id, latitude, longitude, time):
self.id = id
self.latitude = latitude
... | Vanuan/gpx_to_road_map | converters/location.py | Python | apache-2.0 | 4,821 | 0.009334 |
# -*- coding: utf-8 -*-
#
# Python GTK+ 3 Tutorial documentation build configuration file, created by
# sphinx-quickstart on Sun Jan 29 18:42:04 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerate... | Programmica/python-gtk3-tutorial | conf.py | Python | cc0-1.0 | 7,069 | 0.006649 |
"""HTTP views to interact with the entity registry."""
import voluptuous as vol
from homeassistant.components import websocket_api
from homeassistant.components.websocket_api.const import ERR_NOT_FOUND
from homeassistant.components.websocket_api.decorators import (
async_response,
require_admin,
)
from homeass... | postlund/home-assistant | homeassistant/components/config/entity_registry.py | Python | apache-2.0 | 4,955 | 0.001816 |
"""ELASPIC RUN
"""
import os
import os.path as op
import logging
import argparse
from elaspic import conf, pipeline
logger = logging.getLogger(__name__)
def validate_args(args):
if args.config_file and not os.path.isfile(args.config_file):
raise Exception('The configuration file {} does not exist!'.form... | ostrokach/elaspic | elaspic/cli/elaspic_run.py | Python | mit | 7,164 | 0.002233 |
# Copyright 2015 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 agre... | huntxu/neutron | neutron/tests/fullstack/base.py | Python | apache-2.0 | 4,357 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo.tests.common import TransactionCase
from odoo.exceptions import ValidationError
class TestResLang(TransactionCase):
def setUp(self):
super(TestResLang, self).setUp()
se... | ovnicraft/server-tools | base_locale_uom_default/tests/test_res_lang.py | Python | agpl-3.0 | 1,605 | 0 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Acrisel LTD
# Copyright (C) 2008- Acrisel (acrisel.com) . All Rights Reserved
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public... | Acrisel/acris | acris/acris_example/resource_pool_callback.py | Python | mit | 2,420 | 0.013636 |
import socket, sys, time, argparse
parser = argparse.ArgumentParser(description="This bad server accepts an HTTP connection and replies with a valid HTML document which links to assets. However, attemps to load the assets should result in a net::ERR_EMPTY_RESPONSE.")
parser.add_argument("-p", "--port", type=int, help=... | djcf/error-reloader-extension | tests/badwebserver_jsonly.py | Python | gpl-2.0 | 4,289 | 0.021217 |
# -*- coding: utf-8 -*-
# Scrapy settings for aCloudGuru project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/lat... | miztiik/scrapy-Demos | aCloudGuru/aCloudGuru/settings.py | Python | mit | 3,160 | 0.00981 |
import _plotly_utils.basevalidators
class HovertemplateValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="hovertemplate", parent_name="choroplethmapbox", **kwargs
):
super(HovertemplateValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/choroplethmapbox/_hovertemplate.py | Python | mit | 488 | 0.002049 |
# Copyright 2020 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... | cxxgtxy/tensorflow | tensorflow/python/ops/numpy_ops/np_array_ops.py | Python | apache-2.0 | 63,472 | 0.010398 |
# Quick script to calculate GPA given a class list file.
# Class list file should be a csv with COURSE_ID,NUM_UNITS,GRADE
# GRADE should be LETTER with potential modifiers after that
# registrar.mit.edu/classes-grades-evaluations/grades/calculating-gpa
import argparse
import pandas as pd
def get_parser():
# Get ... | kalyons11/kevin | kevin/playground/gpa.py | Python | mit | 2,017 | 0.000496 |
#
# This code is part of Ansible, but is an independent component.
#
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complet... | kbrebanov/ansible | lib/ansible/module_utils/network/nxos/nxos.py | Python | gpl-3.0 | 14,622 | 0.001299 |
#!/usr/bin/env python
"""
Unscientific benchmarking of this versus the --release rust
implementation below using the %timeit Ipython magic (times in sec)
n_kmers, py_runtime, rust_runtime
6594204, 14.4, 0.578
Both give identical counts on the files tested (and printing kmers out
and diff'ing the resul... | bovee/needletail | bench/benchmark.py | Python | mit | 1,291 | 0.002324 |
from alphametics import solve
import unittest
class KnownValues(unittest.TestCase):
def test_out(self):
'''TO + GO == OUT'''
self.assertEqual(solve('TO + GO == OUT'), '21 + 81 == 102')
def test_too(self):
'''I + DID == TOO'''
self.assertEqual(solve('I + DID == TOO'), '9 + 191 =... | ctasims/Dive-Into-Python-3 | examples/alphameticstest.py | Python | mit | 2,452 | 0.00367 |
from django.conf import settings
from model_bakery import baker
from rest_framework.test import APIRequestFactory, force_authenticate
class ApiTestMixin:
"""
Mixin class for API tests.
Can be used for ViewSets too. Just override :meth:`.get_as_view_kwargs` - se example in the docs
for that method.
... | devilry/devilry-django | devilry/devilry_statistics/tests/test_api/api_test_mixin.py | Python | bsd-3-clause | 2,945 | 0.003056 |
# -*- coding: utf-8 -*-
"""Setup/installation tests for this package."""
from apm.buildout.testing import IntegrationTestCase
from plone import api
class TestInstall(IntegrationTestCase):
"""Test installation of apm.buildout into Plone."""
def setUp(self):
"""Custom shared utility setup for tests.""... | a25kk/apm | src/apm.sitetheme/apm/sitetheme/tests/test_setup.py | Python | mit | 1,143 | 0 |
from django.forms import ModelForm
from .models import Depoimento
class DepoimentoForm(ModelForm):
class Meta:
model = Depoimento
| ProfessionalIT/customers | bambinocampones/src/bambinocampones/website/forms.py | Python | mit | 144 | 0 |
"""
This module implements a simple widget for viewing the list of datasets and nodes in a DVID instance.
Requires PyQt4. To see a demo of it in action, start up your dvid server run this::
$ python pydvid/gui/contents_browser.py localhost:8000
"""
import socket
import httplib
import collections
from PyQt4.QtGui imp... | janelia-flyem/pydvid | pydvid/gui/contents_browser.py | Python | bsd-3-clause | 15,264 | 0.013037 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/repo-automation-playground | xunit-autolabeler-v2/ast_parser/core/test_data/cli/additions/additions.py | Python | apache-2.0 | 926 | 0 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
Intersection.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************************... | alexbruy/QGIS | python/plugins/processing/algs/qgis/Intersection.py | Python | gpl-2.0 | 5,707 | 0.002628 |
from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
"""
Custom permission to only allow owners of an object to edit it.
"""
def has_object_permissions(self, request, view, obj):
# Read permissions are allowed to any request,
# so we'll always all... | dfurtado/generator-djangospa | generators/app/templates/root/main/permissions.py | Python | mit | 438 | 0.006849 |
import os
from IPython.lib import passwd
c.NotebookApp.ip = '*'
c.NotebookApp.port = int(os.getenv('PORT', 8888))
c.NotebookApp.open_browser = False
c.MultiKernelManager.default_kernel_name = 'python3'
c.NotebookApp.password = u'sha1:035a13e895a5:8a3398f1576a32cf938f9236db03f5e8668356c5'
| ec2ainun/skripsiTF | DeepLforServer(GPU)/jupyter_notebook_config.py | Python | mit | 290 | 0.003448 |
#
# 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, software
# distributed under t... | dims/neutron | neutron/tests/unit/db/test_api.py | Python | apache-2.0 | 1,611 | 0 |
import sys
import os
import time
import numpy
import cv2
import cv2.cv as cv
from PIL import Image
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
from picture.util import define
from picture.util.system import POINT
from picture.util.log import LOG as L
THRESHOLD =... | setsulla/owanimo | lib/picture/bin/patternmatch.py | Python | mit | 1,439 | 0.007644 |
# Copyright 2013 by Kamil Koziara. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""
I/O operations for gene annotation files.
"""
from __future__ import ... | arkatebi/SwissProt-stats | Ontology/IO/GoaIO.py | Python | gpl-3.0 | 8,540 | 0.012529 |
#!/usr/bin/env python
from re import sub
from sys import argv,exit
from os import system,getenv,path
from time import clock,time
import json
which = int(argv[1])
submit_id = int(argv[2])
sname = argv[0]
argv=[]
import ROOT as root
from PandaCore.Tools.Misc import *
from PandaCore.Tools.Load import *
import PandaCore... | sidnarayanan/RedPanda | T3/inputs/pf_tmpl.py | Python | mit | 6,716 | 0.018463 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import smart_selects.db_fields
class Migration(migrations.Migration):
dependencies = [
('lugar', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='DiasEfect... | shiminasai/mapafinca | clima/migrations/0001_initial.py | Python | mit | 4,223 | 0.002842 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Copyright (c) 2016 The Bitcoin Unlimited developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_fram... | marlengit/BitcoinUnlimited | qa/rpc-tests/p2p-versionbits-warning.py | Python | mit | 6,299 | 0.002223 |
#!/usr/bin/env python
#
# Copyright (C) 2017 DL
#
import psycopg2
from error_logger.adapter import base_adapter
class PostgresqlAdapter(base_adapter.BaseAdapter):
def __init__(self, *args, **kwargs):
self._args = args
self._kwargs = kwargs
super(PostgresqlAdapter, self).__init__()
... | JShadowMan/package | python/zdl/error_logger/error_logger/adapter/postgresql.py | Python | mit | 412 | 0.002427 |
#!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Checks that msvs_system_include_dirs works.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(format... | ibc/MediaSoup | worker/deps/gyp/test/win/gyptest-system-include.py | Python | isc | 476 | 0.010504 |
#!/usr/local/bin python
# -*- coding: utf-8 -*-
from RPSOM import Model
from RPSOM.transition_graph import output_graph
if __name__=='__main__':
# learning rate alpha setup
alpha_max = [0.1, 0.5, 0.7]
alpha_min = [0.01, 0.1, 0.2]
# neighborhood radius sigma setup
sigma_max = [5, 7, 10]
sigma_min = [1, 2, 3]
ep... | kinect110/RPSOM | src/examples/RPSOM_animal.py | Python | mit | 941 | 0.025505 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""Pytests for demo/app_template/__init__.py
"""
# Import standard packages.
import os
import sys
# Import installed packages.
# Import local packages.
sys.path.insert(0, os.path.curdir)
import demo
def test__all__(
ref_all=[
'main',
'template']
... | stharrold/demo | tests/test_app_template/test_app_template__init__.py | Python | mit | 591 | 0.003384 |
version = '1.1.0'
| g3rd/django-rszio | rszio/__init__.py | Python | mit | 18 | 0 |
import _plotly_utils.basevalidators
class TemplateitemnameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="templateitemname",
parent_name="histogram2d.colorbar.tickformatstop",
**kwargs
):
super(TemplateitemnameValidator, self)._... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2d/colorbar/tickformatstop/_templateitemname.py | Python | mit | 494 | 0 |
"""
Data models for the core Sana data engine. These should be extended as
required.
:Authors: Sana dev team
:Version: 2.0
"""
from .concept import Concept, Relationship, RelationshipCategory
from .device import Device
from .encounter import Encounter
from .events import Event
from .instruction import Instruction
f... | dekatzenel/team-k | mds/core/models/__init__.py | Python | bsd-3-clause | 948 | 0.007384 |
# -*- coding: utf-8 -*-
import argparse
import six
parser = argparse.ArgumentParser(description="Minecraft Package Manager")
sub = parser.add_subparsers(help="command help")
# package commands
sync_parser = sub.add_parser("sync",
description="Synchronize local mod archive.",
... | qwattash/mpm | mpm/cli/mpm.py | Python | gpl-3.0 | 1,756 | 0.001139 |
#!/usr/bin/python
import sys
sys.path.append('/homes/gws/aritter/twitter_nlp/python')
from twokenize import tokenize
from LdaFeatures import LdaFeatures
from Vocab import Vocab
from Dictionaries import Dictionaries
entityDocs = {}
prevText = None
for line in sys.stdin:
line = line.rstrip('\n')
fields = lin... | adarshlx/twitter_nlp | hbc/python/tweets2entityDocs.py | Python | gpl-3.0 | 2,087 | 0.0115 |
# 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... | jiajiechen/mxnet | python/mxnet/gluon/model_zoo/vision/densenet.py | Python | apache-2.0 | 7,888 | 0.002789 |
from ctypes import *
import ctypes.util
import threading
import os
import sys
from warnings import warn
from functools import partial
import collections
import re
import traceback
# vim: ts=4 sw=4 et
if os.name == 'nt':
backend = CDLL('mpv-1.dll')
fs_enc = 'utf-8'
else:
import locale
lc, enc = locale... | Frechdachs/python-mpv | mpv.py | Python | agpl-3.0 | 42,232 | 0.006796 |
import npc
from mako.template import Template
def template_output(sectioner):
template_path = str(npc.settings.InternalSettings().get('listing.templates.markdown.sections.simple'))
section_template = Template(filename=template_path)
return section_template.render(sectioner=sectioner)
def test_generates_ha... | aurule/npc | tests/commands/listing/templates/sections/test_simple_section_md.py | Python | mit | 991 | 0.005045 |
# encoding=utf8
import datetime
from distutils.version import StrictVersion
import hashlib
import os.path
import shutil
import socket
import sys
import time
import random
import seesaw
from seesaw.config import NumberConfigValue
from seesaw.externalprocess import ExternalProcess
from seesaw.item import ItemInterpolati... | ArchiveTeam/qwiki-discovery | pipeline.py | Python | unlicense | 7,004 | 0.001428 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_peering.py | Python | mit | 4,140 | 0.001691 |
"""
roidb
basic format [image_index]['boxes', 'gt_classes', 'gt_overlaps', 'flipped']
extended ['image', 'max_classes', 'max_overlaps', 'bbox_targets']
"""
from __future__ import print_function
import cv2
import numpy as np
from bbox_regression import compute_bbox_regression_targets
from rcnn.config import config
d... | rishita/mxnet | example/rcnn/rcnn/processing/roidb.py | Python | apache-2.0 | 3,603 | 0.00111 |
# This file is part of Tautulli.
#
# Tautulli 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.
#
# Tautulli is distributed in the ... | drzoidberg33/plexpy | plexpy/pmsconnect.py | Python | gpl-3.0 | 155,901 | 0.005215 |
"""Container overriding example."""
from dependency_injector import containers, providers
class Service:
...
class ServiceStub:
...
class Container(containers.DeclarativeContainer):
service = providers.Factory(Service)
class OverridingContainer(containers.DeclarativeContainer):
service = prov... | ets-labs/python-dependency-injector | examples/containers/override.py | Python | bsd-3-clause | 578 | 0 |
from messenger import Skype
import keyring
import utils
token = keyring.get_password('messagesReceiver', 'skypeToken')
registrationToken = keyring.get_password('messagesReceiver', 'skypeRegistrationToken')
username = keyring.get_password('messagesReceiver', 'skypeUsername')
password = keyring.get_password('messagesRec... | khapota/messages-terminal | test.py | Python | mit | 1,064 | 0.003759 |
# swift_build_support/products/llvm.py --------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.tx... | JGiola/swift | utils/swift_build_support/swift_build_support/products/llvm.py | Python | apache-2.0 | 2,666 | 0 |
#!/usr/bin/env python
#
#CustomScript extension
#
# Copyright 2014 Microsoft Corporation
#
# 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
#
#... | Snesha/azure-linux-extensions | AzureEnhancedMonitor/ext/test/test_aem.py | Python | apache-2.0 | 15,614 | 0.00237 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-12 07:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mords_api', '0021_learningword'),
]
operations = [
migrations.RenameField(
... | TeppieC/M-ords | mords_backend/mords_api/migrations/0022_auto_20161212_0008.py | Python | mit | 441 | 0 |
import os
try:
from nltk.corpus import stopwords
stopset = set(stopwords.words('english'))
except ImportError:
print("Cannot use dbpedia without 'pip install nltk'")
try:
import ujson as json
except ImportError:
import json
def generate_testables(words, stopword_set, n_grams=4):
grams = set(... | bgarrels/sky | sky/dbpedia.py | Python | bsd-3-clause | 1,490 | 0 |
# MIT License
#
# Copyright (c) 2017, Stefan Webb. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... | stefanwebb/tensorflow-models | tensorflow_models/trainers/svb_concrete_np.py | Python | mit | 3,783 | 0.019826 |
import json_handler
class conf_handler:
__m_conf_path = None
__m_conf = None
def __init__( self, conf_base = "../conf/", conf_name = "configuration.conf" ):
self.__m_conf_path = conf_base + conf_name
self.__m_conf = json_handler.json_handler(self.__m_conf_... | bncc/pycore | pycore/conf_handler.py | Python | gpl-3.0 | 660 | 0.037879 |
"""TruTeq transport."""
from vumi.transports.truteq.truteq import TruteqTransport
__all__ = ['TruteqTransport']
| TouK/vumi | vumi/transports/truteq/__init__.py | Python | bsd-3-clause | 114 | 0 |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import requests
import os
import sys
"""
Purpose:
Download dicoms from xnat and place them into
a BIDs "like" directory structure.
using the xnat rest API to download dicoms.
see here for xnat REST API documentation: ... | HBClab/xnat_BIDS | xnat_BIDS/xnat_BIDS.py | Python | mit | 16,386 | 0.014219 |
# -*- coding: utf-8 -*-
'''
Created on 2014-2-17
@author: CL.lam
'''
from sqlalchemy.sql.expression import and_
from rpac.widgets.components import RPACForm, RPACText, RPACCalendarPicker, \
RPACSelect
from rpac.model import ORDER_NEW, ORDER_INPROCESS, ORDER_COMPLETE, qry, \
PrintShop, ORDER_CANCEL
from rpac.mod... | LamCiuLoeng/fd | rpac/widgets/ordering.py | Python | mit | 1,705 | 0.017009 |
# coding=utf-8
"""
Emulate a gmetric client for usage with
[Ganglia Monitoring System](http://ganglia.sourceforge.net/)
"""
from Handler import Handler
import logging
try:
import gmetric
except ImportError:
gmetric = None
class GmetricHandler(Handler):
"""
Implements the abstract Handler class, send... | eMerzh/Diamond-1 | src/diamond/handler/g_metric.py | Python | mit | 2,760 | 0 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# Standard library imports
import os
from fnmatch import fnmatch
# Local imports
from . import res
from .. import api, lib, utils
# Third party imports
from .Qt import QtCore, QtGui, QtWidgets
class WindowHeader(QtWidgets.QWidget):
def __init__(sel... | danbradham/shadeset | shadeset/ui/widgets.py | Python | mit | 15,611 | 0 |
#here we can use wrapper to accerlate the whole process, since many text may be same, we can save the intermediate results
import operator
from math import log10
import re
import string
import random
import heapq
"""First Part:
Word Segmentation"""
def memory(f):
#memorize function f
table = {}
def fme... | zkmake520/ProbabilisticModel | NGram/NGram.py | Python | mit | 7,676 | 0.046769 |
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import pytest
from ezdxf.lldxf.attributes import DXFAttr, RETURN_DEFAULT
def test_return_default():
attr = DXFAttr(
code=62,
default=12,
validator=lambda x: False,
fixer=RETURN_DEFAULT,
)
assert attr.fixer(7) == 1... | mozman/ezdxf | tests/test_00_dxf_low_level_structs/test_054_dxfattr.py | Python | mit | 541 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Models.FeatureProcessing import *
from keras.models import Sequential
from keras.layers import Activation, Dense, LSTM
from keras.optimizers import Adam, SGD
import numpy as np
import abc
from ClassificationModule import ClassificationModule
class descriptionreponame... | Ichaelus/Github-Classifier | Application/Models/ClassificationModules/descriptionreponamelstm.py | Python | mit | 3,641 | 0.005774 |
from app.models import db
class Page(db.Model):
"""Page model class"""
__tablename__ = 'pages'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
title = db.Column(db.String)
url = db.Column(db.String, nullable=False)
description = db.Column(db.String)... | niranjan94/open-event-orga-server | app/models/page.py | Python | gpl-3.0 | 1,304 | 0.000767 |
"""
Test the integrators.
"""
import os
# Third-party
import pytest
import numpy as np
# Project
from .. import (
LeapfrogIntegrator,
RK5Integrator,
DOPRI853Integrator,
Ruth4Integrator,
)
from gala.tests.optional_deps import HAS_TQDM
# Integrators to test
integrator_list = [
RK5Integrator,
... | adrn/gala | gala/integrate/tests/test_pyintegrators.py | Python | mit | 3,454 | 0.000579 |
import numpy as np
import cv2
import time
start = time.time()
end = start + 3 #show video for three seconds - I do this to make sure your stream doesn't get stuffed up by a bad exit. Remove in future.
cap = cv2.VideoCapture(0)
#while time.time() < end: #
while(True):
# Capture frame-by-frame
ret, frame = cap... | ngalin/Illumimateys | InterviewPrepScripts/videoCapture.py | Python | mit | 760 | 0.021053 |
# _*_ coding:utf-8 _*_
# Filename:ClientUI.py
# Python在线聊天客户端
from socket import *
from ftplib import FTP
import ftplib
import socket
import thread
import time
import sys
import codecs
import os
reload(sys)
sys.setdefaultencoding( "utf-8" )
class ClientMessage():
#设置用户名密码
def setUsrANDPwd(self,usr,pwd):
... | gzxultra/IM_programming | class_ClientMessage.py | Python | gpl-2.0 | 6,373 | 0.007857 |
"""
89. Gray Code
https://leetcode.com/problems/gray-code/
"""
from typing import List
class Solution:
def grayCode(self, n: int) -> List[int]:
res = [0]
for i in range(n):
res += [x + 2**i for x in reversed(res)]
return res
def main():
s = Solution()
print(s.grayCod... | pisskidney/leetcode | medium/89.py | Python | mit | 385 | 0 |
"""distutils.util
Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
"""
__revision__ = "$Id$"
import sys, os, string, re
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
from distutils.spawn import spawn
from distu... | 2uller/LotF | App/Lib/distutils/util.py | Python | gpl-2.0 | 19,215 | 0.002082 |
# -*- coding: utf-8 -*-
#
# Copyright (C)2006-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consis... | netjunki/trac-Pygit2 | trac/prefs/api.py | Python | bsd-3-clause | 1,093 | 0.00183 |
# encoding=utf-8
from django.utils.translation import ugettext_lazy as _
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.views import APIView
from rest_framework import generics
from rest_framework.viewsets import ModelViewSet
from cmmedia.models import Image,... | quxiaolong1504/cloudmusic | cmmedia/views.py | Python | mpl-2.0 | 1,809 | 0.009913 |
# -*- coding: utf-8 -*-
"""Analysis plugin that labels events according to rules in a tagging file."""
from plaso.analysis import interface
from plaso.analysis import manager
from plaso.engine import tagging_file
class TaggingAnalysisPlugin(interface.AnalysisPlugin):
"""Analysis plugin that labels events according... | joachimmetz/plaso | plaso/analysis/tagging.py | Python | apache-2.0 | 2,057 | 0.006806 |
from django.contrib import admin
# Register your models here.
from datatable.models import Serveur
# Register your models here.
class ServeurAdmin(admin.ModelAdmin):
list_display = ('In_Type', 'In_Nom', 'In_IP', 'statut')
list_filter = ('In_Type', 'In_Nom', 'In_IP', 'statut')
search_fields = ['In_Type', 'In_Nom',... | chrislyon/dj_ds1 | datatable/admin.py | Python | gpl-2.0 | 375 | 0.016 |
#!/usr/bin/python
from ming import *
import sys
srcdir=sys.argv[1]
m = SWFMovie();
font = SWFFont(srcdir + "/../Media/test.ttf")
text = SWFText(1)
w = font.getStringWidth("The quick brown fox jumps over the lazy dog. 1234567890")
text.setFont(font)
text.setColor(0,0,0,255)
text.setHeight(20)
text.moveTo(w,0)
text... | pombredanne/libming | test/Font/test03.py | Python | lgpl-2.1 | 384 | 0.020833 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... | zhengwsh/InplusTrader_Linux | InplusTrader/backtestEngine/model/tick.py | Python | mit | 2,130 | 0 |
# coding=utf-8
import pymysql
import PyGdbUtil
class PyGdbDb:
# 初始化: 连接数据库
def __init__(self, host, port, dbname, user, passwd):
self.project = None
self.table_prefix = None
try:
self.connection = pymysql.connect(
host=host, port=int(port), user=user, passwor... | Jecvay/PyGDB | PyGdbDb.py | Python | mit | 10,962 | 0.003274 |
import subprocess
import smtplib
import socket
from email.mime.text import MIMEText
import datetime
# Change to your own account information
to = 'rk.ryan.king@gmail.com'
gmail_user = 'rk.ryan.king@gmail.com'
gmail_password = 'nzwaahcmdzjchxsz'
smtpserver = smtplib.SMTP('smtp.gmail.com', 587)
smtpserver.ehlo()
smtpserv... | rkryan/seniordesign | pi/utils/startup_ip.py | Python | gpl-2.0 | 865 | 0.006936 |
# Based on PliExtraInfo
# Recoded for Black Pole by meo.
# Recodded for EGAMI
from enigma import iServiceInformation
from Components.Converter.Converter import Converter
from Components.Element import cached
from Poll import Poll
class EGExtraInfo(Poll, Converter, object):
def __init__(self, type):
Converter.__in... | popazerty/beyonwiz-4.1 | lib/python/Components/Converter/EGExtraInfo.py | Python | gpl-2.0 | 10,356 | 0.039784 |
"""
Unit tests for refactor.py.
"""
import sys
import os
import codecs
import io
import re
import tempfile
import shutil
import unittest
from lib2to3 import refactor, pygram, fixer_base
from lib2to3.pgen2 import token
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
FIXER_DIR = os.path.join(TEST_DATA... | kenshay/ImageScript | Script_Runner/PYTHON/Lib/lib2to3/tests/test_refactor.py | Python | gpl-3.0 | 12,405 | 0.000564 |
"""Leetcode 124. Binary Tree Maximum Path Sum
Hard
URL: https://leetcode.com/problems/binary-tree-maximum-path-sum/
Given a non-empty binary tree, find the maximum path sum.
For this problem, a path is defined as any sequence of nodes from some starting
node to any node in the tree along the parent-child connections... | bowen0701/algorithms_data_structures | lc0124_binary_tree_maximum_path_sum.py | Python | bsd-2-clause | 2,485 | 0.002012 |
#!/usr/bin/python
'''
Define the views for the straw web app
'''
from flask import render_template, session, request, render_template, jsonify, Flask, make_response
from time import sleep
from kafka.common import FailedPayloadsError, NotLeaderForPartitionError, KafkaUnavailableError
import md5, redis
import json, uuid
... | rwalk333/straw | src/frontend/app/views.py | Python | mit | 3,744 | 0.00641 |
from contextlib import contextmanager
from datetime import datetime
from django import forms
from django.conf import settings
from django.contrib.auth.models import AbstractBaseUser
from django.core import validators
from django.db import models
from django.utils import translation
from django.utils.encoding import sm... | andymckay/zamboni | mkt/users/models.py | Python | bsd-3-clause | 9,476 | 0.000106 |
for i in range (10):
print i
| montgok/Python_Class | python_test2.py | Python | apache-2.0 | 31 | 0.096774 |
from django.http import HttpResponse
from django.shortcuts import render_to_response, redirect, get_object_or_404
from django.forms.models import model_to_dict
from django.forms.util import ErrorList
from django.template import RequestContext
from django.db import IntegrityError
from django.core.exceptions import Objec... | vault/bugit | user_manage/views.py | Python | mit | 4,105 | 0.004629 |
# pylint: skip-file
class YeditException(Exception):
''' Exception class for Yedit '''
pass
class Yedit(object):
''' Class to modify yaml files '''
re_valid_key = r"(((\[-?\d+\])|([a-zA-Z-./]+)).?)+$"
re_key = r"(?:\[(-?\d+)\])|([a-zA-Z-./]+)"
def __init__(self, filename=None, content=None, c... | ivanhorvath/openshift-tools | openshift/installer/vendored/openshift-ansible-git-2016-04-18/roles/lib_yaml_editor/build/src/yedit.py | Python | apache-2.0 | 6,339 | 0.001735 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | smu/geometry/topology_from_geom_test.py | Python | apache-2.0 | 8,417 | 0.00202 |
#!/usr/bin/env python
# # -*- coding: utf-8 -*-
"""
title : __main__.py
description : entry point for core sira component
usage : python sira [OPTIONS]
-h Display this usage message
-d [input_directory] Specify the directory with the required
... | GeoscienceAustralia/sifra | __main__.py | Python | apache-2.0 | 11,130 | 0.001977 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.