repo_name stringlengths 5 92 | path stringlengths 4 221 | copies stringclasses 19
values | size stringlengths 4 6 | content stringlengths 766 896k | license stringclasses 15
values | hash int64 -9,223,277,421,539,062,000 9,223,102,107B | line_mean float64 6.51 99.9 | line_max int64 32 997 | alpha_frac float64 0.25 0.96 | autogenerated bool 1
class | ratio float64 1.5 13.6 | config_test bool 2
classes | has_no_keywords bool 2
classes | few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
twz915/django | django/core/serializers/json.py | 1 | 3709 | """
Serialize data to/from JSON
"""
import datetime
import decimal
import json
import sys
import uuid
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import (
Deserializer as PythonDeserializer, Serializer as PythonSerializer,
)
from django.utils import six
from d... | bsd-3-clause | -3,236,497,983,382,932,500 | 31.535088 | 85 | 0.60151 | false | 4.139509 | false | false | false |
nexec/vkcopy2mp3p | vkcopy2mp3p.py | 1 | 4785 | #!/usr/bin/python2
# -*- coding: utf-8 -*-
import sqlite3 as db
import sys
import os
import pycurl
import StringIO
import re
import urllib
import json
from random import shuffle
PROFILE = 'default'
argc = len(sys.argv)
if argc < 3 or argc > 4:
sys.stderr.write('Usage: %s /path/to/dir count_of_songs [PROFILE]\n'... | gpl-2.0 | 6,050,023,060,319,584,000 | 26.819767 | 142 | 0.672727 | false | 2.533086 | false | false | false |
veveykocute/Spl | splc.py | 1 | 19239 | import sys
import math
"""A Shakespeare Compiler written in Python, splc.py
This is a compiler that implements the majority of the Shakespeare programming language
invented by Kalle Hasselstrom and Jon Aslund, I take no credit for inventing the language.
This software is free to edit or use, and though I doubt anyone ... | unlicense | 5,124,951,847,631,947,000 | 34.561922 | 158 | 0.565466 | false | 3.567402 | false | false | false |
IndyMPO/IndyGeoTools | ConvertGeography/GetAreaConversionMatrix.py | 1 | 3774 | #This script copyright 2017 Indianapolis Metropolitan Planning Organization
from __future__ import division
import arcpy
import os
import pandas as pd
import numpy as np
from subprocess import Popen
import sys
def clear_temp():
'''
Clears the temporary directory that is created when running this tool
'''
... | apache-2.0 | -4,349,660,485,601,096,700 | 34.271028 | 129 | 0.642024 | false | 3.478341 | false | false | false |
mission-peace/interview | python/dynamic/weighted_job_scheduling_max_profit.py | 1 | 1192 | """
Problem Statement
=================
Given set of jobs with start and end interval and profit, how to maximize profit such that jobs in subset do not
overlap.
Video
-----
* https://youtu.be/cr6Ip0J9izc
Complexity
----------
* Runtime Complexity: O(n^2)
* Space Complexity: O(n)
Reference Link
--------------
* ht... | apache-2.0 | -7,740,483,645,734,945,000 | 21.490566 | 112 | 0.568792 | false | 2.886199 | false | false | false |
YYWen0o0/python-frame-django | django/forms/fields.py | 1 | 47569 | """
Field classes.
"""
from __future__ import unicode_literals
import copy
import datetime
import os
import re
import sys
import warnings
from decimal import Decimal, DecimalException
from io import BytesIO
from django.core import validators
from django.core.exceptions import ValidationError
from django.forms.utils ... | bsd-3-clause | 3,579,217,377,039,823,400 | 38.087099 | 120 | 0.596712 | false | 4.478347 | false | false | false |
Wyliodrin/wyliodrin-server | tests/debugging/sim_board.py | 1 | 3409 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Board
"""
import getpass
import logging
import os
import signal
import sleekxmpp
import ssl
import sys
import threading
import time
from sleekxmpp import Message, Presence
from sleekxmpp.xmlstream import ElementBase
from sleekxmpp.xmlstream import register_stanza_p... | lgpl-3.0 | -6,279,385,483,405,430,000 | 21.136364 | 71 | 0.675858 | false | 3.194939 | false | false | false |
mooseman/pdteco | test_parser.py | 1 | 1865 |
# test_parser.py
# Try a few things with creating tokens which know the
# kind of token that should follow them.
import string, itertools
class token(object):
def __init__(self):
self.type = self.next = self.stmttype = None
self.attrdict = vars(self)
# Set an attribute
# NOTE! Thi... | unlicense | 6,974,440,820,604,117,000 | 21.46988 | 73 | 0.574263 | false | 3.499062 | false | false | false |
jtoppins/beaker | Client/src/bkr/client/task_watcher.py | 1 | 5411 | # -*- coding: utf-8 -*-
# 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.
import sys
import time
__all__ = (
"Task... | gpl-2.0 | -5,898,918,360,989,663,000 | 32.196319 | 140 | 0.56958 | false | 3.845771 | false | false | false |
TUM-AERIUS/Aerius | Raspberry/Stereo/photo-client.py | 1 | 1956 | import io
import socket
import struct
import time
import picamera
# Connect a client socket to my_server:8000 (change my_server to the
# hostname of your server)
client_socket = socket.socket()
client_socket.connect(('169.254.251.208', 8000))
# Make a file-like object out of the connection
connection = client_socket.... | mit | -2,041,568,765,425,169,400 | 35.240741 | 81 | 0.622188 | false | 4.298901 | false | false | false |
lzkelley/zcode | zcode/math/statistic.py | 1 | 25108 | """General functions for mathematical and numerical operations.
Functions
---------
- confidence_bands - Bin by `xx` to calculate confidence intervals in `yy`.
- confidence_intervals - Compute the values bounding desired confidence intervals.
- cumstats - Calculate a cumulative averag... | mit | -1,670,735,747,756,827,600 | 31.439276 | 98 | 0.57416 | false | 3.563946 | false | false | false |
marcok/odoo_modules | hr_employee_time_clock/migrations/11.0.0.0.13/post-migrate.py | 1 | 2402 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2016 - now Bytebrand Outsourcing AG (<http://www.bytebrand.net>).
#
# This program is free software: you can redistribute it and/or modify
# it... | agpl-3.0 | -8,948,538,899,177,939,000 | 37.126984 | 84 | 0.609492 | false | 4.320144 | false | false | false |
rajalokan/nova | nova/policies/server_groups.py | 1 | 2174 | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... | apache-2.0 | -7,074,195,272,985,386,000 | 26.518987 | 78 | 0.561638 | false | 3.847788 | false | false | false |
smvv/trs | src/rules/fractions.py | 1 | 14707 | # This file is part of TRS (http://math.kompiler.org)
#
# TRS is free software: you can redistribute it and/or modify it under the
# terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# TRS is distrib... | agpl-3.0 | -6,291,606,106,984,690,000 | 23.96944 | 79 | 0.540899 | false | 3.081291 | false | false | false |
dsysoev/fun-with-algorithms | queue/maxheap.py | 1 | 3185 |
"""
Max heap implementation
https://en.wikipedia.org/wiki/Min-max_heap
Algorithm Average
Build heap O(n)
"""
from __future__ import print_function
from math import log, ceil
class MaxHeap(object):
""" Binary Max heap implementation """
def __init__(self):
self.__data = []
def max_heapify(... | mit | 5,271,140,296,426,704,000 | 29.92233 | 95 | 0.539403 | false | 3.747059 | false | false | false |
googleapis/googleapis-gen | google/ads/googleads/v7/googleads-py/google/ads/googleads/v7/errors/types/billing_setup_error.py | 1 | 1902 | # -*- coding: utf-8 -*-
# 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... | apache-2.0 | 2,008,635,368,135,882,800 | 34.886792 | 75 | 0.685594 | false | 3.56848 | false | false | false |
ojii/django-nani | hvad/tests/forms.py | 1 | 5295 | # -*- coding: utf-8 -*-
from django.core.exceptions import FieldError
from hvad.forms import TranslatableModelForm, TranslatableModelFormMetaclass
from hvad.test_utils.context_managers import LanguageOverride
from hvad.test_utils.testcase import NaniTestCase
from testproject.app.models import Normal
from django.db impo... | bsd-3-clause | -6,615,196,495,451,526,000 | 36.821429 | 105 | 0.605666 | false | 4.322449 | true | false | false |
jdemel/gnuradio | gnuradio-runtime/python/gnuradio/gr/tag_utils.py | 1 | 5013 | from __future__ import unicode_literals
import pmt
from . import gr_python as gr
class PythonTag(object):
" Python container for tags "
def __init__(self):
self.offset = None
self.key = None
self.value = None
self.srcid = False
def tag_to_python(tag):
""" Convert a st... | gpl-3.0 | 2,668,344,318,893,686,300 | 33.8125 | 73 | 0.549172 | false | 3.53277 | false | false | false |
Workday/OpenFrame | native_client_sdk/src/build_tools/build_sdk.py | 1 | 36370 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Entry point for both build and try bots.
This script is invoked from XXX, usually without arguments
to package an SDK. It autom... | bsd-3-clause | 1,889,471,415,100,197,600 | 34.797244 | 79 | 0.664889 | false | 3.260421 | false | false | false |
moodpulse/l2 | refprocessor/processor.py | 1 | 1703 | from typing import Tuple, Union, List
from appconf.manager import SettingManager
from refprocessor.age_parser import AgeRight
from refprocessor.common import ValueRange, RANGE_IN
from refprocessor.result_parser import ResultRight
class RefProcessor:
def __init__(self, ref: dict, age: List[int]):
actual_k... | mit | 6,272,185,253,824,169,000 | 36.777778 | 116 | 0.606471 | false | 3.71179 | false | false | false |
TacticalGoat/reddit | AutoContributor/autocontributor.py | 1 | 2306 | #/u/GoldenSights
import praw # simple interface to the reddit API, also handles rate limiting of requests
import time
import sqlite3
'''USER CONFIGURATION'''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_to_make_your_bot_use_oauth2/
USERAGENT = ""
#This is a sho... | mit | -7,222,148,781,160,823,000 | 28.948052 | 104 | 0.652645 | false | 3.575194 | false | false | false |
spectrumone/django-outlook-api | python_tutorial/tutorial/outlookservice.py | 1 | 4799 | import requests
import uuid
import json
outlook_api_endpoint = 'https://outlook.office.com/api/v2.0{0}'
# Generic API Sending
def make_api_call(method, url, token, payload = None, parameters = None):
# Send these headers with all API calls
headers = { 'User-Agent' : 'django-tutorial/1.0',
'Aut... | mit | 156,802,696,262,218,100 | 36.787402 | 106 | 0.574703 | false | 3.933607 | false | false | false |
frankban/UbuntuPaste | ubuntupaste.py | 1 | 6417 | # This software is licensed under the GNU Affero General Public License
# version 3 (see the file LICENSE).
import itertools
import os
import pwd
import threading
import urllib
import urllib2
import webbrowser
import sublime
import sublime_plugin
class UserInterface(object):
"""User interface for this plugin.""... | agpl-3.0 | 5,063,318,384,990,150,000 | 32.773684 | 77 | 0.59171 | false | 3.870326 | false | false | false |
MontrealCorpusTools/polyglot-server | iscan/annotator/models.py | 1 | 4133 | from django.db import models
from polyglotdb import CorpusContext
# Create your models here.
class Annotation(models.Model):
ITEM_TYPE_CHOICES = (('U', 'Utterance'),
('W', 'Word'),
('Y', 'Syllable'),
('P', 'Phone'))
corpus = models.Fo... | mit | -4,415,763,708,759,667,700 | 37.990566 | 101 | 0.585289 | false | 4.036133 | false | false | false |
ningirsu/stepmania-server | smserver/smutils/smpacket/smpacket.py | 1 | 34459 | """
The ```SMpacket`` module
========================
Provide easy utilisation of the stepmania protocol.
:Example:
>>> from smserver.smutils.smpacket import smcommand
>>> from smserver.smutils.smpacket import smpacket
>>> # Create a new packet instance
>>> packet = SMPacket.new(smcom... | mit | -3,107,368,309,541,007,000 | 29.712121 | 99 | 0.605212 | false | 3.478248 | false | false | false |
isazi/Transpose | analysis/manage.py | 1 | 2009 | #!/usr/bin/env python
# Copyright 2014 Alessio Sclocco <a.sclocco@vu.nl>
#
# 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... | apache-2.0 | 2,591,675,039,704,562,000 | 41.744681 | 289 | 0.649079 | false | 3.555752 | false | false | false |
Emergen/zivios-agent | modules/ntp.py | 1 | 2447 | """
* Copyright (c) 2008 Zivios, LLC.
*
* This file is part of Zivios.
*
* Zivios is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later versio... | gpl-3.0 | -4,665,748,381,308,129,000 | 28.841463 | 71 | 0.644054 | false | 3.718845 | false | false | false |
ancafarcas/superdesk-core | superdesk/datalayer.py | 1 | 4241 | # -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import super... | agpl-3.0 | 5,146,778,410,217,942,000 | 37.908257 | 115 | 0.677906 | false | 4.054493 | false | false | false |
AusTac/parma | b3/parsers/et.py | 1 | 7934 | # BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2005 Michael "ThorN" Thornton
#
# 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... | gpl-2.0 | -8,859,111,680,739,127,000 | 38.874372 | 209 | 0.584069 | false | 3.090767 | false | false | false |
skakri/django-unstructured | wiki/core/permissions.py | 1 | 3004 | from wiki.conf import settings
###############################
# TARGET PERMISSION HANDLING #
###############################
#
# All functions are:
# can_something(target, user)
# => True/False
#
# All functions can be replaced by pointing their relevant
# settings variable in wiki.conf.settings to a callable(... | gpl-3.0 | 412,424,334,553,834,300 | 31.652174 | 85 | 0.632823 | false | 3.963061 | false | false | false |
mobify/iterstuff | iterstuff/recipes.py | 1 | 4131 | from __future__ import absolute_import
from iterstuff.lookahead import Lookahead
def repeatable_takewhile(predicate, iterable):
"""
Return successive entries from an iterable as long as the
predicate evaluates to true for each entry.
Like itertools.takewhile, but does not consume the first
elemen... | mit | -8,346,311,089,307,318,000 | 36.554545 | 77 | 0.658678 | false | 4.404051 | false | false | false |
mvpoland/django-smsgateway | smsgateway/views.py | 1 | 1834 | from django import forms
from django.http import Http404
from django.conf import settings
from django.shortcuts import render
from django.contrib.admin.views.decorators import staff_member_required
from smsgateway import send, __version__
from smsgateway.backends import get_backend
accounts = getattr(settings, 'SMSGA... | bsd-3-clause | 7,037,312,430,688,589,000 | 29.566667 | 102 | 0.632497 | false | 4.196796 | false | false | false |
wcota/dynSIS-py | dynamics.py | 1 | 8344 | #!/usr/bin/env python
# ! ## File: dynamics.py
# ! ## See README.md for more information and use
# !-----------------------------------------------------------------------------
# ! SIS epidemic model algorithm based on the article
# ! Computer Physics Communications 219C (2017) pp. 303-312
# ! "Opt... | gpl-3.0 | 8,997,114,562,609,873,000 | 40.103448 | 104 | 0.539909 | false | 3.400163 | false | false | false |
NMTHydro/Recharge | utils/TAW_optimization_subroutine/create_geo_info_file.py | 1 | 2526 | # ===============================================================================
# Copyright 2018 gabe-parrish
#
# 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/licen... | apache-2.0 | -6,306,104,769,306,550,000 | 33.148649 | 114 | 0.644101 | false | 3.934579 | false | false | false |
gurneyalex/odoo | addons/mrp/wizard/mrp_product_produce.py | 3 | 8943 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools import float_compare
class MrpProductProduce(models.TransientModel):
_name = "mrp.product... | agpl-3.0 | -4,611,204,496,198,219,300 | 45.82199 | 158 | 0.603377 | false | 4.055782 | false | false | false |
makinacorpus/reportlab-ecomobile | src/reportlab/graphics/charts/doughnut.py | 1 | 13260 | #Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/doughnut.py
# doughnut chart
__version__=''' $Id$ '''
__doc__="""Doughnut chart
Produces a circular chart like the doughnut charts pr... | bsd-3-clause | 7,873,950,994,067,001,000 | 36.994269 | 167 | 0.556259 | false | 3.9 | false | false | false |
zentralopensource/zentral | zentral/utils/rison.py | 1 | 2938 | # from https://github.com/pifantastic/python-rison
# encode a json payload in rison
# used in kibana urls
import re
IDCHAR_PUNCTUATION = '_-./~'
NOT_IDCHAR = ''.join([c for c in (chr(i) for i in range(127))
if not (c.isalnum() or c in IDCHAR_PUNCTUATION)])
# Additionally, we need to distinguis... | apache-2.0 | 1,428,220,077,565,753,000 | 23.483333 | 78 | 0.469367 | false | 3.790968 | false | false | false |
quodlibetor/dedupe | setup.py | 1 | 1174 | from __future__ import with_statement
import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup
import os
with open(os.path.join(os.path.dirname(__file__),"README.rst"), 'r') as fh:
long_desc = fh.read()
VERSION = "0.1.2"
setup(name="dedupe",
version=VERSION,
descriptio... | gpl-3.0 | 8,757,693,658,711,555,000 | 31.611111 | 83 | 0.61414 | false | 3.811688 | false | true | false |
RITct/Rita | app/secret_sauce/seqtoseq_model.py | 1 | 11243 | import random
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import optim
import torch.nn.functional as F
import pickle as pk
use_cuda = torch.cuda.is_available()
SOS_token = 0
EOS_token = 1
MAX_LENGTH = 80
class Dataset:
def __init__(self, name):
self.name = name
... | bsd-3-clause | -6,247,866,893,398,659,000 | 35.385113 | 133 | 0.631771 | false | 3.626774 | false | false | false |
nonZero/demos-python | src/examples/short/object_oriented/static_method_6.py | 1 | 1045 | #!/usr/bin/python2
'''
An example for using class methods to keep per class properties.
Once set, subclass properties shadows properties on the base class.
'''
from __future__ import print_function
class Book(object):
num = 0
def __init__(self, title):
self.title = title
self.id = self.incr... | gpl-3.0 | -7,061,124,976,053,368,000 | 19.096154 | 82 | 0.636364 | false | 3.091716 | false | false | false |
YtvwlD/yarfi | etc/yarfi/services/console_setup.py | 1 | 1300 | # YARFI - Yet Another Replacement For Init
# Copyright (C) 2014 Niklas Sombert
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ... | gpl-3.0 | -6,666,950,791,183,914,000 | 32.358974 | 71 | 0.717692 | false | 3.581267 | false | false | false |
cydenix/OpenGLCffi | OpenGLCffi/EGL/EXT/EXT/output_base.py | 1 | 1086 | from OpenGLCffi.EGL import params
@params(api='egl', prms=['dpy', 'attrib_list', 'layers', 'max_layers', 'num_layers'])
def eglGetOutputLayersEXT(dpy, attrib_list, layers, max_layers, num_layers):
pass
@params(api='egl', prms=['dpy', 'attrib_list', 'ports', 'max_ports', 'num_ports'])
def eglGetOutputPortsEXT(dpy, at... | mit | 6,723,218,600,509,176,000 | 25.487805 | 85 | 0.689687 | false | 2.749367 | false | false | false |
Edraak/circleci-edx-platform | common/djangoapps/edraak_i18n/management/commands/i18n_edraak_theme_push.py | 1 | 2382 | # * Handling merge/forks of UserProfile.meta
from django.core.management.base import BaseCommand
from django.conf import settings
import os
from subprocess import call
import polib
class Command(BaseCommand):
help = '''Run theme's ./scripts/edraak_i18n_theme_push.sh'''
@staticmethod
def remove_ignored_me... | agpl-3.0 | -8,983,956,020,593,395,000 | 36.21875 | 105 | 0.607473 | false | 3.745283 | false | false | false |
erijo/py-svndump | svndump/record.py | 1 | 5100 | # Copyright (c) 2012 Erik Johansson <erik@ejohansson.se>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This pro... | gpl-3.0 | -8,833,452,493,659,131,000 | 30.875 | 73 | 0.65902 | false | 3.950426 | false | false | false |
izapolsk/integration_tests | cfme/utils/appliance/services.py | 1 | 3411 | import attr
from cfme.utils.appliance.plugin import AppliancePlugin
from cfme.utils.appliance.plugin import AppliancePluginException
from cfme.utils.log import logger_wrap
from cfme.utils.quote import quote
from cfme.utils.wait import wait_for
class SystemdException(AppliancePluginException):
pass
@attr.s
clas... | gpl-2.0 | 2,346,904,480,859,109,000 | 29.72973 | 86 | 0.586045 | false | 4.23201 | false | false | false |
ttrifonov/horizon | horizon/horizon/dashboards/syspanel/users/tables.py | 1 | 4566 | import logging
from django import shortcuts
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from horizon import api
from horizon import tables
LOG = logging.getLogger(__name__)
class CreateUserLink(tables.LinkAction):
name = "... | apache-2.0 | -7,072,450,925,408,468,000 | 31.382979 | 79 | 0.56417 | false | 4.445959 | false | false | false |
OliverWalter/amdtk | amdtk/models/mixture.py | 1 | 3497 |
"""Mixture of distributions/densities."""
import numpy as np
from scipy.misc import logsumexp
from .discrete_latent_model import DiscreteLatentModel
from .dirichlet import Dirichlet
class MixtureStats(object):
"""Sufficient statistics for :class:BayesianMixture`.
Methods
-------
__getitem__(key)
... | bsd-2-clause | 1,982,866,318,469,026,800 | 26.535433 | 72 | 0.582213 | false | 4.005727 | false | false | false |
davidbgk/udata | udata/search/commands.py | 1 | 8335 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import sys
import signal
from contextlib import contextmanager
from datetime import datetime
from flask import current_app
from flask_script import prompt_bool
from udata.commands import submanager, IS_INTERACTIVE
from udata.search impor... | agpl-3.0 | -8,890,075,423,520,776,000 | 34.168776 | 111 | 0.616557 | false | 3.778332 | false | false | false |
DISBi/django-disbi | disbi/disbimodels.py | 1 | 7146 | """
Normal Django models with a few custom options for configuration.
If you have custom model classes that need these options, add them here and
create a child class of the appropriate options class and your custom model class.
"""
# Django
from django.db import models
class Options():
def __init__(self, di_sh... | mit | 7,004,359,213,430,258,000 | 23.898955 | 99 | 0.626784 | false | 4.346715 | false | false | false |
openhumanoids/oh-distro | software/ihmc/ihmc_step/translator_ihmc.py | 1 | 14123 | import lcm
import drc
import atlas
import bot_core
import time
import numpy as np
import py_drake_utils as ut
from bdi_step.footsteps import decode_footstep_plan, decode_deprecated_footstep_plan, encode_footstep_plan, FootGoal
from bdi_step.plotting import draw_swing
from bdi_step.utils import Behavior, gl, now_utime
... | bsd-3-clause | -3,496,072,450,974,365,000 | 45.920266 | 238 | 0.591517 | false | 3.521067 | false | false | false |
albert12132/templar | templar/api/rules/core.py | 1 | 4373 | """
The public API for Templar pre/post-processor rules.
Users can use this module with the following import statement:
from templar.api.rules import core
"""
from templar.exceptions import TemplarError
import re
class Rule:
"""Represents a preprocessor or postprocessor rule. Rules are applied in the orde... | mit | 298,352,553,187,532,500 | 40.647619 | 100 | 0.645095 | false | 4.707212 | false | false | false |
katakumpo/niceredis | niceredis/client/server.py | 1 | 6771 | # -*- coding: utf-8 *-*
import warnings
from redis.connection import Token
from redis.exceptions import ConnectionError, RedisError
from .base import RedisBase
class ServerCommands(RedisBase):
# SERVER INFORMATION
def bgrewriteaof(self):
"Tell the Redis server to rewrite the AOF file from data in m... | mit | 1,597,255,999,482,688,300 | 34.082902 | 79 | 0.640526 | false | 4.304514 | true | false | false |
asdil12/pywikibase | things.py | 1 | 4025 | #!/usr/bin/python2
import re
class BaseValue(object):
def __init__(self, value):
self.value = value
def __str__(self):
return value
def __repr__(self):
return "<%s object: %s>" % (self.__class__.__name__, self.__str__())
def to_value(self):
return self.__str__()
# Note:
# to_value: generates value as ... | gpl-3.0 | -1,003,805,324,486,820,000 | 24.636943 | 134 | 0.643478 | false | 2.877055 | false | false | false |
adrgerez/ardublockly | package/build_pyinstaller.py | 1 | 9203 | #!/usr/bin/env python2
# -*- coding: utf-8 -*- #
#
# Builds the Ardublockly Python portion of the app for Linux or OS X.
#
# Copyright (c) 2015 carlosperate https://github.com/carlosperate/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | apache-2.0 | 2,858,567,297,311,880,700 | 36.563265 | 80 | 0.641856 | false | 3.795052 | false | false | false |
iulian787/spack | var/spack/repos/builtin/packages/cctools/package.py | 2 | 4409 | # 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 Cctools(AutotoolsPackage):
"""The Cooperative Computing Tools (cctools) enable large scale... | lgpl-2.1 | -6,209,909,144,982,183,000 | 42.653465 | 113 | 0.585847 | false | 3.258684 | false | false | false |
marifersahin/pyfolio | venv/bin/player.py | 1 | 2205 | #!/Users/polizom/Django/pyfolio/venv/bin/python2.7
#
# The Python Imaging Library
# $Id$
#
from __future__ import print_function
try:
from tkinter import *
except ImportError:
from Tkinter import *
from PIL import Image, ImageTk
import sys
# -----------------------------------------------------------------... | mit | 354,823,484,656,687,040 | 20.617647 | 72 | 0.473923 | false | 4.136961 | false | false | false |
fauskanger/Pretreat | app/classes/graph/path.py | 1 | 1741 | from app.config import config
from app.pythomas import shapes as shapelib
from app.pythomas import pythomas as lib
class Path:
def __init__(self, path_nodes):
path_nodes = None if path_nodes == [None] else path_nodes
self.nodes = [] if not path_nodes else path_nodes
self.complete = False
... | gpl-2.0 | 7,555,444,032,393,306,000 | 23.180556 | 65 | 0.556577 | false | 3.817982 | false | false | false |
lmazuel/azure-sdk-for-python | azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment_create_parameters.py | 1 | 1625 | # 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 | -6,886,032,258,312,350,000 | 39.625 | 84 | 0.622154 | false | 4.391892 | false | false | false |
lucidmotifs/newtopia | newtopia/ntgame/models/effect.py | 1 | 3504 | # python modules
from enum import Enum
# django modules
from django.db import models
# nt modules
from .province import Province
from .infrastructure import Building
# meta
from ntmeta.models import Entity
class Effect(models.Model):
""" The core component of province change """
""" e.g. Peasant Growth - ... | gpl-3.0 | 7,361,919,509,951,882,000 | 30.854545 | 80 | 0.664669 | false | 4.050867 | false | false | false |
pidydx/grr | grr/lib/log_test.py | 1 | 2267 | #!/usr/bin/env python
"""Tests for logging classes."""
import logging
import time
from werkzeug import wrappers as werkzeug_wrappers
from grr.gui import wsgiapp
from grr.lib import flags
from grr.lib import log
from grr.lib import stats
from grr.lib import test_lib
from grr.lib import utils
from grr.proto import j... | apache-2.0 | 3,389,963,987,248,417,000 | 23.912088 | 70 | 0.664314 | false | 3.440061 | true | false | false |
suutari/shoop | shuup/simple_supplier/models.py | 1 | 3252 | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.conf import settings
from django.db import models
from ... | agpl-3.0 | 9,174,615,948,482,939,000 | 40.164557 | 119 | 0.718635 | false | 3.737931 | false | false | false |
pitunti/alfaPitunti | plugin.video.alfa/channels/seriesblanco.py | 1 | 13145 | # -*- coding: utf-8 -*-
import re
import urlparse
from channels import filtertools
from channelselector import get_thumb
from core import httptools
from core import scrapertoolsV2
from core import servertools
from core.item import Item
from platformcode import config, logger
from channels import autoplay
HOST = "h... | gpl-3.0 | -4,026,489,724,223,350,000 | 35.870787 | 119 | 0.564909 | false | 3.360471 | false | false | false |
TechAtNYU/feedback-service | feedback.py | 1 | 3796 | import requests
import secrets
import smtplib
headers = {
'content-type': 'application/vnd.api+json',
'accept': 'application/*, text/*',
'authorization': 'Bearer ' + secrets.tnyu_api_key
}
def get_emails(event_id, event_data, eboard_members, attendees):
res = requests.get('https://api.tnyu.org/v3/eve... | mit | 9,174,346,333,781,503,000 | 35.5 | 78 | 0.560327 | false | 3.758416 | false | false | false |
bobbyrward/fr0st | fr0stlib/gui/utils.py | 1 | 8708 | import wx, os
from functools import partial
from fr0stlib.decorators import *
def LoadIcon(*path):
# Check for an icons dir in app base path first for development
filename = os.path.join(wx.GetApp().AppBaseDir, 'icons', *path) + '.png'
if not os.path.exists(filename):
# Not there, check install p... | gpl-3.0 | 4,896,840,407,771,886,000 | 27.090323 | 95 | 0.544442 | false | 3.619285 | false | false | false |
eLRuLL/scrapy | scrapy/http/response/text.py | 1 | 9259 | """
This module implements the TextResponse class which adds encoding handling and
discovering (through HTTP headers) to base Response class.
See documentation in docs/topics/request-response.rst
"""
from contextlib import suppress
from typing import Generator
from urllib.parse import urljoin
import parsel
from w3li... | bsd-3-clause | -5,294,121,437,932,270,000 | 37.260331 | 102 | 0.587212 | false | 4.131638 | false | false | false |
dianchen96/gym | gym/envs/mujoco/mujoco_env.py | 1 | 9674 | import os
from gym import error, spaces
from gym.utils import seeding
import numpy as np
from os import path
import gym
import six
try:
import mujoco_py
from mujoco_py.mjlib import mjlib
except ImportError as e:
raise error.DependencyNotInstalled("{}. (HINT: you need to install mujoco_py, and also perform... | mit | -2,237,362,221,986,834,000 | 31.354515 | 178 | 0.572256 | false | 3.609701 | false | false | false |
chenlian2015/skia_from_google | tools/skp/page_sets/skia_jsfiddlebigcar_desktop.py | 2 | 1282 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class SkiaBuildbotDesk... | bsd-3-clause | 5,301,158,227,787,102,000 | 30.268293 | 74 | 0.710608 | false | 3.382586 | false | false | false |
soma0sd/pyNuc | ensdf/dbgen.py | 1 | 2763 | # -*- coding: utf-8 -*-
"""Inner Module Import"""
from ensdf.genlib import files
from ensdf.genlib import regexp
"""Python Packages"""
import pickle
def get_card(ident=''):
data = []
file_list = files.get_all_files()
prog = lambda i: (i+1)*100/len(file_list)
for ix, f in enumerate(file_list):
card = []
... | mit | -3,026,741,318,854,007,300 | 25.066038 | 69 | 0.500181 | false | 2.771314 | false | false | false |
jbloom/epitopefinder | scripts/epitopefinder_plotdistributioncomparison.py | 1 | 3447 | #!python
"""Script for plotting distributions of epitopes per site for two sets of sites.
Uses matplotlib. Designed to analyze output of epitopefinder_getepitopes.py.
Written by Jesse Bloom."""
import os
import sys
import random
import epitopefinder.io
import epitopefinder.plot
def main():
"""Main body of sc... | gpl-3.0 | -4,142,234,527,212,145,000 | 43.766234 | 215 | 0.668407 | false | 3.416254 | false | false | false |
dazult/EPA-2012-Residential-Exposure-SOPs | sop_calcs/forms.py | 1 | 76603 | from __future__ import absolute_import
import copy
import datetime
from itertools import chain
from urlparse import urljoin
from django.conf import settings
from django.forms.util import flatatt, to_current_timezone
from django.utils.datastructures import MultiValueDict, MergeDict
from django.utils.html import escape... | agpl-3.0 | -3,916,772,724,174,924,000 | 73.444121 | 994 | 0.63773 | false | 3.428808 | false | false | false |
mathieulavoie/Bitcluster | web/web.py | 1 | 5465 | #from web import app
from web.dao import getNodeFromAddress, getNodeInformation, getTransations, groupByAllDistribution, groupbyNode, \
groupbyAmount, groupbyDate
from flask import *
import re
import csv
import io
from datetime import datetime, timedelta
app = Flask(__name__)
@app.route('/',methods=['POST', 'G... | mit | -8,318,828,850,818,100,000 | 37.485915 | 219 | 0.654163 | false | 3.771567 | false | false | false |
CodingVault/LeetCodeInPython | sorted_array_to_binary_tree.py | 1 | 1250 | #!/usr/bin/env python
# encoding: utf-8
"""
sorted_array_to_binary_tree.py
Created by Shengwei on 2014-07-03.
"""
# https://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/
# tags: easy, tree, array, sorted, convert, D&C
"""
Given an array where elements are sorted in ascending order, convert it ... | apache-2.0 | -8,530,960,155,454,743,000 | 26.777778 | 97 | 0.5672 | false | 3.612717 | false | false | false |
balazssimon/ml-playground | udemy/lazyprogrammer/deep-reinforcement-learning-python/mountaincar/q_learning.py | 1 | 6102 | # This takes 4min 30s to run in Python 2.7
# But only 1min 30s to run in Python 3.5!
#
# Note: gym changed from version 0.7.3 to 0.8.0
# MountainCar episode length is capped at 200 in later versions.
# This means your agent can't learn as much in the earlier episodes
# since they are no longer as long.
import gym
impo... | apache-2.0 | 6,356,171,879,016,205,000 | 31.636364 | 93 | 0.674861 | false | 3.194764 | false | false | false |
dimas-lex/osbb | osb/osb/billing/testing/AccountsServiceTest.py | 1 | 2043 | # -*- coding: utf-8 -*-
from django.test import TestCase
from osb.billing.models import Accounts, Services
# from osb.billing.Services.AccountsService import AccountsService
from osb.billing.Services.AccountsService import AccountsService
from osb.billing.Services.ServiceService import *
class AccountsServiceTest(Tes... | gpl-2.0 | -9,115,395,383,184,236,000 | 33.644068 | 148 | 0.594224 | false | 3.47449 | true | false | false |
FAForever/faftools | parseudp/FAPacket.py | 1 | 10060 | #!/usr/bin/env python
import sys
import struct
import binascii
import string
import argparse
import zlib
from curses import ascii
# expects tshark on stdin as in:
# tshark -r game.pcap -R 'ip.addr==192.168.0.101' -T fields -d udp.port==6112,echo -e ip.src -e udp.srcport -e ip.dst -e udp.dstport -e frame.time_relative... | gpl-3.0 | 1,441,050,445,854,061,800 | 32.872054 | 195 | 0.48827 | false | 3.387205 | false | false | false |
mpercich/Calendarize | ios/dateparser/lib/python2.7/site-packages/ruamel/yaml/loader.py | 1 | 2063 | # coding: utf-8
from __future__ import absolute_import
from ruamel.yaml.reader import Reader
from ruamel.yaml.scanner import Scanner, RoundTripScanner
from ruamel.yaml.parser import Parser, RoundTripParser
from ruamel.yaml.composer import Composer
from ruamel.yaml.constructor import BaseConstructor, SafeConstructor, ... | mit | 5,460,430,173,511,384,000 | 37.203704 | 88 | 0.674746 | false | 4.085149 | false | false | false |
uraxy/qiidly | qiidly/command_line.py | 1 | 2094 | # -*- coding: utf-8 -*-
"""dummy docstring."""
import argparse
from qiidly import __version__, __description__
from qiidly.main import Qiidly
def _arg_parser():
parser = argparse.ArgumentParser(
prog='qiidly',
description=__description__)
parser.add_argument('-V', '--version',
... | mit | -3,202,998,623,235,872,300 | 28.083333 | 89 | 0.523878 | false | 3.996183 | false | false | false |
oneklc/dimod | dimod/views/bqm.py | 1 | 6577 | # Copyright 2018 D-Wave Systems 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... | apache-2.0 | -1,572,494,099,592,310,500 | 27.846491 | 110 | 0.550403 | false | 3.769054 | false | false | false |
51reboot/actual_09_homework | 08/zhaoyong/cmdb/userdb.py | 1 | 5201 | #encoding: utf-8
import json
import gconf
import MySQLdb
from dbutils import execute_fetch_sql
from dbutils import execute_commit_sql
'''
获取用户信息
'''
def get_users():
_columns = ('id','username','password','age')
_sql = 'select * from user'
_count,_rt_list = execute_fetch_sql(_sql)
_rt = []
for _l... | mit | -8,930,152,261,406,002,000 | 22.043689 | 135 | 0.610912 | false | 2.709475 | false | false | false |
boudewijnrempt/kura | doc/script5.py | 1 | 3804 | import os.path, sys, string, codecs
from kuralib import kuraapp
from kuragui.guiconfig import guiConf
from kuragui import guiconfig
False = 0
True = 1
def splitCSVLine(line):
"""Splits a CSV-formatted line into a list.
See: http://www.colorstudy.com/software/webware/
"""
list = []
position = 0
... | bsd-2-clause | 1,558,941,842,772,906,000 | 36.294118 | 74 | 0.431651 | false | 4.544803 | false | false | false |
elric/virtaal-debian | virtaal/plugins/spellchecker.py | 1 | 13888 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010-2011 Zuza Software Foundation
#
# This file is part of Virtaal.
#
# 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 ... | gpl-2.0 | -2,843,363,457,551,456,000 | 38.566952 | 106 | 0.589502 | false | 4.232856 | false | false | false |
endlessm/chromium-browser | third_party/catapult/dashboard/dashboard/common/request_handler.py | 1 | 4410 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Simple Request handler using Jinja2 templates."""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_im... | bsd-3-clause | -7,051,379,980,682,448,000 | 35.446281 | 79 | 0.685488 | false | 3.848168 | false | false | false |
duguhaotian/superscp | src/superscp_tool.py | 1 | 2572 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import sys
import subprocess
from pathmanager import node
from pathmanager import link
from pathmanager import paths
from pathmanager import tool
def superscp(argv):
if len(argv) != 5:
usage()
return
src = argv[2]
tip = argv[3]
td... | apache-2.0 | -9,122,752,600,971,258,000 | 27.577778 | 89 | 0.485226 | false | 3.485095 | false | false | false |
birocorneliu/conference | lib/to_delete.py | 1 | 2829 | from datetime import datetime
import endpoints
from google.appengine.ext import ndb
from google.appengine.api import taskqueue, memcache
from lib.db import Profile, Conference
from lib.models import ConflictException, ProfileForm, BooleanMessage, ConferenceForm, TeeShirtSize
MEMCACHE_ANNOUNCEMENTS_KEY = "RECENT_ANN... | apache-2.0 | 8,938,905,317,155,928,000 | 35.269231 | 99 | 0.666313 | false | 4.041429 | false | false | false |
aWhereAPI/API-Code-Samples | python/header.py | 1 | 7933 | from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import str
from builtins import bytes
from future import standard_library
standard_library.install_aliases()
from builtins import object
import requests as r... | mit | -6,602,144,733,192,833,000 | 38.272277 | 152 | 0.581117 | false | 4.190703 | true | false | false |
clucas111/delineating-linear-elements | Code/clf_preprocessing.py | 1 | 1569 | # -*- coding: utf-8 -*-
"""
@author: Chris Lucas
"""
import numpy as np
import pandas as pd
def merge_dataframes(dfs, key_field_name):
"""
Merges dataframes containing data of one class into one dataframe with
the class in a column.
Parameters
----------
dfs : dict of DataFrames
Dic... | apache-2.0 | -1,480,821,867,940,271,600 | 23.515625 | 76 | 0.605481 | false | 3.817518 | false | false | false |
jeffery-do/Vizdoombot | examples/python/scenarios.py | 1 | 2862 | #!/usr/bin/env python
#####################################################################
# This script presents how to run some scenarios.
# Configuration is loaded from "../../examples/config/<SCENARIO_NAME>.cfg" file.
# <episodes> number of episodes are played.
# Random combination of buttons is chosen for every... | mit | 2,760,447,843,961,944,000 | 36.168831 | 80 | 0.650245 | false | 3.846774 | true | false | false |
dannyperry571/theapprentice | script.module.nanscrapers/lib/nanscrapers/scraperplugins/sezonlukdizi.py | 1 | 4411 | import json
import re
import urlparse
import requests
from BeautifulSoup import BeautifulSoup
from nanscrapers.common import random_agent, replaceHTMLCodes
from ..scraper import Scraper
import xbmc
class Sezonluldizi(Scraper):
domains = ['sezonlukdizi.com']
name = "sezonlukdizi"
def __init__(self):
... | gpl-2.0 | -8,988,593,595,415,021,000 | 45.431579 | 119 | 0.407844 | false | 4.737916 | false | false | false |
hortonworks/hortonworks-sandbox | desktop/core/ext-py/Twisted/doc/web/howto/listings/PicturePile/picturepile.py | 1 | 1917 | """Run this with twistd -y."""
import os
from twisted.application import service, internet
from twisted.web.woven import page
from twisted.web import server, static
rootDirectory = os.path.expanduser("~/Pictures")
class DirectoryListing(page.Page):
templateFile = "directory-listing.html"
templateDirectory ... | apache-2.0 | 396,252,148,935,259,800 | 30.95 | 75 | 0.674491 | false | 3.952577 | false | false | false |
MeteorKepler/RICGA | ricga/ops/image_processing.py | 1 | 8197 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | -7,595,954,824,494,623,000 | 41.91623 | 94 | 0.605831 | false | 3.609423 | false | false | false |
MaximeBiset/care4care | main/migrations/0040_auto_20141205_1736.py | 1 | 12414 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import multiselectfield.db.fields
import django.core.validators
import re
class Migration(migrations.Migration):
dependencies = [
('main', '0039_merge'),
]
operations = [
migrations.... | agpl-3.0 | -4,895,663,956,325,399,000 | 47.29572 | 385 | 0.584757 | false | 4.21317 | false | false | false |
martinbalsam/timing-rp | timingrp/sanit.py | 1 | 2984 | import re
import argparse
"""
This script sanitize the raw data experted from "Timing.app",
it adds the proper double quotes around the "Path" attribute,
and it removes unwanted double quotes inside the "Path" attribute,
that may yield an unwanted escape of the field.
--- TODO ---
speedup:
as for now I'm iterating twi... | gpl-2.0 | -1,916,926,826,659,169,300 | 39.324324 | 125 | 0.629692 | false | 3.337808 | false | false | false |
chromium/chromium | build/android/gyp/native_libraries_template.py | 7 | 1781 | # Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
NATIVE_LIBRARIES_TEMPLATE = """\
// This file is autogenerated by
// build/android/gyp/write_native_libraries_java.py
// Please do not change its content... | bsd-3-clause | -5,940,693,984,739,795,000 | 44.666667 | 87 | 0.730488 | false | 3.710417 | false | false | false |
shobhitmishra/CodingProblems | LeetCode/Session3/BinaryTreePaths.py | 1 | 1149 | from typing import List
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def binaryTreePaths(self, root: TreeNode) -> List[str]:
result = []
if not root:
return result
self.binaryTreePathsHelper(ro... | mit | -7,620,993,149,577,762,000 | 26.357143 | 69 | 0.619669 | false | 3.389381 | false | false | false |
wavelets/ThinkStats2 | code/moments.py | 1 | 1149 | """This file contains code for use with "Think Bayes",
by Allen B. Downey, available from greenteapress.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import math
import thinkstats2
def RawMoment(xs, k):
return sum(x**k for x in xs) / float(len(xs))
def CentralMo... | gpl-3.0 | -3,409,726,838,714,081,000 | 19.890909 | 55 | 0.646649 | false | 2.729216 | false | false | false |
shinigota/dagpi_splendor | SplendorCode/src/mvc/Display.py | 1 | 32173 | from tkinter import *
from src.element.Card import Card
from src.element.ResourceType import ResourceType
from src.game.GameState import GameState
from src.mvc.EventType import EventType
from src.mvc.GameBoard import GameBoard
from src.mvc.GameRules import GameRules
from src.player.AI import AI
import time
class Displ... | gpl-3.0 | 5,044,571,538,574,761,000 | 40.564599 | 83 | 0.527711 | false | 3.562285 | false | false | false |
CINPLA/exana | exana/tracking/fields.py | 1 | 32391 | import numpy as np
def spatial_rate_map(x, y, t, spike_train, binsize=0.01, box_xlen=1,
box_ylen=1, mask_unvisited=True, convolve=True,
return_bins=False, smoothing=0.02):
"""Divide a 2D space in bins of size binsize**2, count the number of spikes
in each bin and divi... | gpl-3.0 | 8,174,192,474,725,353,000 | 34.9102 | 101 | 0.591244 | false | 3.476921 | false | false | false |
btovar/cctools | apps/wq_hypersweep/test.py | 1 | 1690 | from work_queue import *
import sys
def compose_task(i,j):
id = (i-1)*20+j
d_rate = i*0.05
r_blok = j
outfile = "results%d.csv" % id
command = "./script.sh results%d.csv %f %d" % (id,d_rate,r_blok)
t = Task(command)
t.specify_file("env.tar.gz", "env.tar.gz", WORK_QUEUE_INPUT, cache=True)
t.specify_file("dat... | gpl-2.0 | 2,644,520,837,213,823,500 | 25.40625 | 109 | 0.640828 | false | 2.592025 | false | false | false |
jhseu/tensorflow | tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/basic.py | 1 | 2547 | # Copyright 2019 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 | -4,427,873,526,579,521,500 | 42.169492 | 207 | 0.666667 | false | 3.273779 | false | false | false |
anak10thn/graphics-dojo-qt5 | dragmove/dragmovecharm.py | 1 | 3229 | #############################################################################
##
## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
## Contact: Qt Software Information (qt-info@nokia.com)
##
## This file is part of the Graphics Dojo project on Qt Labs.
##
## This file may be used under the terms of th... | gpl-2.0 | -7,986,007,107,172,308,000 | 31.616162 | 77 | 0.580056 | false | 4.393197 | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.