repo_name stringlengths 8 92 | path stringlengths 5 221 | copies stringclasses 10
values | size stringlengths 4 6 | content stringlengths 974 828k | license stringclasses 15
values | hash int64 -9,212,977,344,346,658,000 9,220,224,517B | line_mean float64 8.67 91.6 | line_max int64 15 966 | alpha_frac float64 0.29 0.86 | autogenerated bool 1
class | nl_text stringlengths 0 164k | nl_size int64 0 164k | nl_language stringclasses 17
values | nl_language_score float64 0.04 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sc3/cookcountyjail | scraper/inmates_scraper.py | 1 | 1938 | from monitor import MONITOR_VERBOSE_DMSG_LEVEL
from concurrent_base import ConcurrentBase
WORKERS_TO_START = 25
CCJ_INMATE_DETAILS_URL = 'http://www2.cookcountysheriff.org/search2/details.asp?jailnumber='
class InmatesScraper(ConcurrentBase):
def __init__(self, http, inmates, inmate_details_class, monitor, wor... | gpl-3.0 | -4,363,237,560,352,292,400 | 42.066667 | 104 | 0.674923 | false | 0 | en | 0.110449 | |
jcchoiling/learningPython | s13/Day12/rabbit_rpc_server.py | 1 | 1296 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Janice Cheng
"""
把诘个服务器端改成在一个类中
"""
import pika
import subprocess
credentials = pika.PlainCredentials('janice', 'janice123')
parameters = pika.ConnectionParameters('172.16.201.134', 5672, '/', credentials)
connection = pika.BlockingConnection(parameters)
chan... | gpl-3.0 | 7,917,972,075,697,951,000 | 25.717391 | 95 | 0.648208 | false | 把诘个服务器端改成在一个类中
!/usr/bin/env python -*- coding: utf-8 -*- Author: Janice Cheng 把这里改成 subprocess 来执行这条命令在对列里获取数据 | 112 | zh | 0.692752 |
Roel/Gyrid | gyrid/core.py | 1 | 1416 | #-*- coding: utf-8 -*-
#
# This file belongs to Gyrid.
#
# Gyrid is a mobile device scanner.
# Copyright (C) 2013 Roel Huybrechts
#
# 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... | gpl-3.0 | -5,951,183,939,177,816,000 | 25.716981 | 71 | 0.673729 | false | Wrapper to start a function within a new thread.
@param f The function to run inside the thread.
-*- coding: utf-8 -*- This file belongs to Gyrid. Gyrid is a mobile device scanner. Copyright (C) 2013 Roel Huybrechts This program is free software: you can redistribute it and/or modify it under the terms of the GNU... | 831 | en | 0.895233 |
Hossein-Noroozpour/PyHGEE | core/HGEMesh.py | 1 | 1774 | # coding=utf-8
"""
Module for handling OpenGL buffers.
"""
__author__ = "Hossein Noroozpour"
from OpenGL import GL
import ctypes
class Mesh():
"""
A class that hold mesh information about an actor
"""
def __init__(self, elements, indices):
temp_list = [0]
# noinspection PyCallingNonCal... | mit | -570,652,836,376,594,700 | 30.140351 | 103 | 0.590192 | false | A class that hold mesh information about an actor
Bind itself.
Draw.
Module for handling OpenGL buffers.
coding=utf-8 noinspection PyCallingNonCallable noinspection PyCallingNonCallable noinspection PyCallingNonCallable noinspection PyCallingNonCallable | 255 | en | 0.49189 |
MatthewWilkes/reportlab | tests/test_platypus_pleaseturnover.py | 1 | 9102 | #Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
"""Tests pleaseTurnOver, pageBreakBefore, frameBreakBefore, keepWithNext...
"""
__version__='''$Id$'''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOutDir(__name__)
import sys
import unitte... | bsd-3-clause | -1,114,615,133,043,673,600 | 42.342857 | 245 | 0.683366 | false | Test multi-page splitting of paragraphs (eyeball-test).
PTO stands for Please Turn Over and is a means for
specifying content to be inserted when stuff goes over a page.
This makes one long multi-page paragraph.
The page frame used for all PDF documents.
Tests pleaseTurnOver, pageBreakBefore, frameBreakBefore, keepWith... | 438 | en | 0.669643 |
ajbouh/tfi | src/tfi/driver/tf/doc.py | 1 | 12857 | import tfi.json
import tensorflow as tf
import os.path
import tfi.data
import tfi.doc
from google.protobuf.json_format import ParseDict
from tfi.parse.docstring import GoogleDocstring
def _detect_method_documentation(*, bibliographer, model, method_name, method, signature_def):
# NOTE(adamb) Since we don't want ... | mit | 4,932,963,218,364,086,000 | 35.842407 | 101 | 0.542584 | false | NOTE(adamb) Since we don't want to be parsing rst here, we'll just rewrite it to include detected citations. Expect that this rst will be parsed for real when rendering HTML. NOTE(adamb) Since we don't want to be parsing rst here, we'll just rewrite it to include detected citations. Expect that this rst wil... | 750 | en | 0.7291 |
commaai/openpilot | selfdrive/manager/helpers.py | 1 | 1058 | import os
import sys
import fcntl
import errno
import signal
def unblock_stdout():
# get a non-blocking stdout
child_pid, child_pty = os.forkpty()
if child_pid != 0: # parent
# child is in its own process group, manually pass kill signals
signal.signal(signal.SIGINT, lambda signum, frame: os.kill(chil... | mit | -6,387,018,691,051,045,000 | 26.842105 | 98 | 0.648393 | false | get a non-blocking stdout parent child is in its own process group, manually pass kill signals os.wait() returns a tuple with the pid and a 16 bit value whose low byte is the signal number and whose high byte is the exit satus | 226 | en | 0.870272 |
ONSdigital/ras-frontstage | frontstage/error_handlers.py | 1 | 2963 | import logging
from flask import render_template, request, url_for
from flask_wtf.csrf import CSRFError
from requests.exceptions import ConnectionError
from structlog import wrap_logger
from werkzeug.utils import redirect
from frontstage import app
from frontstage.common.session import Session
from frontstage.excepti... | mit | 3,384,516,966,222,632,400 | 31.56044 | 118 | 0.733378 | false | 0 | en | 0.110449 | |
manmedia/PythonToggleCharacterCases | switchLetterCase.py | 1 | 4097 | #
# A module capable of changing alphabet letter cases.
#
# It uses very generic Python functionality to ensure
# backward compatibility.
#
#
# The programme processes a set of characters by default
# If no character is entered for processing, the programme
# simply exists. This can be turned off by setting 'a' to 1
# ... | apache-2.0 | -4,100,419,698,377,441,000 | 31.259843 | 156 | 0.569685 | false | A module capable of changing alphabet letter cases. It uses very generic Python functionality to ensure backward compatibility. The programme processes a set of characters by default If no character is entered for processing, the programme simply exists. This can be turned off by setting 'a' to 1 (for all vowels) or 2 ... | 718 | en | 0.696311 |
rajul/tvb-framework | tvb/tests/framework/adapters/visualizers/sensorsviewer_test.py | 1 | 6778 | # -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http://... | gpl-2.0 | 5,474,133,759,831,826,000 | 40.084848 | 120 | 0.689141 | false | Unit-tests for Sensors viewers.
Sets up the environment for running the tests;
creates a test user, a test project, a connectivity and a surface;
imports a CFF data-set
Gather all the tests in a test suite.
Clean-up tests data
Check that all required keys are present in output from EegSensorViewer launch.
Check that al... | 2,031 | en | 0.817512 |
sio2project/oioioi | oioioi/programs/migrations/0001_initial.py | 1 | 12159 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
import oioioi.base.fields
import oioioi.contests.fields
import oioioi.filetracker.fields
import oioioi.problems.models
import oioioi.programs.models
class Migration(migrations.Mi... | gpl-3.0 | 440,767,678,400,920,770 | 58.024272 | 610 | 0.582531 | false | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
Azure/azure-storage-python | azure-storage-common/azure/storage/common/_error.py | 1 | 9025 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from sys i... | mit | 5,352,687,308,642,604,000 | 40.399083 | 126 | 0.688753 | false | Represents a fatal error when attempting to sign a request.
In general, the cause of this exception is user error. For example, the given account key is not valid.
Please visit https://docs.microsoft.com/en-us/azure/storage/common/storage-create-storage-account for more info.
don't throw exception if the resource doesn... | 1,228 | en | 0.811867 |
Nonse/Feel_Like | reservations/models.py | 1 | 3171 | from django.db import models
class Reservation(models.Model):
start_time = models.DateTimeField()
end_time = models.DateTimeField()
customer = models.ForeignKey('Customer')
coach = models.ForeignKey('Coach')
product = models.ForeignKey('Product')
location = models.CharField(max_length=200)
... | apache-2.0 | 4,771,702,382,574,460,000 | 35.448276 | 104 | 0.675497 | false | Finnish postal code length999,99 maxunicode for (finnish) letters Finnish postal code length | 92 | en | 0.452766 |
shoaibkamil/asp | asp/jit/asp_module.py | 1 | 19070 | import codepy, codepy.jit, codepy.toolchain, codepy.bpl, codepy.cuda
from asp.util import *
import asp.codegen.cpp_ast as cpp_ast
import pickle
from variant_history import *
import sqlite3
import asp
import scala_module
class ASPDB(object):
def __init__(self, specializer, persistent=False):
"""
sp... | bsd-3-clause | 484,791,479,455,267,650 | 40.187905 | 210 | 0.581122 | false | Class to encapsulate a backend for Asp. A backend is the combination of a CodePy module
(which contains the actual functions) and a CodePy compiler toolchain.
ASPModule is the main coordination class for specializers. A specializer creates an ASPModule to contain
all of its specialized functions, and adds functions/l... | 4,056 | en | 0.783025 |
aptivate/ihpresultsweb | ihp/submissions/indicator_funcs.py | 1 | 4263 | from models import AgencyCountries, Country8DPFix, CountryExclusion, NotApplicable, Rating
from consts import NA_STR
base_selector = lambda q : q.baseline_value
cur_selector = lambda q : q.latest_value
def float_or_none(x):
if NotApplicable.objects.is_not_applicable(x):
return NA_STR
try:
ret... | gpl-3.0 | -8,658,099,590,199,005,000 | 31.295455 | 97 | 0.600516 | false | In some countries certain processes do not exists the watchlist reduces the denominator if the agency is active in such a country for a particular question | 155 | en | 0.85171 |
SSJohns/osf.io | website/project/views/node.py | 1 | 44261 | # -*- coding: utf-8 -*-
import logging
import httplib as http
import math
from itertools import islice
from flask import request
from modularodm import Q
from modularodm.exceptions import ModularOdmException, ValidationValueError
from framework import status
from framework.utils import iso8601format
from framework.mo... | apache-2.0 | 1,658,704,265,551,296,800 | 31.497063 | 130 | 0.605657 | false | :param Node node: Node to which pointers will be added
:param list pointers: Nodes to add as pointers
Serialize a node for use in pointer search.
:param Node node: Node to serialize
:return: Dictionary of node data
Build a JSON object containing everything needed to render
project.view.mako.
Add a single pointer to a ... | 3,025 | en | 0.789098 |
kogotko/carburetor | openstack_dashboard/dashboards/project/firewalls/views.py | 1 | 16454 | # Copyright 2013, Big Switch Networks, 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 applic... | apache-2.0 | -1,994,469,539,088,781,300 | 36.480638 | 78 | 0.633402 | false | Copyright 2013, Big Switch Networks, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to... | 591 | en | 0.858522 |
tensorflow/examples | tensorflow_examples/models/densenet/train.py | 1 | 6447 | # 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... | apache-2.0 | 9,165,127,955,172,058,000 | 31.725888 | 80 | 0.633473 | false | Train class.
Args:
epochs: Number of epochs
enable_function: If True, wraps the train_step and test_step in tf.function
model: Densenet model.
Custom training and testing loop.
Args:
train_dataset: Training dataset
test_dataset: Testing dataset
Returns:
train_loss, train_accuracy, test_loss, test_accurac... | 1,254 | en | 0.740434 |
taxpon/ndb_prop_gen | tests/test_arg.py | 1 | 1669 | import unittest
from ndb_prop_gen.arg import Arg
from ndb_prop_gen.arg import find_prop_type
sample_property = """\
@property
def sample_float(self):
return self._sample_float
"""
class TestArg(unittest.TestCase):
def setUp(self):
self.sample1 = Arg("sample_float", "Float", 0.0)
... | mit | -7,284,871,098,851,032,000 | 31.096154 | 101 | 0.6429 | false | non fuzzy fuzzy non ndb | 23 | it | 0.740016 |
maas/maas | src/maasserver/clusterrpc/tests/test_utils.py | 1 | 10192 | # Copyright 2014-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for :py:mod:`maasserver.clusterrpc.utils`."""
import random
from unittest.mock import Mock, sentinel
from django.core.exceptions import NON_FIELD_ERRORS, Validatio... | agpl-3.0 | -8,039,558,217,288,535,000 | 39.444444 | 79 | 0.647174 | false | Fake twisted Failure object.
Purposely doesn't call super().__init__().
Tests for `utils.call_clusters`.
Tests for `utils.call_rakcks_synchronously`.
Tests for :py:mod:`maasserver.clusterrpc.utils`.
Copyright 2014-2016 Canonical Ltd. This software is licensed under the GNU Affero General Public License version 3 (s... | 695 | en | 0.862661 |
stadelmanma/OpenPNM | OpenPNM/Network/__Delaunay__.py | 1 | 16258 | # -*- coding: utf-8 -*-
"""
===============================================================================
Delaunay: Generate random networks based on Delaunay Tessellations
===============================================================================
"""
import sys
import scipy as sp
import numpy as np
import Open... | mit | 3,054,005,862,668,982,000 | 41.560209 | 85 | 0.548714 | false | This class contains the methods for creating a *Delaunay* network topology
based connecting pores with a Delaunay tessellation.
Parameters
----------
name : string
A unique name for the network
domain_size : list of floats, [Lx,Ly,Lz]
Bounding cube for internal pore positions
num_pores : int
Number of pore... | 4,557 | en | 0.845586 |
FabriceSalvaire/mupdf-v1.3 | bindings/example.py | 1 | 15058 | #! /usr/bin/env python
# -*- Python -*-
####################################################################################################
import argparse
import sys
import numpy as np
import mupdf as cmupdf
from MuPDF import *
from PyQt4 import QtCore, QtGui
####################################################... | agpl-3.0 | 8,527,913,039,060,901,000 | 34.682464 | 108 | 0.521052 | false | ! /usr/bin/env python -*- Python -*- vertical_layout.addWidget(text_browser) scroll_area.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) Set container_widget layout Append span to line Empty span then append a block Append line to blockmain_window.show() Create a context to hold the exception stack and various ... | 1,996 | en | 0.767379 |
twitter/pants | src/python/pants/backend/jvm/ivy_utils.py | 1 | 51293 | # 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 json
import logging
import os
import pkgutil
import threading
import xml.etree.Ele... | apache-2.0 | -425,431,684,784,504,900 | 40.837684 | 111 | 0.651765 | false | Indicates an unparseable version number.
Contains the abstracted results of a resolve.
With this we can do a simple fetch.
Indicates an error preparing an ivy operation.
A resolve result that uses the frozen resolution to look up dependencies.
Resolves ivy artifacts using the coordinates from a previous resolve.
:API:... | 12,503 | en | 0.868099 |
patochectp/navitia | source/tyr/migrations/versions/3e56c7e0a4a4_create_billing_plan_table.py | 1 | 2152 | """Create billing_plan table
Revision ID: 3e56c7e0a4a4
Revises: 3aaddd5707bd
Create Date: 2015-11-05 13:30:32.460413
"""
revision = '3e56c7e0a4a4'
down_revision = '3aaddd5707bd'
from alembic import op, context
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.types import Enum
def... | agpl-3.0 | 2,663,967,288,322,674,700 | 40.384615 | 350 | 0.664963 | false | Create billing_plan table
Revision ID: 3e56c7e0a4a4
Revises: 3aaddd5707bd
Create Date: 2015-11-05 13:30:32.460413 | 114 | en | 0.279462 |
vincegogh/ByteOS | util/syscall_gen.py | 1 | 1793 | import sys as _sys
if len(_sys.argv) != 2:
print("Incorrect number of arguments")
exit(-1)
elif ["c", "h", "asm"].index(_sys.argv[1]) == -1:
print("Invalid filetype %s" % _sys.argv[1])
exit(-1)
print("\t\033[32;1mGenerating\033[0m include/gen/syscall_gen.%s" % _sys.argv[1])
syscall_list = []
def sys... | mit | 3,375,265,367,951,926,000 | 22.906667 | 96 | 0.596765 | false | 0 | en | 0.110449 | |
Ezhil-Language-Foundation/open-tamil | tests/transliterate_tests.py | 1 | 9299 | # -*- coding: utf-8 -*-
# (C) 2013-2018,2020 Muthiah Annamalai
#
# This file is part of 'open-tamil' package tests
#
# setup the paths
import unittest
from opentamiltests import *
from tamil.utf8 import get_letters
from transliterate import azhagi, jaffna, combinational, UOM, ISO, itrans, algorithm
class ReverseTran... | mit | 1,226,422,652,849,312,500 | 33.493927 | 96 | 0.540728 | false | -*- coding: utf-8 -*- (C) 2013-2018,2020 Muthiah Annamalai This file is part of 'open-tamil' package tests setup the paths University of Madras Lexicon style transliteration standard import pprint pprint.pprint(greedy.options) test for challenge use a probabilistic model on Tamil language to score the next letter, inst... | 482 | en | 0.708296 |
Lantero/vcenter-driver | setup.py | 1 | 1071 | from setuptools import setup, find_packages
setup(
version='4.2.0',
name='vcdriver',
description='A vcenter driver based on pyvmomi, fabric and pywinrm',
url='https://github.com/Lantero/vcdriver',
author='Carlos Ruiz Lantero',
author_email='carlos.ruiz.lantero@gmail.com',
license='MIT',
... | mit | -2,964,818,212,189,995,000 | 35.931034 | 74 | 0.615313 | false | 0 | en | 0.110449 | |
edeno/Jadhav-2016-Data-Analysis | tests/spectral/test_transforms.py | 1 | 11984 | import numpy as np
from pytest import mark
from scipy.signal import correlate
from nitime.algorithms.spectral import dpss_windows as nitime_dpss_windows
from src.spectral.transforms import (Multitaper, _add_axes,
_auto_correlation, _fix_taper_sign,
... | gpl-3.0 | -1,963,308,179,923,673,600 | 37.658065 | 75 | 0.623248 | false | Add dimension if no trials Add two dimensions if no trials and signals if there is a trial dimension, do nothing Begin with negative lobe Begin with positive lobe | 162 | en | 0.7823 |
ARodri/Lars | lars/mapper/io/http.py | 1 | 2559 | import requests
import functools
import json
from lars.mapper import Mapper
from lars.util import PeriodicTask
class HTTPRequest(Mapper):
valid_actions = ['GET','POST']
def loadConfigJSON(self,config):
self.base_url = config['base_url']
self.action = config['action']
self.output_key = config['output_key']
... | gpl-2.0 | 2,684,987,604,786,061,000 | 29.831325 | 92 | 0.720203 | false | super(JSONRequest, self).loadConfigJSON(config)resp_code = resp.codeself.logger.error(resp.body)raise requests.exceptions.HTTPError("HTTP_CODE: %s; %s" % (resp_code, resp.body))record[self.output_key] = json.loads(resp.body) | 224 | en | 0.200505 |
eseom/glide | glide/process.py | 1 | 5210 | import os
import multiprocessing
import asyncore
import datetime
class Status(object):
"""process status enum"""
REDY, RUNN, RSTT, STNG, KLNG, STPD, EXTD = \
'READY', 'RUNNING', 'RESTARTING', \
'STOPPING', 'KILLING', 'STOPPED', 'EXITED'
class Process(asyncore.file_dispatcher):
"""main p... | mit | -5,170,071,940,740,597,000 | 29.828402 | 80 | 0.51881 | false | initial status READY max name length blast module blast index register the pipe's reader descriptor to asyncore set the child process as a process group master itself read data from the pipe's reader blast to the registered blast module tried to read after the descriptor closed no such process id | 297 | en | 0.789867 |
rjschwei/azure-sdk-for-python | azure-mgmt-logic/azure/mgmt/logic/models/x12_validation_override.py | 1 | 3184 | # 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 ... | mit | 9,220,224,516,508,743,000 | 52.966102 | 252 | 0.685616 | false | X12ValidationOverride.
:param message_id: The message id on which the validation settings has to
be applied.
:type message_id: str
:param validate_edi_types: The value indicating whether to validate EDI
types.
:type validate_edi_types: bool
:param validate_xsd_types: The value indicating whether to validate XSD
typ... | 1,576 | en | 0.476933 |
frombeijingwithlove/dlcv_for_beginners | chap8/mxnet/train_lenet5.py | 1 | 1811 | import mxnet as mx
import logging
# data & preprocessing
data = mx.symbol.Variable('data')
# 1st conv
conv1 = mx.symbol.Convolution(data=data, kernel=(5, 5), num_filter=20)
pool1 = mx.symbol.Pooling(data=conv1, pool_type="max",
kernel=(2, 2), stride=(2, 2))
# 2nd conv
conv2 = mx.symbol.Convo... | bsd-3-clause | -5,082,072,010,840,330,000 | 27.296875 | 71 | 0.661513 | false | data & preprocessing 1st conv 2nd conv 1st fc & relu 2nd fc loss | 64 | en | 0.943548 |
admitad/admitad-python-api | admitad/tests/test_campaigns.py | 1 | 3571 | # coding: utf-8
from __future__ import unicode_literals
import unittest
import responses
from admitad.items import Campaigns, CampaignsForWebsite, \
CampaignsManage
from admitad.tests.base import BaseTestCase
class CampaignsTestCase(BaseTestCase):
def test_get_campaigns_request(self):
with response... | mit | -4,248,813,920,931,956,000 | 31.463636 | 96 | 0.532344 | false | coding: utf-8 | 13 | en | 0.832876 |
iagcl/data_pipeline | data_pipeline/db/filedb.py | 1 | 3423 | # 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... | apache-2.0 | -8,469,073,670,559,711,000 | 31.292453 | 79 | 0.621677 | false | Return wrapper around file handle that reads line by line
:param str tablename
Files containing this tablename as its basename
will be read line-by-line as the query result.
:param int arraysize Unused
:param tuple values Unused
:param tuple post_process_func
Function to execute on each record after retriev... | 1,194 | en | 0.860112 |
stuliveshere/PySeis | docs/notebooks/toolbox/toolbox.py | 1 | 9786 | import numpy as np
import matplotlib.pyplot as pylab
from matplotlib.widgets import Slider
#==================================================
# decorators
#==================================================
def io(func):
'''
an io decorator that allows
inpu... | mit | -8,316,606,742,452,979,000 | 29.391304 | 129 | 0.474249 | false | ================================================== decorators==================================================================================================== display tools==================================================~ def build_vels(times, velocit... | 675 | en | 0.397657 |
amdor/skyscraper | tests/test_scraper_service.py | 1 | 1401 | import os
import unittest
from skyscraper.scraper_service import ScraperServiceFactory
from skyscraper.utils.constants import SPEEDOMETER_KEY, AGE_KEY, CAR_KEY, PRICE_KEY, POWER_KEY, CURRENCY_KEY
from common_test_utils import gather_extension_files, VALIDATION_DATA
class TestScraping(unittest.TestCase):
files_under... | mit | 1,581,957,246,233,209,900 | 42.78125 | 108 | 0.741613 | false | 0 | en | 0.110449 | |
ibis-project/ibis | ibis/tests/sql/test_compiler.py | 1 | 70526 | import datetime
import unittest
import pytest
import ibis
import ibis.expr.api as api
import ibis.expr.operations as ops
from ibis.backends.base.sql.compiler import Compiler, QueryContext
from ibis.tests.expr.mocks import MockConnection
pytest.importorskip('sqlalchemy')
class TestASTBuilder(unittest.TestCase):
... | apache-2.0 | 6,561,207,592,762,721,000 | 26.559984 | 94 | 0.550832 | false | 790, make sure the filter stays put Check that the joined tables are not altered 790, this behavior was different before Check various exprs The filter is in the joined subtable Things like table.column.{sum, mean, ...}() Maybe the result handler should act on the cursor. Not sure. 740 Maybe the result handler should a... | 4,346 | en | 0.864339 |
FabriceSalvaire/grouped-purchase-order | GroupedPurchaseOrder/views/account.py | 1 | 13035 | ####################################################################################################
#
# GroupedPurchaseOrder - A Django Application.
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... | agpl-3.0 | -8,662,595,971,610,037,000 | 38.984663 | 115 | 0.531109 | false | Override the default AuthenticationForm in order to add HTML5 attributes. This is the only
change done and needed
Override the default PasswordChangeForm in order to add HTML5 attributes. This is the only
change done and needed
Override the default PasswordResetForm in order to add HTML5 attributes. This is the only... | 1,847 | en | 0.824331 |
bros-bioinfo/bros-bioinfo.github.io | COURS/M1/SEMESTRE1/ALGO_PROG/ALGO/Eliot/Pile_File.py | 1 | 1911 | import random as rd
class Pile(list):
def creer_pile(self): # Renvoie une nouvelle pile vide.
return self
def empiler(self, e): # Empile l ’ élément ’ e ’ dans la pile ’P’.
self.append(e)
def depiler(self): # Dépile un élément de la pile ’P’ et renvoie cet élément .
return... | mit | -1,065,698,792,782,147,600 | 23.706667 | 105 | 0.571506 | false | Renvoie une nouvelle pile vide. Empile l ’ élément ’ e ’ dans la pile ’P’. Dépile un élément de la pile ’P’ et renvoie cet élément . renvoie le nombre d’ éléments contenu dans la pile ’P’. class File(deque): def creer_file(self): Renvoie une nouvelle f i l e vide . return self def enfiler(self,... | 1,010 | fr | 0.415556 |
offby1/icalendar | src/doctest.py | 1 | 100415 | # Module doctest.
# Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org).
# Major enhancements and refactoring by:
# Jim Fulton
# Edward Loper
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
r"""Module doctest -- a framework for running examples in docstrings.
In... | lgpl-2.1 | -6,574,874,216,653,466,000 | 36.135725 | 79 | 0.569975 | false | Module doctest. Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org). Major enhancements and refactoring by: Jim Fulton Edward Loper Provided as-is; use at your own risk; no warranty; no promises; enjoy! 0, Option Flags 1. Utility Functions 2. Example & DocTest 3. Doctest Parser 4. Doctest ... | 13,666 | en | 0.836942 |
Adamssss/projectEuler | Problem 001-150 Python/pb102.py | 1 | 1225 | import math
import time
t1 = time.time()
# read the trianlges into a list
f = open('pb102_triangles.txt','r')
tris= f.read().split('\n')
f.close()
def totri(tl):
triangle = []
temp = tl.split(',')
for i in range(0,3):
triangle.append([tonumber(temp[2*i]),tonumber(temp[2*i+1])])
return trian... | mit | -3,754,334,336,298,502,700 | 19.081967 | 68 | 0.533061 | false | read the trianlges into a list | 30 | en | 0.927214 |
quimaguirre/diana | diana/toolbox/parse_clinical_trials.py | 1 | 12367 | ##############################################################################
# Clinical trials parser
#
# eg 2013-2016
##############################################################################
import cPickle, os, re
def main():
#base_dir = "../data/ct/"
base_dir = "/home/eguney/data/ct/"
file_name ... | mit | 6,743,207,231,642,477,000 | 35.266862 | 189 | 0.646802 | false | Clinical trials parser eg 2013-2016base_dir = "../data/ct/"False)phase, status, fda_regulated, why_stopped, results_date = ctid_to_values[ctid] In the disease data set Get mesh name to mesh id mapping Get CT info Get CT - MeSH disease mapping no partial overlapprint len(intervention_to_mesh_name), intervention_to_mesh_... | 2,054 | en | 0.488239 |
openstack/vitrage | vitrage/tests/unit/evaluator/template_validation/content/v1/test_parameters_validator.py | 1 | 1656 | # Copyright 2019 - Nokia
#
# 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, sof... | apache-2.0 | 2,761,177,479,609,274,000 | 38.428571 | 79 | 0.71256 | false | Tests for the parameters validator of version 1
All tests should succeed, as long as there is no get_param reference in
the template itself
Copyright 2019 - Nokia 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 ... | 688 | en | 0.8613 |
skitoo/kivy-particle | kivyparticle/engine.py | 1 | 18189 | # -*- coding: utf-8 -*-
from kivy.uix.widget import Widget
from kivy.clock import Clock
from kivy.graphics import Color, Callback, Rotate, PushMatrix, PopMatrix, Translate, Quad
from kivy.graphics.opengl import glBlendFunc, GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_ONE_MINUS_SRC_ALPHA, GL... | mit | -5,275,556,113,248,403,000 | 44.246269 | 221 | 0.633185 | false | -*- coding: utf-8 -*- if particle isn't initialized yet, you can't change its texture.glBlendFunc(self.blend_factor_source, self.blend_factor_dest)glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) colors rotation advance existing particles create and advance new particles | 272 | en | 0.74783 |
benpicco/mate-panflute | src/panflute/tests/runner.py | 1 | 13587 | #! /usr/bin/env python
# Panflute
# Copyright (C) 2010 Paul Kuliniewicz <paul@kuliniewicz.org>
#
# 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, or (at your option)
# any late... | gpl-2.0 | -8,133,091,465,736,039,000 | 30.894366 | 112 | 0.502024 | false | ! /usr/bin/env python Panflute Copyright (C) 2010 Paul Kuliniewicz <paul@kuliniewicz.org> 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, or (at your option) any later version. This ... | 1,542 | en | 0.925768 |
savionok/RemoteHID | RemoteHidPythonServer/udpEchoServer.py | 1 | 2375 | #############################################################################
# Copyright 2012 Virtosu Sava #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
# Yo... | apache-2.0 | 1,390,608,810,056,242,400 | 45.54 | 77 | 0.546947 | false | Copyright 2012 Virtosu Sava 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 ... | 1,011 | en | 0.85113 |
stamaimer/Hackthon | benchmark/stress.py | 1 | 11486 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import collections
import contextlib
import functools
import itertools
import json
import math
import os
import random
import signal
import time
import redis
import pymysql
try:
import httplib
except ImportError... | gpl-2.0 | 2,749,461,268,001,201,000 | 27.014634 | 118 | 0.566255 | false | Divide integer n to m chunks
!/usr/bin/env python -*- coding: utf-8 -*- load users remove the highest and lowest score remove the highest and lowest score noqa noqa | 170 | en | 0.623583 |
taurenk/Crossfit-Project-API | app/models.py | 1 | 1269 | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
athlete_teams = db.Table('athlete_teams',
db.Column('athlete_id', db.Integer, db.ForeignKey('athletes.id')),
db.Column('team_id', db.Integer, db.ForeignKey('teams.id'))
)
class Athlete(db.Model):
__tablename__ = 'athletes'
id = d... | mit | 4,826,109,988,930,293,000 | 27.863636 | 70 | 0.5855 | false | 0 | en | 0.110449 | |
bird-house/esgf-pyclient | pyesgf/search/context.py | 1 | 11482 | """
Module :mod:`pyesgf.search.context`
===================================
Defines the :class:`SearchContext` class which represents each ESGF search
query.
"""
import copy
from ..multidict import MultiDict
from .constraints import GeospatialConstraint
from .consts import (TYPE_DATASET, TYPE_FILE, TYPE_AGGREGATI... | bsd-3-clause | 6,040,383,211,571,339,000 | 34.438272 | 79 | 0.592144 | false | Instances of this class represent the state of a current search.
It exposes what facets are available to select and the facet counts
if they are available.
Subclasses of this class can restrict the search options. For instance
FileSearchContext, DatasetSerachContext or CMIP5SearchContext
SearchContext instances are ... | 4,064 | en | 0.704729 |
wutienyang/ES_pttmovie | auto/pttmovie/crawler.py | 1 | 8864 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import os
import re
import sys
import json
import requests
import argparse
import time
import codecs
from bs4 import BeautifulSoup
from six import u
__version__ = '1.0'
# if python 2, disable verify flag in requests.... | mit | -7,976,881,766,051,306,000 | 40.647619 | 147 | 0.529614 | false | -*- coding: utf-8 -*- if python 2, disable verify flag in requests.get() args.a ex. link would be <a href="/bbs/PublicServan/M.1127742013.A.240.html">Re: [問題] 職等</a> last div of last page remove meta nodes remove and keep push nodes 移除 '※ 發信站:' (starts with u'\u203b'), '◆ From:' (starts with u'\u25c6'), 空行及多餘空白 保留英數字, ... | 649 | en | 0.295468 |
rjkeller/gentoo-installer | BuildKernel.py | 1 | 1521 | #!/usr/bin/env python
import fileinput
import sys
///<summary>
///Provides a bunch of operations to format and manage hard disks.
///
///One cool thing that this class does is allow you to generate a fstab file
///based on disk formatting operations conducted earlier using this class. This
///is helpful when installin... | apache-2.0 | 1,754,916,898,967,739,600 | 33.568182 | 123 | 0.560158 | false | !/usr/bin/env python | 20 | fr | 0.225372 |
lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/available_providers_list.py | 1 | 1183 | # 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 ... | mit | 3,548,818,472,367,509,000 | 32.8 | 85 | 0.605241 | false | List of available countries with details.
All required parameters must be populated in order to send to Azure.
:param countries: Required. List of available countries.
:type countries:
list[~azure.mgmt.network.v2017_09_01.models.AvailableProvidersListCountry]
coding=utf-8 ------------------------------------------... | 717 | en | 0.613316 |
hjoliver/cylc | cylc/flow/command_polling.py | 1 | 3469 | # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | gpl-3.0 | -7,614,361,080,997,373,000 | 34.762887 | 79 | 0.59066 | false | Encapsulates polling activity for cylc commands. Derived classes
must override the check() method to test the polling condition.
Add command line options for commands that can do polling
Abstract method. Test polling condition.
Poll for the condition embodied by self.check().
Return True if condition met, or False if p... | 1,276 | en | 0.88954 |
brglng/zobject | .ycm_extra_conf.py | 1 | 6274 | # This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | lgpl-3.0 | 2,080,756,639,750,032,000 | 34.050279 | 82 | 0.687121 | false | This file is NOT licensed under the GPLv3, which is the license for the rest of YouCompleteMe. Here's the license text for this file: This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code fo... | 3,247 | en | 0.907357 |
imanhodjaev/django-userapp | django_userapp/backends.py | 1 | 2120 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.conf import settings
from .request import login
import re
UserModel = get_user_model()
class UserappBackend(object):
def authenticate(self, username=None, password=None, request=None, **... | lgpl-3.0 | -3,423,429,394,243,385,000 | 30.641791 | 92 | 0.579245 | false | Basically checks features and if finds any match returns True
-*- coding: utf-8 -*- If user is new user then set username Means that user was created by our backend | 167 | en | 0.954962 |
jptomo/rpython-lang-scheme | rpython/rlib/parsing/parsing.py | 1 | 12986 | import py
from rpython.rlib.parsing.lexer import SourcePos
from rpython.rlib.parsing.tree import Node, Symbol, Nonterminal
class Rule(object):
def __init__(self, nonterminal, expansions):
self.nonterminal = nonterminal
self.expansions = expansions
def getkey(self):
return (self.nonterm... | mit | -8,121,115,071,978,187,000 | 36.423631 | 86 | 0.54243 | false | def __hash__(self): return hash(self.getkey()) + 1 is because source_pos is 0-based and humans 1-basedprint i, symbolprint self.matched.keys() for the annotator XXX hack unnice: handles the sort of token names that ebnfparse producesprint "\n".join(self.allcode) XXX __init__ parse | 288 | en | 0.422637 |
CosmicLaserShow/CosmicLaserShow | pysparc/pysparc/ftdi_chip.py | 1 | 7036 | """Access FTDI hardware.
Contents
--------
:class:`Error`
Base error class.
:class:`DeviceNotFoundError`
Raised when device is not connected.
:class:`DeviceError`
Raised for generic pylibftdi exceptions.
:class:`ReadError`
Raised on read errors.
:class:`WriteError`
Raised on write errors.
:cl... | mit | -7,149,492,045,259,250,000 | 25.651515 | 114 | 0.599915 | false | Raised when trying a read/write operation if device is closed.
Raised for generic pylibftdi exceptions.
Raised when device is not connected.
Base error class.
Access FTDI hardware.
Instantiate this class to get access to connected FTDI hardware.
The hardware device is opened during instantiation.
You can use the :met... | 2,764 | en | 0.81441 |
lucidfrontier45/PyVB | pyvb/old_ver/vbgmm1d.py | 1 | 7659 | #!/usr/bin/python
import numpy as np
from numpy.random import randn,dirichlet
from scipy.linalg import det, inv
from scipy.cluster import vq
from scipy.special import psi,gammaln
from core import normalize
try:
from _vbgmm1d import _evaluateHiddenState_C, _lnPD_C
ext_imported = True
except:
ext_imported = False
... | bsd-3-clause | 8,080,979,700,107,704,000 | 29.272727 | 84 | 0.577099 | false | !/usr/bin/python log normalization constant of 1D Wishart hidden states mixing coefficientsself.u = np.tile(self._u0,nmix) posterior mean vector posterior degree of freedom posterior precision <tau_k> <ln(t_k)> very slow! need Fortran or C codes variational lower bound need to be updated !! <lnp(X|Z,theta)> very slow!... | 1,092 | en | 0.327344 |
lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/_pytest/main.py | 1 | 26632 | """ core implementation of testing process: init, session, runtest loop. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import fnmatch
import functools
import os
import pkgutil
import sys
import warnings
import attr
import py
import s... | mit | -9,025,339,223,619,723,000 | 33.452781 | 109 | 0.576938 | false | signals a stop as failed test run.
signals an interrupted test run.
raised if matching cannot locate a matching names.
Attempts to detect if ``path`` is the root of a Virtual Environment by
checking for the existence of the appropriate activate script
default command line protocol for initialization, session,
runnin... | 3,033 | en | 0.809438 |
listyque/TACTIC-Handler | thlib/ui/items/ui_commit_item.py | 1 | 4255 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'items\ui_commit_item.ui'
#
# Created: Sat Oct 5 00:17:13 2019
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from thlib.side.Qt import QtWidgets as QtGui
from thlib.side.Qt imp... | epl-1.0 | 1,223,322,050,095,421,700 | 48.476744 | 147 | 0.709988 | false | -*- coding: utf-8 -*- Form implementation generated from reading ui file 'items\ui_commit_item.ui' Created: Sat Oct 5 00:17:13 2019 by: pyside-uic 0.2.15 running on PySide 1.2.4 WARNING! All changes made in this file will be lost! | 236 | en | 0.780266 |
sapcc/monasca-agent | tests_to_fix/test_iis.py | 1 | 1049 | import unittest
import logging
from nose.plugins.attrib import attr
from nose.plugins.skip import SkipTest
from tests.common import get_check
logging.basicConfig()
CONFIG = """
init_config:
instances:
- host: .
dimensions:
dim1: value1
dim2: value2
"""
class IISTestCase(unitt... | bsd-3-clause | -8,427,825,189,620,956,000 | 23.395349 | 69 | 0.616778 | false | Make sure each metric was captured Make sure everything is tagged correctly | 75 | en | 0.977175 |
quaddra/engage-utils | engage_utils/resource_utils.py | 1 | 19792 | """
Utilities for parsing/pretty-printing resource definitions and instances.
Objects that can be converted to/from JSON have the following methods:
* from_json(parsed_data) [static method] - given json data that has been parsed
into python via json.load() or json.loads(), construct an instance of the
associat... | apache-2.0 | -2,461,870,873,917,238,300 | 37.505837 | 108 | 0.567451 | false | If two resources have the same key but different values, we don't permit a comparison add extra props | 101 | en | 0.813581 |
jschaf/windows-config | pycmd-init.py | 1 | 9710 | # -*- coding: utf-8 -*-
# Example init.py for documentation purposes
#
# Use this file as a template/example for creating an
# initialization/configuration script for PyCmd. Scripts are loaded and applied
# based on the following rules:
#
# * If present, an init.py script in PyCmd's installation directory is
# auto... | bsd-2-clause | -5,130,049,946,097,819,000 | 38.958848 | 84 | 0.669413 | false | Custom prompt that displays the name of the current git branch in addition
to the typical "abbreviated current path" PyCmd prompt.
Requires git & grep to be present in the PATH.
-*- coding: utf-8 -*- Example init.py for documentation purposes Use this file as a template/example for creating an initialization/configu... | 6,510 | en | 0.809983 |
sato9hara/defragTrees | paper/tests/paper_synthetic2.py | 1 | 3367 | # -*- coding: utf-8 -*-
"""
@author: Satoshi Hara
"""
import sys
import os
sys.path.append(os.path.abspath('./'))
sys.path.append(os.path.abspath('./baselines/'))
sys.path.append(os.path.abspath('../'))
import numpy as np
import paper_sub
from RForest import RForest
import matplotlib
matplotlib.use('Agg')
import mat... | mit | -4,752,114,063,472,154,000 | 32.346535 | 135 | 0.571429 | false | @author: Satoshi Hara
-*- coding: utf-8 -*- setting data - boundary data - train data - test save demo_Rpaper_sub.run(prefix, Kmax, restart, treenum=treenum, modeltype='classification', plot=True, plot_line=[[t, z]]) plot | 223 | en | 0.464544 |
mbdriscoll/indigo | indigo/backends/backend.py | 1 | 25493 | import logging
import abc, time
import numpy as np
import scipy.sparse as spp
from contextlib import contextmanager
import indigo.operators as op
from indigo.util import profile
log = logging.getLogger(__name__)
class Backend(object):
"""
Provides the routines and data structures necessary to implement
a... | bsd-3-clause | -2,364,064,529,511,427,600 | 33.637228 | 170 | 0.506453 | false | Provides the routines and data structures necessary to implement
a linear operator chain on different platforms.
A device-resident sparse matrix in CSR format.
A device-resident sparse matrix in DIA format.
N-dimensional array in device memory.
Parameters
----------
backend : indigo.backends.Backend
Backend instan... | 3,765 | en | 0.423742 |
yaricom/brainhash | src/experiment_cA5_10_dt_th_al_ah_bl_bh.py | 1 | 2063 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The experiment with 10 Hz/5Hz, wisp, attention, 70, cA 5, delta, theta, alpha low, alpha high, beta low, beta high, batch size = 10 and
balanced data set
@author: yaric
"""
import experiment as ex
import config
from time import time
n_hidden = 5
batch_size = 10
ex... | gpl-3.0 | -1,605,927,457,288,513,500 | 31.746032 | 136 | 0.641299 | false | The experiment with 10 Hz/5Hz, wisp, attention, 70, cA 5, delta, theta, alpha low, alpha high, beta low, beta high, batch size = 10 and
balanced data set
@author: yaric
!/usr/bin/env python3 -*- coding: utf-8 -*- will be used as parent dir for analyzer results The sample records identifiers Setup analyzer configurat... | 352 | en | 0.719646 |
Shiimoe/Pimbot | bot.py | 1 | 2261 | import discord
import asyncio
from numpy import random
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
if message.content.startswith('erp with me pimbot'):
... | gpl-3.0 | 2,294,426,036,851,443,000 | 40.109091 | 134 | 0.733304 | false | if message.content.startswith('!best'):myid = '<@201909896357216256>'await client.send_message(message.channel, ' : %s is the best ' % myid)if message.content.startswith('hello <@343915078074236929>'):myid = '<@343915078074236929>'await client.send_message(message.channel, myid + ' says hello') | 295 | en | 0.243981 |
thomasorb/orb | orb/utils/fft.py | 1 | 13896 | #!/usr/bin/python
# *-* coding: utf-8 *-*
# Author: Thomas Martin <thomas.martin.1@ulaval.ca>
# File: fft.py
## Copyright (c) 2010-2020 Thomas Martin <thomas.martin.1@ulaval.ca>
##
## This file is part of ORB
##
## ORB is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Pu... | gpl-3.0 | -8,758,207,435,317,938,000 | 32.565217 | 95 | 0.610463 | false | Return the broadening of the gaussian-sinc function in the
spectrum for a given apodization level. Unit is that of the fwhm.
:param apod: Apodization level (must be >= 1.)
Return the width of the gaussian window for a given apodization level.
:param apod: Apodization level (must be >= 1.)
The apodization level is th... | 6,935 | en | 0.751569 |
MeerkatLabs/gnucash-reporting | gnucash_reports/commands/reports.py | 1 | 3287 | """
This is the main execution program for the reporting library.
"""
from __future__ import absolute_import
import argparse
import glob
import logging
import os
import simplejson as json
from gnucash_reports.wrapper import initialize
from gnucash_reports.reports import run_report
from gnucash_reports.configuration ... | mit | -3,509,458,222,486,998,000 | 31.544554 | 99 | 0.642835 | false | 0 | en | 0.110449 | |
alexliew/learn_python_the_hard_way | projects/gothonweb/gothonweb/tests/app_tests.py | 1 | 1099 | import os
import unittest
import tempfile
from nose.tools import *
from app import app
from gothonweb.tests.tools import assert_response
app.config['TESTING'] = True
test_app = app.test_client()
def test_index():
# check that we get a 404 on the /hello URL
resp = test_app.get("/hello")
assert_response(res... | mit | 2,481,793,237,079,290,000 | 24.55814 | 49 | 0.636033 | false | check that we get a 404 on the /hello URL test our first GET request to / test our first GET request to /game make sure default values work for the form test that we get expected values class GothonWebTestCase(unittest.TestCase): def setUp(self): app.app.config['TESTING'] = True self.app = app.app.t... | 416 | en | 0.469871 |
marksweiss/sofine | sofine/runner.py | 1 | 19931 | """
This module is the main driver for calls to plugins from the CLI interface.
It also has all of the scaffolding and wrapper functions required to generically invoke
and run any of the supported plugin methods in the plugin interface for any plugin
using just the plugin name, plugin group and call args.
"""
impor... | mit | -5,049,273,920,547,250,000 | 46.007075 | 130 | 0.6956 | false | Convert returned dict of attributes into a list of individual dicts. This allows all data from all plugins to be added to the output without needing namespacing to prevent attributed keys from overwriting each other. Namespacing can optionally be turned on by the caller. Take the data returned, get the list of dicts ... | 1,516 | en | 0.859132 |
arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/alpha/trecento/exceldiff.py | 1 | 2662 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from music21.ext import xlrd
#sys.path.append('/mit/cuthbert/www/music21')
if len(sys.argv) != 3:
raise Exception("Need two arguments to diff!")
if (sys.argv[1].count(':') == 1):
(book1name, sheetname1) = sys.argv[1].split(':')
if (book1name.count('... | mit | -3,328,757,419,221,253,000 | 28.910112 | 92 | 0.586777 | false | !/usr/bin/python -*- coding: utf-8 -*-sys.path.append('/mit/cuthbert/www/music21') doesnt matter which doesnt matter which------------------------------------------------------------------------------ eof | 204 | en | 0.437525 |
dirkhusemann/rezzme | RezzMe/launchers/linux2.py | 1 | 5118 | #!/usr/bin/python
# -*- encoding: utf-8 -*-
# Copyright (c) Contributors, http://opensimulator.org/
# See CONTRIBUTORS.TXT for a full list of copyright holders.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * ... | bsd-3-clause | 8,639,283,520,196,367,000 | 39.619048 | 137 | 0.635795 | false | !/usr/bin/python -*- encoding: utf-8 -*- Copyright (c) Contributors, http://opensimulator.org/ See CONTRIBUTORS.TXT for a full list of copyright holders. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions ... | 1,767 | en | 0.879807 |
rueckstiess/mtools | mtools/mlogfilter/filters/fast_filter.py | 1 | 1215 | from .base_filter import BaseFilter
class FastFilter(BaseFilter):
"""
FastFilter class.
Accept only lines that have a duration that is shorter than the specified
parameter in ms.
"""
filterArgs = [
('--fast', {'action': 'store', 'nargs': '?', 'default': False,
'ty... | apache-2.0 | -160,321,035,544,508,300 | 30.973684 | 77 | 0.553909 | false | FastFilter class.
Accept only lines that have a duration that is shorter than the specified
parameter in ms.
Process line.
Overwrite BaseFilter.accept() and return True if the provided
logevent should be accepted (causing output), or False if not. | 249 | en | 0.700352 |
marrow/mongo | marrow/mongo/core/field/oid.py | 1 | 1116 | # encoding: utf-8
from __future__ import unicode_literals
from bson import ObjectId as OID
from collections import MutableMapping
from datetime import datetime, timedelta
from .base import Field
from ....schema import Attribute
from ....schema.compat import unicode
class ObjectId(Field):
__foreign__ = 'objectId'
... | mit | 7,631,403,063,071,038,000 | 25.571429 | 76 | 0.701613 | false | encoding: utf-8 Assign a default if one has not been given. But only if we're actually the primary key. pylint:disable=unnecessary-lambda pylint:disable=unused-argument | 168 | en | 0.645523 |
majdigital/bigworldgraph | backend/tests/mock_nlp.py | 1 | 1055 | class MockTokenizer:
@staticmethod
def tokenize(sentence_data):
return sentence_data.split(" ") # Yes, yes, very sophisticated
class MockTagger:
def __init__(self, naive_tag_rule):
assert callable(naive_tag_rule)
self.naive_tag_rule = naive_tag_rule
def tag(self, tokenized_se... | mit | 3,103,457,414,177,886,000 | 28.305556 | 103 | 0.483412 | false | Yes, yes, very sophisticated | 28 | en | 0.923308 |
stoic1979/careermaker | server.py | 1 | 9828 | from flask import Flask, render_template, request, redirect, jsonify, make_response
from models import User, Candidate, \
Company, Vacancy, JobCategory, Skill, db, app
import md5
from flask_pymongo import PyMongo
import traceback
import os
import jwt
import datetime
from functools import wraps
import json
from ... | gpl-3.0 | 804,700,029,827,939,800 | 29.521739 | 119 | 0.597477 | false | Since mongodb's _id of each record was not getting json encoded, so this custom JSONEncoder is needed Setup login manager admin.add_view(ModelView(Skill, db.session)) admin.add_view(ChildVinameew(Skill, db.session)) ret['Company Name'] = cname ret.append(result) ret... | 537 | en | 0.593244 |
jastination/software-engineering-excercise-repository | seer_python/interviewstreet/LuckyNumber.py | 1 | 1265 | '''
Created on May 25, 2012
@author: jjhuang
'''
def getAllPrimeNumber(N):
ret = []
for n in range(2, N + 1):
isPrime = True
for i in range(2, n//2 + 1):
if(n % i == 0):
isPrime = False
break
if(isPrime):
... | mit | 6,946,488,043,172,524,000 | 16.071429 | 49 | 0.355731 | false | Created on May 25, 2012
@author: jjhuang
T = int(input()) for t in range(T):A,B = [int(x) for x in input().split(" ")] cnt = 0 n = A while(n<=B): a = 0 b = 0 nn = n while(nn > 0): d = nn % MOD a += table1[d] b += table2[d] nn //= MOD ... | 415 | en | 0.684323 |
DXCanas/kolibri | kolibri/core/content/test/test_data_migrations.py | 1 | 3147 | import uuid
from kolibri.core.auth.test.migrationtestcase import TestMigrations
from kolibri.core.content.models import ChannelMetadata as RealChannelMetadata
from kolibri.core.content.models import ContentNode as RealContentNode
class ChannelFieldsTestCase(TestMigrations):
migrate_from = '0011_auto_20180907_10... | mit | 4,337,543,030,775,321,600 | 48.171875 | 110 | 0.512552 | false | unavailable objects which should not be included in calculations | 64 | en | 0.967534 |
steder/maroonmpi | subunit/python/subunit/tests/test_subunit_tags.py | 1 | 2324 | #
# subunit: extensions to python unittest to get test results from subprocesses.
# Copyright (C) 2005 Robert Collins <robertc@robertcollins.net>
#
# 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 Foun... | gpl-2.0 | -8,039,500,400,970,692,000 | 32.2 | 80 | 0.63296 | false | Tests for subunit.tag_stream.
subunit: extensions to python unittest to get test results from subprocesses. Copyright (C) 2005 Robert Collins <robertc@robertcollins.net> 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 ... | 859 | en | 0.876396 |
erzel/vitess | test/vtctld2_web_status_test.py | 1 | 9662 | #!/usr/bin/env python
"""A vtctld2 webdriver test that tests the different views of status page."""
import logging
import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
fr... | bsd-3-clause | -6,158,431,562,120,354,000 | 39.767932 | 80 | 0.65297 | false | Checking that all dropdowns have the correct options and selection.
Checking that the view has the correct number of heatmaps drawn.
Checking the dropdowns and heatmaps for each newly routed view.
Set up two keyspaces: one unsharded, one with two shards.
A vtctld2 webdriver test that tests the different views of status... | 693 | en | 0.853483 |
liampauling/flumine | flumine/strategy/runnercontext.py | 1 | 1835 | import logging
import datetime
from typing import Optional
logger = logging.getLogger(__name__)
class RunnerContext:
"""Runner context at strategy level"""
def __init__(self, selection_id: int):
self.selection_id = selection_id
self.invested = False
self.datetime_last_placed = None
... | mit | 4,729,211,881,912,501,000 | 27.671875 | 78 | 0.585286 | false | Runner context at strategy level | 32 | en | 0.936042 |
katadh/ngdl | ngdl.py | 1 | 9612 | import re
import nltk
import ngdl_classes
import global_vars
import ngdl_parse
import ngdl_write
def start_dialog(output_file="test.txt"):
if not global_vars.initialized:
global_vars.init()
else:
reset_global_vars()
output = open(output_file, "w")
print "Welcome to the natural language... | gpl-3.0 | 578,165,373,975,564,700 | 38.073171 | 139 | 0.577507 | false | print "First we'll work on defining the game environment"confirmation = raw_input("To confirm, there will be " + board_size[0] + " columns and " + board_size[1] + " rows?: ")def piece_move_dialog():result = tree.find_closest_node("RESULT") | 239 | en | 0.660828 |
Dicotomix/DicotomixNewSrv | server.py | 1 | 12287 | import asyncio
import struct
import dictionary
import datetime
import tests
from collections import *
from os import listdir
from os.path import isfile, join
from enum import Enum
from dicotomix import Dicotomix, Direction, NotFoundException, OrderException
import unidecode
import sys
import numpy as np
ENABLE_TESTS =... | mit | -5,168,988,374,299,193,000 | 35.032258 | 96 | 0.482787 | false | spelling mode send users list get user name extract (cumulative frequency, word) from the whole dictionaryfor w in feed_words[:100]:print(w) custom wordvalidate letter in spelling modefor f,l in new_letters:print(f,l) ask UI to start spelling mode | 247 | en | 0.650467 |
geodynamics/citcoms | visual/Mayavi2/original_plugins/Citcoms_Hdf2Vtk.py | 1 | 22127 | #!/usr/bin/env python
# Script to generate TVTK files from CitcomS hdf files
# author: Martin Weier
# Copyright (C) 2006 California Institue of Technology
#
# 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
# ... | gpl-2.0 | -704,908,123,187,786,500 | 34.011076 | 173 | 0.519953 | false | !/usr/bin/env python Script to generate TVTK files from CitcomS hdf files author: Martin Weier Copyright (C) 2006 California Institue of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Softwa... | 4,569 | en | 0.536191 |
inveniosoftware/invenio-communities | tests/records/collections/test_collections.py | 1 | 3019 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2021 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Community module tests."""
import pytest
from flask import url_for
from invenio_a... | mit | 7,395,856,467,491,684,000 | 29.806122 | 132 | 0.650547 | false | Test collection permissions.
Test basic operations on collections.
Community module tests.
-*- coding: utf-8 -*- This file is part of Invenio. Copyright (C) 2016-2021 CERN. Invenio is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. list cr... | 452 | en | 0.757965 |
jorgb/airs | gui/images/progress_2.py | 1 | 5705 | #----------------------------------------------------------------------
# This file was generated by D:\personal\src\airs\gui\images\make_images.py
#
from wx import ImageFromStream, BitmapFromImage, EmptyIcon
import cStringIO, zlib
def getData():
return zlib.decompress(
'x\xda\x01\xbe\x06A\xf9\x89PNG\r\n... | gpl-2.0 | 4,576,252,422,895,433,000 | 65.117647 | 77 | 0.697108 | false | ---------------------------------------------------------------------- This file was generated by D:\personal\src\airs\gui\images\make_images.py | 144 | en | 0.614311 |
fanglinfang/myuw | myuw/logger/session_log.py | 1 | 1051 | from myuw.dao.affiliation import get_base_campus
from myuw.dao.enrollment import get_current_quarter_enrollment
from myuw.dao.gws import is_grad_student, is_undergrad_student
import logging
import json
import hashlib
logger = logging.getLogger('session')
def log_session(netid, session_key, request):
if session_k... | apache-2.0 | 1,625,579,248,412,522,000 | 31.84375 | 67 | 0.642245 | false | 0 | en | 0.110449 | |
shiblon/pytour | 3/tutorials/generators3.py | 1 | 2336 | # vim:tw=50
"""Generators for Refactoring
Now that we know how to make our own generators,
let's do some refactoring to make use of this idea
and clean up the code a bit. We'll start by
splitting out the |clean_lines| function, which
basically just skips blank lines and comments,
stripping unnecessary space.
This no... | apache-2.0 | -6,395,722,228,013,602,000 | 29.736842 | 68 | 0.689212 | false | Generators for Refactoring
Now that we know how to make our own generators,
let's do some refactoring to make use of this idea
and clean up the code a bit. We'll start by
splitting out the |clean_lines| function, which
basically just skips blank lines and comments,
stripping unnecessary space.
This notion of converti... | 1,358 | en | 0.890141 |
anish/buildbot | master/buildbot/test/unit/test_reporters_notifier.py | 1 | 14563 | # This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | gpl-2.0 | 6,238,227,632,631,262,000 | 40.847701 | 104 | 0.661334 | false | This file is part of Buildbot. Buildbot is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implie... | 878 | en | 0.892672 |
igorsobreira/eizzek | tests/unit/test_register.py | 1 | 4055 | import re
from unittest import TestCase
from eizzek.lib.registry import PluginRegistry, SessionPluginRegistry
class PluginRegistryTest(TestCase):
def setUp(self):
self.registry = PluginRegistry()
def ping(**kwargs):
return ''
self.ping = ping
self.regex = ... | mit | -8,068,151,602,769,320,000 | 29.037037 | 100 | 0.590136 | false | ignore duplicates by name by callable, using __name__ attribute ignore duplicates by callable, using ``name`` attribute | 127 | en | 0.675155 |
monsta-hd/ml-mnist | ml_mnist/tests/test_model_selection.py | 1 | 5910 | import numpy as np
from unittest import skip
from ml_mnist.model_selection import TrainTestSplitter as TTS
class TestSplit(object):
def setUp(self):
self.y = np.array([1, 1, 1, 2, 2, 3, 3,
1, 1, 2, 2, 2, 3, 3,
1, 1, 2, 2, 3, 3, 3])
def test_split... | mit | -991,270,284,764,097,200 | 47.442623 | 106 | 0.528426 | false | Ensure order is preserved if no shuffle (for different number of folds).
Ensure stratification is preserved if no shuffle.
Ensure stratification is preserved even with shuffling.
Ensure order is preserved if no shuffle.
Ensure for fixed (known) `random_seed` TTS instances produce
the same outputs (for the same inputs).... | 613 | en | 0.767651 |
be-cloud-be/horizon-addons | horizon/school_documentation/source/_extensions/github_link.py | 1 | 3522 | import inspect
import importlib
import os.path
from urlparse import urlunsplit
"""
* adds github_link(mode) context variable: provides URL (in relevant mode) of
current document on github
* if sphinx.ext.linkcode is enabled, automatically generates github linkcode
links (by setting config.linkcode_resolve)
Settin... | agpl-3.0 | -8,153,371,989,408,569,000 | 32.542857 | 96 | 0.636286 | false | Add github_link function linking to the current page on github
Resolves provided object to corresponding github URL
TODO: js? TODO: attributes/properties don't have modules, maybe try to look them up based on their cached host object? get original from decorated methods obj doesn't have a module, or s... | 648 | en | 0.919746 |
cavestruz/L500analysis | plotting/profiles/T_Vr_evolution/Vr_evolution/plot_Vrall_nu_binned_r500c.py | 1 | 3207 | from L500analysis.data_io.get_cluster_data import GetClusterData
from L500analysis.utils.utils import aexp2redshift
from L500analysis.plotting.tools.figure_formatting import *
from L500analysis.plotting.profiles.tools.profiles_percentile \
import *
from L500analysis.plotting.profiles.tools.select_profiles \
imp... | mit | 24,674,641,612,658,730 | 35.033708 | 90 | 0.586218 | false | 1, 1.7, 2.3, 2.7 | 16 | zh | 0.206848 |
goldsborough/ig | ig/colors.py | 1 | 1072 | import random
def random_color(base, variation):
'''
Returns a random, bounded color value.
Args:
base: Some base color component (between 0 and 255)
variation: The degree of variation (around the color)
Returns:
A random color.
'''
color = base + (2 * random.random()... | mit | 1,673,187,914,116,669,000 | 23.363636 | 75 | 0.570896 | false | Aggregates information about the color scheme of the visualization.
Constructor.
Args:
base_colors: The base colors around which to vary
Generates a color.
Returns:
A new RGBA color value.
Returns a random, bounded color value.
Args:
base: Some base color component (between 0 and 255)
variation: The ... | 388 | en | 0.671742 |
NERC-CEH/jules-jasmin | job_runner/job_runner/controllers/jobs.py | 1 | 5375 | """
# Majic
# Copyright (C) 2014 CEH
#
# 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 pr... | gpl-2.0 | 8,434,452,970,082,947,000 | 33.455128 | 100 | 0.641302 | false | 0 | en | 0.110449 | |
parantapa/pbdset | pbdset.py | 1 | 14786 | # encoding: utf-8
# pylint: disable=too-many-instance-attributes
# pylint: disable=attribute-defined-outside-init
#
# ____________________/\
# \______ \______ )/______
# | ___/| | _// ___/
# | | | | \\___ \
# |____| |______ /____ >
#... | mit | 649,836,582,525,200,100 | 27.822612 | 80 | 0.532328 | false | encoding: utf-8 pylint: disable=too-many-instance-attributes pylint: disable=attribute-defined-outside-init ____________________/\ \______ \______ )/______ | ___/| | _// ___/ | | | | \\___ \ |____| |______ /____ > ... | 1,132 | en | 0.561157 |
cactusbin/nyt | matplotlib/lib/matplotlib/backend_bases.py | 1 | 106941 | """
Abstract base classes define the primitives that renderers and
graphics contexts must implement to serve as a matplotlib backend
:class:`RendererBase`
An abstract base class to handle drawing/rendering operations.
:class:`FigureCanvasBase`
The abstraction layer that separates the
:class:`matplotlib.fi... | unlicense | 6,469,178,272,311,308,000 | 32.419063 | 81 | 0.562338 | false | An event triggered by a figure being closed
In addition to the :class:`Event` attributes, the following event
attributes are defined:
An event triggered by a draw operation on the canvas
In addition to the :class:`Event` attributes, the following event
attributes are defined:
*renderer*
the :class:`RendererBase`... | 39,428 | en | 0.783887 |
artdent/jgments | src/com/google/jgments/extract.py | 1 | 13331 | #!/usr/bin/python
#
# Copyright 2010 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 follo... | bsd-2-clause | 4,275,517,555,670,912,500 | 34.836022 | 88 | 0.702123 | false | Configuration object describing where to write files.
Attributes:
package: package name for generated java files.
basedir: directory to prepend to the package path.
outfile: open file to write to. If None, a path will be derived
from the other arguments.
Translates token matcher tuples into Java syntax.
Retr... | 4,971 | en | 0.816579 |
mazvv/travelcrm | travelcrm/views/contracts.py | 1 | 7715 | # -*-coding: utf-8-*-
import logging
from pyramid.view import view_config, view_defaults
from pyramid.httpexceptions import HTTPFound
from . import BaseView
from ..models import DBSession
from ..models.contract import Contract
from ..lib.bl.contracts import get_contract_copy
from ..lib.bl.subscriptions import subscr... | gpl-3.0 | 532,814,128,972,921,660 | 25.788194 | 67 | 0.516397 | false | -*-coding: utf-8-*- | 19 | en | 0.661345 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.