text
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
231
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
score
float64
0
0.34
import os import string import codecs import ast import math from vector3 import Vector3 filename_out = "../../Assets/cosine_table" table_size = 512 fixed_point_precision = 512 def dumpCosine(_cosine_func, display_name, f): f.write('const int ' + display_name + '[] =' + '\n') f.write('{' + '\n') ...
voitureblanche/projet-secret
work/Python-toolchain/3D/build_cosine_tables.py
Python
mit
1,178
0.043294
# Copyright (C) 2008-2010 Adam Olsen # # 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 program is distributed in the hope that...
genodeftest/exaile
xlgui/preferences/plugin.py
Python
gpl-2.0
11,178
0.000716
""" Generic Image analyzer. """ # Standard import os import logging import subprocess # Damn from damn_at import ( mimetypes, MetaDataType, MetaDataValue, FileId, FileDescription, AssetDescription, AssetId ) from damn_at.pluginmanager import IAnalyzer from damn_at.analyzer import AnalyzerEx...
peragro/peragro-at
src/damn_at/analyzers/image/analyzerimage.py
Python
bsd-3-clause
3,097
0.000323
limit = 10 ** 4 def isOK(a1,a2,a3,m): '''test if m is in the same plan as a3 vis-a-vis to a1a2''' x1, y1= float(a1[0]), float(a1[1]) x2,y2= float(a2[0]), float(a2[1]) x3,y3=float(a3[0]), float(a3[1]) x,y=float(m[0]), float(m[1]) t = (x-x1) * (y2-y1) - (y-y1) * (x2-x1) k = (x3-x1) * (y2-y1) - (y3-y1) * (x2-x1)...
nguyenkims/projecteuler-python
src/p102.py
Python
mit
1,087
0.103036
# hackerrank - Algorithms: Time Conversion # Written by James Andreou, University of Waterloo S = raw_input() TYPE = S[len(S)-2] if S[:2] == "12": if TYPE == "A": print "00" + S[2:-2] else: print S[:-2] elif TYPE == "P": HOUR = int(S[:2]) + 12 print str(HOUR) + S[2:-2] else: print S[:-2]
jamesandreou/hackerrank-solutions
warmup/hr_time_conversion.py
Python
mit
298
0.026846
__author__ = 'Stephanie' from ODMconnection import dbconnection from readSensors import readSensors from updateSensors import updateSensors from createSensors import createSensors from deleteSensors import deleteSensors __all__ = [ 'readSensors', 'updateSensors', 'createSensors', 'deleteSensors', ]
Castronova/EMIT
api_old/ODM2/Sensors/services/__init__.py
Python
gpl-2.0
319
0.00627
""" :Author: Engelbert Gruber :Contact: grubert@users.sourceforge.net :Revision: $Revision: 21817 $ :Date: $Date: 2005-07-21 13:39:57 -0700 (Thu, 21 Jul 2005) $ :Copyright: This module has been placed in the public domain. LaTeX2e document tree Writer. """ __docformat__ = 'reStructuredText' # code contributions from...
garinh/cs
docs/support/docutils/writers/latex2e.py
Python
lgpl-2.1
75,964
0.00387
#! /usr/bin/env python import sys import os import subprocess includeos_src = os.environ.get('INCLUDEOS_SRC', os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0]) sys.path.insert(0,includeos_src) from vmrunner import vmrunner # Get an auto-created V...
ingve/IncludeOS
test/fs/integration/ide_write/test.py
Python
apache-2.0
663
0.007541
from django import template from django.template.defaultfilters import stringfilter register = template.Library() STATUS_COLORS = { 'default': 'blue', 'queued': 'blue', 'undetermined': 'blue', 'infected': 'red', 'uninfected': 'green', 'deposited': 'blue', 'rejected': 'red', 'accepted':...
gustavofonseca/penne-core
frontdesk/templatetags/frontdesk.py
Python
bsd-2-clause
1,931
0.002071
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding unique constraint on 'CampUserInvitation', fields ['camp', 'user'] db.create_unique(u'events_campus...
matus-stehlik/glowing-batman
events/migrations/0002_auto__add_unique_campuserinvitation_camp_user.py
Python
mit
10,021
0.007983
"""Provides helpers for RFXtrx.""" from RFXtrx import get_device from homeassistant.core import callback from homeassistant.helpers import device_registry as dr from homeassistant.helpers.typing import HomeAssistantType @callback def async_get_device_object(hass: HomeAssistantType, device_id): """Get a device ...
aronsky/home-assistant
homeassistant/components/rfxtrx/helpers.py
Python
apache-2.0
715
0
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_07_01/operations/_application_security_groups_operations.py
Python
mit
24,325
0.005015
class Solution(object): def trap(self, height): """ :type height: List[int] :rtype: int """ l=len(height) maxheight=[0 for i in range(l)] leftmax=0 rightmax=0 res=0 for i in range(l): if height[i]>leftmax: le...
dichen001/Go4Jobs
JoeXu/42. Trapping rain water.py
Python
gpl-3.0
616
0.027597
"""Naive range analysis for expression""" from miasm2.analysis.modularintervals import ModularIntervals _op_range_handler = { "+": lambda x, y: x + y, "&": lambda x, y: x & y, "|": lambda x, y: x | y, "^": lambda x, y: x ^ y, "*": lambda x, y: x * y, ">>": lambda x, y: x >> y, "a>>": lambd...
chubbymaggie/miasm
miasm2/analysis/expression_range.py
Python
gpl-2.0
2,613
0.000383
# -*- coding: utf-8 -*- # # Copyright © 2012-2013 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """ spyderlib.py3compat ------------------- Transitional module providing compatibility functions intended to help migrating from Python 2 to Python 3. ...
CVML/winpython
winpython/py3compat.py
Python
mit
6,585
0.003949
""" This provides some useful code used by other modules. This is not to be used by the end user which is why it is hidden. """ import string, sys class LinkError(Exception): pass def refine_import_err(mod_name, extension_name, exc): """ Checks to see if the ImportError was because the library itself was...
b3c/VTK-5.8
Wrapping/Python/vtk/__helper.py
Python
bsd-3-clause
981
0.008155
#!/usr/bin/env python # -*- coding: utf-8 -*- import calendar import contextlib import ctypes import datetime import email.utils import errno import getpass import gzip import itertools import io import json import locale import math import os import pipes import platform import re import ssl import socket import stru...
laborautonomo/youtube-dl
youtube_dl/utils.py
Python
unlicense
42,818
0.002382
# -*- coding: utf-8 -*- from click import open_file def read_file(path): with open_file(path, 'r', encoding='utf8') as f: return ''.join(f.readlines()) def test_import(): from catex import LaTeX def test_import_(): import catex def test_latex_simple(): from catex import LaTeX f1 = La...
Alexis-benoist/CaTeX
tests/test_core.py
Python
apache-2.0
1,434
0.001395
# -*- coding: utf-8 -*- # DO NOT DELETE import StringIO import csv import datetime today = datetime.date.today() from flask import ( Blueprint, make_response ) from flask.ext.login import login_required from sqlalchemy import desc from feedback.surveys.models import Survey blueprint = Blueprint( 'sur...
codeforamerica/mdc-feedback
feedback/surveys/views.py
Python
mit
1,698
0.002356
#This file is distributed under the terms of the GNU General Public license. #Copyright (C) 2005 Al Riddoch (See the file COPYING for details). from atlas import * from physics import * from physics import Quaternion from physics import Vector3D import math from random import * import server class Logging(server.T...
ytaben/cyphesis
rulesets/mason/world/tasks/Logging.py
Python
gpl-2.0
4,546
0.009899
# Copyright (C) 2014 @threatlead # # 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 program is distributed in th...
lixiangning888/whole_project
modules/signatures_orignal/rat_spynet.py
Python
lgpl-3.0
1,986
0.006546
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-07-12 02:22 from __future__ import unicode_literals import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('operation_finance', '0020_auto_20170711_1429'), ] operations = [ ...
michealcarrerweb/LHVent_app
operation_finance/migrations/0021_auto_20170712_0222.py
Python
mit
519
0.001927
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. from bedrock.redirects.util import no_redirect, platform_redirector, redirect def firefox_mobile_faq(request, *args, ...
alexgibson/bedrock
bedrock/firefox/redirects.py
Python
mpl-2.0
32,590
0.005247
# -*- coding: utf-8 -*- # # Plugins' module file for serverApplet. # Copyright (C) 2015 Gergely Bódi # # 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 ...
vendelin8/serverApplet
plugin/__init__.py
Python
gpl-2.0
1,584
0.004422
import OOMP newPart = OOMP.oompItem(8826) newPart.addTag("oompType", "CAPC") newPart.addTag("oompSize", "0603") newPart.addTag("oompColor", "X") newPart.addTag("oompDesc", "PF100") newPart.addTag("oompIndex", "V50") OOMP.parts.append(newPart)
oomlout/oomlout-OOMP
old/OOMPpart_CAPC_0603_X_PF100_V50.py
Python
cc0-1.0
245
0
"""Support for the Philips Hue sensors as a platform.""" from __future__ import annotations from datetime import timedelta import logging from typing import Any from aiohue import AiohueException, Unauthorized from aiohue.v1.sensors import TYPE_ZLL_PRESENCE import async_timeout from homeassistant.components.sensor i...
home-assistant/home-assistant
homeassistant/components/hue/v1/sensor_base.py
Python
apache-2.0
7,575
0.001056
from decimal import Decimal from django.utils import timezone from rest_framework import serializers import rest_framework import datetime import django import pytest import uuid # Tests for field keyword arguments and core functionality. # --------------------------------------------------------- class TestEmpty: ...
ticosax/django-rest-framework
tests/test_fields.py
Python
bsd-2-clause
38,463
0.00117
from sys import * from pdflib_py import * p = PDF_new() PDF_open_file(p, "gradients.pdf") PDF_set_parameter(p, "usercoordinates", "true") PDF_set_value(p, "compress", 0) PDF_set_info(p, "Author", "pdflib") PDF_set_info(p, "Creator", "pdflib_py") PDF_set_info(p, "Title", "gradients") width = 1024 height = 800 PDF_...
brad/swftools
spec/gradients.py
Python
gpl-2.0
3,650
0.019452
# Copyright (C) 2009-2017 Lars Wirzenius # # 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 program is distribu...
obnam-mirror/obnam
obnamlib/app.py
Python
gpl-3.0
11,277
0
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2019-01-10 22:43 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dns', '0002_auto_20151228_0134'), ] operations = [ migrations.CreateModel( ...
garncarz/dns-server
dns/migrations/0003_redirection.py
Python
gpl-2.0
640
0.001563
#!/usr/bin/python #Copyright (c) 2016, Justin R. Klesmith #All rights reserved. from __future__ import division from math import log, sqrt, pow import argparse, os, random #Set the author information __author__ = "Justin R. Klesmith" __copyright__ = "Copyright 2016, Justin R. Klesmith" __credits__ = ["Justin R. Kles...
JKlesmith/Bioinformatics
ProcessMSA.py
Python
bsd-3-clause
4,782
0.015056
# # My first attempt at python # calibrate accelerometer # import re import scipy from scipy import optimize from scipy import linalg from pylab import * # # parse the log # def read_log(ac_id, filename, sensor): f = open(filename, 'r') pattern = re.compile("(\S+) "+ac_id+" IMU_"+sensor+"_RAW (\S+) (\S+) (\S+...
pchickey/paparazzi-linux-release
sw/tools/calibration/calib.py
Python
gpl-2.0
3,989
0.018802
from network import WLAN ############################################################################### # Settings for WLAN STA mode ############################################################################### WLAN_MODE = 'off' #WLAN_SSID = '' #WLAN_AUTH = (WLAN.WPA2,'') #################...
ttn-be/ttnmapper
config.py
Python
mit
1,297
0.010023
#!/usr/bin/env python3 # # PLASMA : Generate an indented asm code (pseudo-C) with colored syntax. # Copyright (C) 2015 Joel # # 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 ...
chubbymaggie/reverse
plasma/lib/__init__.py
Python
gpl-3.0
12,594
0.005717
from office365.entity import Entity from office365.outlook.calendar.email_address import EmailAddress class CalendarPermission(Entity): """ The permissions of a user with whom the calendar has been shared or delegated in an Outlook client. Get, update, and delete of calendar permissions is supported on b...
vgrem/Office365-REST-Python-Client
office365/outlook/calendar/calendar_permission.py
Python
mit
1,204
0.005814
"""Word cloud is ungraded xblock used by students to generate and view word cloud. On the client side we show: If student does not yet answered - `num_inputs` numbers of text inputs. If student have answered - words he entered and cloud. """ import json import logging from pkg_resources import resource_string from x...
pepeportela/edx-platform
common/lib/xmodule/xmodule/word_cloud_module.py
Python
agpl-3.0
8,926
0.001232
# -*- coding: utf-8 -*- from copy import deepcopy from cfme.utils import conf from cfme.utils.pretty import Pretty from cfme.utils.update import Updateable class FromConfigMixin(object): @staticmethod def rename_properties(creds): """ helper function to make properties have same names in crede...
anurag03/integration_tests
cfme/base/credential.py
Python
gpl-2.0
7,024
0.000712
from django.conf import settings from django.core.files.storage import FileSystemStorage from django.core.urlresolvers import reverse from django.db import models from django.utils.html import strip_tags from django.utils.safestring import mark_safe from django.core.exceptions import ValidationError from make_mozilla....
mozilla/make.mozilla.org
make_mozilla/pages/models.py
Python
bsd-3-clause
5,208
0.003072
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py
Python
mit
12,838
0.004674
import datetime import functools import os import random import shutil import tempfile import time from urllib import request import faker import magic import pendulum from django.conf import settings from django.contrib.auth.models import Group, Permission from django.contrib.staticfiles.testing import StaticLiveServ...
uclouvain/osis_louvain
assessments/tests/functionals/test_score_encoding.py
Python
agpl-3.0
57,982
0.004933
""" utilsMDS.py author: Kevin Jamieson (kevin.g.jamieson@gmail.com) edited: 1/18/15 This module has methods that assist with non-metric multidimensional scaling. If you're trying to COMPUTE an embedding, you might simply call: X,emp_loss = computeEmbedding(n,d,S) You may also consider getLoss to check how well...
nextml/NEXT
apps/PoolBasedTripletMDS/algs/ValidationSampling/utilsMDS.py
Python
apache-2.0
14,387
0.018002
#!/usr/bin/env python from mvbb.box_db import MVBBLoader import multiprocessing, subprocess from multiprocessing import Pool import sys from plugins import soft_hand def grasp_boxes(filename): subprocess.call(['python', './grasp_boxes_batch.py', filename]) if __name__ == '__main__': try: import os.p...
lia2790/grasp_learning
python/simple_batch_splitter.py
Python
bsd-3-clause
913
0.004381
# Copyright (C) 2010 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the ...
klim-iv/phantomjs-qt5
src/webkit/Tools/Scripts/webkitpy/layout_tests/models/test_results_unittest.py
Python
bsd-3-clause
2,300
0
import random import math import collections import tree_decomposition as td import create_production_rules as pr import graph_sampler as gs import stochastic_growth import probabilistic_growth import net_metrics import matplotlib.pyplot as plt import product import networkx as nx import numpy as np import snap #G =...
abitofalchemy/hrg_nets
karate_chop.py
Python
gpl-3.0
4,865
0.019527
#!/usr/bin/env python ## Some necessary imports from __future__ import print_function from commands import getoutput from time import sleep from os.path import expanduser import os import re from datetime import datetime import process_lock as pl ### ## Configuration options script_location = os.path.dirname(os.pa...
Bolt64/proxy_switcher
proxy_autoconfig.py
Python
mit
3,103
0.010957
from __future__ import division import itertools from sklearn import mixture, metrics from sklearn.cluster import DBSCAN from scipy import linalg from scipy.spatial import distance import pylab as pl import matplotlib as mpl from scipy.interpolate import Rbf, InterpolatedUnivariateSpline import csv import numpy as np...
smorante/continuous-goal-directed-actions
simulated-CGDA/generalization/generalization_old_test2.py
Python
mit
7,027
0.021346
# browsershots.org - Test your web design in different browsers # Copyright (C) 2007 Johann C. Rocholl <johann@browsershots.org> # # Browsershots 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 ...
mintuhouse/shotfactory
shotfactory04/gui/linux/navigator.py
Python
gpl-3.0
2,507
0
import os from setuptools import setup # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(os.path.join(os.path.di...
nico202/pyUniSR
setup.py
Python
gpl-2.0
919
0.020675
#-*- coding:utf-8 -*- import string from gi.repository import GObject, Gedit, Gtk, Pango from settings import errorGenerator, jump_to_error_key, notification ui_str = """<ui> <menubar name="MenuBar"> <menu name="EditMenu" action="Edit"> <placeholder name="EditOps_6"> <menuitem name="gfly" action="gfly"/> ...
utisam/gfly
gfly/__init__.py
Python
gpl-3.0
4,933
0.036084
################################################################################ # new_users_saver funciton ################################################################################ def newusers(m): dict_updater() un = m.from_user.username if un not in DBDIC: uid = m.from_user.id DBD...
acasadoquijada/Telegram-bot-stuff
Stuff/new_users_saver.py
Python
gpl-2.0
825
0.008485
""" @author: Stefan Peidli License: MIT Tags: Neural Network """ import numpy as np from Board import Board n = 9 # Testboards def gen_test_board(method=0): if method == 0: b = np.zeros((n, n)) b[0, 2] = 1 b[1, 3] = 1 b[3, 3] = 1 b[2, 3] = -1 b[0, 1] = -1 ...
stefanpeidli/GoNet
Filters.py
Python
mit
15,577
0.004365
# encoding: utf8 from sympy import Add from uncertainties import __version_info__ as uncert_version from uncertainties import ufloat, ufloat_fromstr from uncertainties.core import Variable, AffineScalarFunc if uncert_version < (3, 0): raise Warning("Your version of uncertanties is not supported. Try\n" ...
kirienko/unseries
unseries.py
Python
gpl-3.0
9,529
0.002205
# # eventmanager.py # # Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com> # # Deluge is free software. # # You may 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 ...
Tydus/deluge
deluge/core/eventmanager.py
Python
gpl-3.0
3,162
0.001265
#!/usr/bin/python # -*- coding: utf-8 -* """ The MIT License (MIT) Copyright (c) 2015 Christophe Aubert Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limit...
Bideau/SmartForrest
RaspberryPi/dataBase/mysql/CreateMysqlTable.py
Python
mit
6,863
0.006994
# -*- coding: utf-8 -*- #************************************************************************ # # TeX-9 library: Python module # # 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 Softw...
vim-scripts/TeX-9
ftplugin/tex_nine/tex_nine_utils.py
Python
gpl-3.0
3,875
0.005935
"""Tests for HTMLParser.py.""" import html.parser import pprint import unittest from test import support class EventCollector(html.parser.HTMLParser): def __init__(self, *args, **kw): self.events = [] self.append = self.events.append html.parser.HTMLParser.__init__(self, *args, **kw) ...
MalloyPower/parsing-python
front-end/testsuite-python-lib/Python-3.3.0/Lib/test/test_htmlparser.py
Python
mit
30,373
0.001152
#!/usr/bin/env python import wx import images #---------------------------------------------------------------------- text = """\ Right-click on any bare area of this panel (or Ctrl-click on Macs if you don't have a multi-button mouse) to show a popup menu. Then look at the code for this sample. Notice how the Po...
dnxbjyj/python-basic
gui/wxpython/wxPython-demo-4.0.1/demo/PopupMenu.py
Python
mit
4,928
0.004261
# -*- coding: utf-8 -*- ''' fantastic Add-on 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...
TheWardoctor/Wardoctors-repo
script.module.fantastic/lib/resources/lib/sources/en/sceper.py
Python
apache-2.0
6,854
0.018675
from __future__ import with_statement from pyramid.view import view_config from pyramid.renderers import render from intranet3.utils.views import BaseView from intranet3.models import ( User, TimeEntry, Tracker, Project, Client, DBSession, ) from intranet3.forms.times import ProjectsTimeForm, ...
stxnext/intranet-open
src/intranet3/intranet3/views/times/tickets.py
Python
mit
4,991
0.004809
# Open Modeling Framework (OMF) Software for simulating power systems behavior # Copyright (c) 2015, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundatio...
geomf/omf-fork
omf/hdfs.py
Python
gpl-2.0
7,235
0.003179
from rest_framework import permissions class IsReadOnly(permissions.BasePermission): def has_object_permission(self, request, view, obj): if request.method in permissions.SAFE_METHODS: return True return obj.owner == self.request.user
linfanangel/Trality
cart/cartapp/permission.py
Python
gpl-3.0
268
0.003731
import random def generate(data): ask = ['equivalent resistance $R_T$', 'current from the power supply $I_T$'] which = random.choice([0,1]) data['params']['ask'] = ask[which] label = ["$R_T$", "$I_T$"] data['params']['lab'] = label[which] unit = ["$\\Omega$", "A"] data['params']['unit'] ...
PrairieLearn/PrairieLearn
exampleCourse/questions/workshop/Lesson1_example3_v3/server.py
Python
agpl-3.0
1,005
0.01393
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def pathSum(self, root, sum): """ :type root: TreeNode :type sum: int :rtype: int ...
zqfan/leetcode
algorithms/437. Path Sum III/solution.py
Python
gpl-3.0
748
0
from rest_framework import serializers from django.utils.translation import ugettext_lazy as _ __all__ = [ 'ApplySerializer', 'LoginAssetConfirmSerializer', ] class ApplySerializer(serializers.Serializer): # 申请信息 apply_login_user = serializers.CharField(required=True, label=_('Login user')) apply_l...
jumpserver/jumpserver
apps/tickets/serializers/ticket/meta/ticket_type/login_asset_confirm.py
Python
gpl-3.0
591
0.003431
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
celebdor/kuryr-libnetwork
kuryr_libnetwork/schemata/request_pool.py
Python
apache-2.0
2,102
0
# Generated by Django 3.0.7 on 2021-03-10 05:19 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('users', '0005_owner_model'), ('order', '0041_auto_20210114_1728'), ] operations = [ migrations.AddF...
inventree/InvenTree
InvenTree/order/migrations/0042_auto_20210310_1619.py
Python
mit
972
0.002058
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from __future__ import unicode_literals import time from django ...
suutari-ai/shoop
shuup/addons/admin_module/views/reload.py
Python
agpl-3.0
3,004
0.001664
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('transactions', '0001_initial'), ] operations = [ migrations.AddField( model_name='transaction', name...
erickdom/restAndroid
transactions/migrations/0002_transaction_response.py
Python
apache-2.0
436
0.002294
# 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...
MalloyPower/parsing-python
front-end/testsuite-python-lib/Python-2.7/Lib/doctest.py
Python
mit
101,750
0.001179
# # Copyright © 2012 - 2021 Michal Čihař <michal@cihar.com> # # This file is part of Weblate <https://weblate.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 3 of the Lice...
phw/weblate
weblate/formats/tests/test_convert.py
Python
gpl-3.0
4,423
0.000452
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pyscada', '0010_auto_20160115_0918'), ('modbus', '0003_auto_20160115_0918'), ] operations = [ migrations.RenameField...
trombastic/PyScada
pyscada/modbus/migrations/0004_auto_20160115_0920.py
Python
gpl-3.0
454
0
# -*- coding: utf-8 -*- # © 2017 Savoir-faire Linux # License LGPL-3.0 or later (http://www.gnu.org/licenses/gpl). from odoo import api, models class IrRule(models.Model): _inherit = 'ir.rule' @api.model def _compute_domain(self, model_name, mode="read"): if getattr(self.env, '_bypass_access', ...
savoirfairelinux/secure-odoo
action_access_control_list/models/ir_rule.py
Python
lgpl-3.0
486
0
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------ # File Name: mul.py # Author: Zhao Yanbai # Thu Oct 1 15:10:27 2015 # Description: none # ------------------------------------------------------------------------ for j in range...
acevest/acecode
learn/python/mul.py
Python
gpl-2.0
462
0.008658
#!/usr/bin/env python3 # Copyright (C) 2017 # ASTRON (Netherlands Institute for Radio Astronomy) # P.O.Box 2, 7990 AA Dwingeloo, The Netherlands # # This file is part of the LOFAR software suite. # The LOFAR software suite is free software: you can redistribute it # and/or modify it under the terms of the GNU General P...
kernsuite-debian/lofar
SAS/DataManagement/ResourceTool/resourcetool.py
Python
gpl-3.0
24,976
0.006006
# debugshell extension """a python shell with repo, changelog & manifest objects""" import mercurial import code def debugshell(ui, repo, **opts): objects = { 'mercurial': mercurial, 'repo': repo, 'cl': repo.changelog, 'mf': repo.manifest, } bannermsg = "loaded repo : %s\n"...
iaddict/mercurial.rb
vendor/mercurial/contrib/debugshell.py
Python
mit
533
0.003752
# 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 ...
csmengwan/autorest
AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/setup.py
Python
mit
1,158
0
# Generated by Django 1.11.16 on 2018-11-14 12:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("zerver", "0191_realm_seat_limit"), ] operations = [ migrations.AddField( model_name="customprofilefieldvalue", nam...
andersk/zulip
zerver/migrations/0192_customprofilefieldvalue_rendered_value.py
Python
apache-2.0
418
0
""" To use the SQLite3 module we need to add an import statement to our python script: ________________________________________________________________________________ >>> import sqlite3 ________________________________________________________________________________ We can check sqlite version: _______________________...
Valka7a/python-playground
sqlite3/tutorials/module-in-python.py
Python
mit
756
0.001323
import os import numpy as np from statsmodels.duration.hazard_regression import PHReg from numpy.testing import (assert_allclose, assert_equal) import pandas as pd # TODO: Include some corner cases: data sets with empty strata, strata # with no events, entry times after censoring times,...
DonBeo/statsmodels
statsmodels/duration/tests/test_phreg.py
Python
bsd-3-clause
11,981
0.003506
# External Attribute Skeleton # # Input: Multi-trace, single attribute # Output: Single attribute # import sys,os import numpy as np # # Import the module with the I/O scaffolding of the External Attribute # sys.path.insert(0, os.path.join(sys.path[0], '..')) import extattrib as xa # # The attribute parameters - keep ...
waynegm/OpendTect-Plugins
bin/python/wmpy/Skeletons/ex_multi_trace_single_attribute_input_single_output.py
Python
gpl-3.0
2,619
0.030546
from data.COMMON import * #essentials Header( 0.001, #Script Version (for updates) ('Melee',['dat']), #model activation ('Melee',['dat']), #anim activation ['RVL_IMG'])#revolution']) #included libs #gist number: 2757147 #for the work I've done to get this far, this should really ...
Universal-Model-Converter/UMC3.0a
scripts/SSBM.py
Python
mit
25,037
0.037385
import statsmodels.api as sm from . import common_fields from . import make_gaps from . import tools from .device_event import make_alarm_event def apply_loess(solution, num_days, gaps): """Solves the blood glucose equation over specified period of days and applies a loess smoothing regression to the da...
tidepool-org/dfaker
dfaker/cbg.py
Python
bsd-2-clause
2,185
0.008696
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Project' db.create_table(u'logger_project', ( ...
spatialdev/onadata
onadata/apps/logger/migrations/0048_auto__add_project__add_unique_project_name_organization__add_projectxf.py
Python
bsd-2-clause
16,039
0.007419
import os from flask import Flask, url_for, request, render_template, jsonify, send_file from werkzeug.utils import secure_filename import deepchem as dc import subprocess from shutil import copyfile import csv import rdkit from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import Draw STATIC_DIR = ...
deepchem/deepchem-gui
gui/app.py
Python
gpl-3.0
8,020
0.001995
# Copyright 2013 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
rhyolight/nupic.son
app/soc/logic/program.py
Python
apache-2.0
944
0.002119
from functools import wraps import logging import traceback from django.conf import settings from django.core import management from django.contrib import messages from django.contrib.auth import authenticate from django.http import Http404 from django.shortcuts import redirect from django.shortcuts import render from ...
Kegbot/kegbot-server
pykeg/web/setup_wizard/views.py
Python
gpl-2.0
6,069
0.00033
# -*- coding: utf-8 -*- """Module that helps in checking the correctness of CSV file structure."""
TMiguelT/csvschema
csv_schema/__init__.py
Python
mit
103
0
# UrbanFootprint v1.5 # Copyright (C) 2017 Calthorpe Analytics # # This file is part of UrbanFootprint version 1.5 # # UrbanFootprint is distributed under the terms of the GNU General # Public License version 3, as published by the Free Software Foundation. This # code is distributed WITHOUT ANY WARRANTY, without impl...
CalthorpeAnalytics/urbanfootprint
footprint/client/configuration/default/layer_style/default_layer_style.py
Python
gpl-3.0
793
0.001261
# Copyright 2020 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
GoogleCloudPlatform/repo-automation-playground
xunit-autolabeler-v2/ast_parser/core/__init__.py
Python
apache-2.0
783
0
#!/usr/bin/env python -t # -*- coding: UTF-8 -*- import codecs import urllib class HtmlOutputer(object): def __init__(self): self.datas = [] def collect_data(self,data): if data is None: return self.datas.append(data) def output_html(self): fout = open('output....
guanxin0206/dice_crawler
dice_spider_2/spider/html_outputer.py
Python
bsd-2-clause
1,497
0.008059
import unittest from twitter_bot import messages class TestBaseMessageProvider(unittest.TestCase): def test_extract_hashtags_empty_mention(self): provider = messages.BaseMessageProvider() hashtags = provider._extract_hashtags({}) self.assertEqual([], hashtags) def test_extract_has...
jessamynsmith/twitterbot
tests/messages/test_base.py
Python
mit
989
0.003033
# Copyright Aaron Smith 2009 # # This file is part of Gity. # # Gity 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. # # Gity is dis...
gngrwzrd/gity
python/add.py
Python
gpl-3.0
1,341
0.028337
""" By now, you are given a secret signature consisting of character 'D' and 'I'. 'D' represents a decreasing relationship between two numbers, 'I' represents an increasing relationship between two numbers. And our secret signature was constructed by a special integer array, which contains uniquely all the different nu...
dichen001/Go4Jobs
JackChen/Google/484. Find Permutation.py
Python
gpl-3.0
1,750
0.003429
from troposphere.constants import NUMBER from troposphere import FindInMap, GetAtt, Join, Output from troposphere import Parameter, Ref, Template from troposphere.awslambda import Function, Code, MEMORY_VALUES from troposphere.cloudformation import CustomResource from troposphere.ec2 import Instance from troposphere.ec...
7digital/troposphere
examples/Lambda.py
Python
bsd-2-clause
5,154
0
# 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...
neilhan/tensorflow
tensorflow/contrib/factorization/python/ops/gmm.py
Python
apache-2.0
7,521
0.002792
# coding: utf-8 """Test that tokenizer prefixes, suffixes and infixes are handled correctly.""" from __future__ import unicode_literals import pytest @pytest.mark.parametrize('text', ["(can)"]) def test_tokenizer_splits_no_special(en_tokenizer, text): tokens = en_tokenizer(text) assert len(tokens) == 3 @...
aikramer2/spaCy
spacy/tests/lang/en/test_prefix_suffix_infix.py
Python
mit
4,124
0.000242
# Copyright Iris contributors # # This file is part of Iris and is released under the LGPL license. # See COPYING and COPYING.LESSER in the root of the repository for full # licensing details. """ A package for handling multi-dimensional data and associated metadata. .. note :: The Iris documentation has further ...
SciTools/iris
lib/iris/__init__.py
Python
lgpl-3.0
14,621
0
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'recipe_engine/buildbucket', 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/platform', 'recipe_engine/properties', 'recip...
endlessm/chromium-browser
third_party/depot_tools/recipes/recipe_modules/git/examples/full.py
Python
bsd-3-clause
5,942
0.009424
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import try: from setuptools import setup except ImportError: from distutils.core...
CYBAI/servo
python/mach/setup.py
Python
mpl-2.0
1,204
0
from django.contrib.auth import views as auth_views from django.conf.urls import url from . import views app_name = "accounts" urlpatterns = [ url(r'^login/$', auth_views.login, {'template_name': 'accounts/signin.html'}, name='signin'), url(r'^signup/', views.SignUpView.as_view(), name="signup"), url(r'^l...
rodriguesrl/reddit-clone-udemy
accounts/urls.py
Python
mit
366
0.002732