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
from pubsublogger import publisher
import calendar
from datetime import date
from dateutil.rrule import rrule, DAILY
import csv
def listdirectory(path):
"""Path Traversing Function.
:param path: -- The absolute pathname to a directory.
This function is returning all the absolut... | xujun10110/AIL-framework | bin/packages/lib_words.py | Python | agpl-3.0 | 3,335 | 0.001499 |
"""
count number of reads mapping to features of transcripts
"""
import os
import sys
import itertools
import pandas as pd
import gffutils
from bcbio.utils import file_exists
from bcbio.distributed.transaction import file_transaction
from bcbio.log import logger
from bcbio import bam
import bcbio.pipeline.datadict as... | Cyberbio-Lab/bcbio-nextgen | bcbio/rnaseq/count.py | Python | mit | 2,271 | 0.001321 |
from lxml import etree
from healthvaultlib.itemtypes.healthrecorditem import HealthRecordItem
from healthvaultlib.utils.xmlutils import XmlUtils
class Height(HealthRecordItem):
def __init__(self, thing_xml=None):
super(Height, self).__init__()
self.type_id = '40750a6a-89b2-455c-bd8d-b420a4cb500b'... | rajeevs1992/pyhealthvault | src/healthvaultlib/itemtypes/height.py | Python | mit | 2,163 | 0.001387 |
import os
import csv
import pickle
from indra.literature import id_lookup
from indra.sources import trips, reach, index_cards
from assembly_eval import have_file, run_assembly
if __name__ == '__main__':
pmc_ids = [s.strip() for s in open('pmcids.txt', 'rt').readlines()]
# Load the REACH reading output
wit... | pvtodorov/indra | indra/benchmarks/assembly_eval/combine4/run_combined.py | Python | bsd-2-clause | 1,490 | 0 |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from .code_generator_info import CodeGeneratorInfo
from .composition_parts import WithCodeGeneratorInfo
from .composition_parts import WithComponent
from .co... | chromium/chromium | third_party/blink/renderer/bindings/scripts/web_idl/typedef.py | Python | bsd-3-clause | 1,678 | 0 |
# -*- encoding: utf-8 -*-
from abjad.tools import scoretools
from abjad.tools import scoretools
from abjad.tools import markuptools
from abjad.tools import scoretools
from abjad.tools import pitchtools
from abjad.tools.topleveltools import attach
from abjad.tools.topleveltools import iterate
def label_leaves_in_expr_... | mscuthbert/abjad | abjad/tools/labeltools/label_leaves_in_expr_with_numbered_intervals.py | Python | gpl-3.0 | 1,783 | 0 |
import functools
import json
import urllib
from django import http
from django.conf import settings
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, redirect, render
from django.views.decorators.http import require_POST
import commonware
... | luckylavish/zamboni | mkt/developers/views_payments.py | Python | bsd-3-clause | 20,258 | 0 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_chart_title01.py | Python | bsd-2-clause | 1,535 | 0 |
# Lint as: python3
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | google/tf-quant-finance | tf_quant_finance/__init__.py | Python | apache-2.0 | 3,356 | 0.006853 |
import random
perc2015 = []
perc2016 = []
perc2017 = []
perc2018 = []
perc2019 = []
def getColor(pais):
foundColor = 0
theColor = 0x000000
for elem in perc2015:
if elem[0]==pais:
theColor = elem[2]
foundColor = 1
for elem in perc2016:
if elem[0]==pais:
theColor = elem[2]
foundColor = 1
for elem i... | ferriman/SSandSP | processing/spiritOfBCN/getdata.py | Python | gpl-3.0 | 4,690 | 0.042857 |
import sublime
import sublime_plugin
from isort.isort import SortImports
class PysortCommand(sublime_plugin.TextCommand):
def run(self, edit):
old_content = self.view.substr(sublime.Region(0, self.view.size()))
new_content = SortImports(file_contents=old_content).output
self.view.replace(... | turbidsoul/isort | sort.py | Python | mit | 556 | 0.003597 |
# -*- coding: utf8 -*-
# Copyright (C) 2015 - Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
from Utils import *
import xbmc
import xbmcaddon
import xbmcgui
import xbmcvfs
import os
from dialogs import BaseClasses
from LocalDB import local_db
import TheMovieDB
ADD... | AMOboxTV/AMOBox.LegoBuild | script.extendedinfo/resources/lib/WindowManager.py | Python | gpl-2.0 | 12,611 | 0.000793 |
ADAMSLegacyDict = {'STATEID':38629,'PARCELID':38382,'TAXPARCELID':0,'PARCELDATE':38629,'TAXROLLYEAR':38629,'OWNERNME1':38198,'OWNERNME2':12641,'PSTLADRESS':38177,'SITEADRESS':22625,'ADDNUMPREFIX':28,'ADDNUM':22625,'ADDNUMSUFFIX':750,'PREFIX':6195,'STREETNAME':22625,'STREETTYPE':19749,'SUFFIX':1,'LANDMARKNAME':33,'UNITT... | WIStCart/V3ValidationTool | V6ValidationTool_dist/script/LegacyCountyStats.py | Python | mit | 53,028 | 0.114053 |
#!/usr/bin/python
# Quick PoC template for HTTP POST form brute force, with anti-CRSF token
# Target: DVWA v1.10
# Date: 2015-10-19
# Author: g0tmi1k ~ https://blog.g0tmi1k.com/
# Source: https://blog.g0tmi1k.com/2015/10/dvwa-login/
import requests
import sys
import re
from BeautifulSoup import BeautifulSoup
# Var... | cybert79/HaXor | boot2root-scripts/dvwa-login-bruteforce-http-post-csrf.py | Python | unlicense | 3,803 | 0.004207 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths... | Jonothompson/my-django-blog | mysite/settings.py | Python | mit | 2,696 | 0.000371 |
from __future__ import division, print_function
import os
import unittest
from uuid import uuid1
import numpy as np
from .. import utils as rrutils
from ..results import read_zscan, write_zscan
from ..templates import DistTemplate, find_templates, load_dist_templates
from ..zfind import zfind
from . import util
cl... | sbailey/redrock | py/redrock/test/test_io.py | Python | bsd-3-clause | 3,397 | 0.003827 |
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
class rainsoft_account_invoice(osv.osv):
_name='account.invoice'
_inherit = 'account.invoice'
_columns={
'p_comment':fields.related('partner_id','comment',type='text',relation='r... | kevin8909/xjerp | openerp/addons/Rainsoft_Xiangjie/rainsoft_account_invoice.py | Python | agpl-3.0 | 2,540 | 0.062205 |
#!/usr/bin/env python3
#
# Copyright (c) 2017 Nick Douma
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | LordGaav/notification-scripts | slack.py | Python | mit | 3,578 | 0 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_hyperlink31.py | Python | bsd-2-clause | 929 | 0 |
"""
Copyright (c) 2015-2020 Raj Patel(raj454raj@gmail.com), StopStalk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
... | stopstalk/stopstalk-deployment | private/scripts/populate-atcoder-problems.py | Python | mit | 1,810 | 0.003867 |
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
except:
README = ''
CHANGES = ''
setup(
name='Flask-Failsafe',
version='0.2',
url... | mgood/flask-failsafe | setup.py | Python | bsd-2-clause | 1,085 | 0.000922 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/apps/sqoop/src/sqoop/settings.py | Python | gpl-2.0 | 916 | 0 |
##############################################################################################
# Copyright 2017 The Johns Hopkins University Applied Physics Laboratory LLC
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documen... | maddiestone/IDAPythonEmbeddedToolkit | make_strings.py | Python | mit | 3,874 | 0.019102 |
# -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | dnjohnstone/hyperspy | hyperspy/tests/model/test_set_parameter_state.py | Python | gpl-3.0 | 4,051 | 0 |
#
# Copyright 2014 Shahriyar Amini
#
# 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 wri... | samini/gort-public | Source/Squiddy/src/tema-android-adapter-3.2-sma/AndroidAdapter/adbcommands.py | Python | apache-2.0 | 11,424 | 0.037728 |
import sys
import environ
from django.utils.translation import ugettext_lazy as _
BASE_DIR = environ.Path(__file__) - 3 # type: environ.Path
env = environ.Env()
env.read_env(BASE_DIR(".env"))
LANGUAGE_CODE = "en"
LANGUAGES = [("en", _("English")), ("es", _("Español")), ("fr", _("Français"))]
TIME_ZONE = "Europe/Be... | sinnwerkstatt/landmatrix | config/settings/base.py | Python | agpl-3.0 | 7,018 | 0.000428 |
import datetime
import lxml
from lxml.html.clean import Cleaner
import re
from django.conf import settings
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.text import slugify
from markitup.fields import MarkupField
class ModelBase(models.Model):
created = models.DateTi... | hzj123/56th | pombola/info/models.py | Python | agpl-3.0 | 6,304 | 0.005235 |
# Copyright (C) 2012-2020 Jonathan Vasquez <jon@xyinn.org>
#
# 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... | fearedbliss/bliss-initramfs | pkg/hooks/Hook.py | Python | apache-2.0 | 2,523 | 0 |
#!/usr/bin/env python
import MySQLdb
import string
import logging
import Reference as r
def CalculateWordCount(InputList,MatchList):
'''Counts the instance of MatchList values in the InputList'''
NumberOfMatches = 0
for w in InputList:
NumberOfMatches += MatchList.count(w)
retur... | AdamDynamic/TwitterMetrics | KeywordSearch.py | Python | gpl-2.0 | 7,402 | 0.010267 |
from setuptools import setup,find_packages
setup(
name = 'pygron',
version = '0.3.1',
license = 'MIT',
author = 'Akshay B N',
description = 'Helps JSON become greppable',
zip_safe = False,
url = 'https://github.com/akshbn/pygron',
packages = find_packages(),
entry_points = {"console_scripts":["pygron=pygron.cli_entry:... | akshbn/pygron | setup.py | Python | mit | 330 | 0.087879 |
#!/usr/bin/python
""" The report generator handles commands from the user to configure reports,
then obtains the data from the requested file,
then writes the report file.
"""
import rxt
import os
import sys
import locale
import traceback
import simpl
import simplejson
import time
import datetime
import csv
im... | xhan-shannon/SystemControlView | utils/ReportGenerator.py | Python | gpl-2.0 | 460,449 | 0.012301 |
# Copyright (C) 2013 Korei Klein <korei.klein1@gmail.com>
from misc import *
from calculus import variable
from lib import common_vars
from lib.common_symbols import domainSymbol, relationSymbol, leftSymbol, rightSymbol
from calculus.basic import endofunctor
from calculus.basic import formula
class UntransportableExc... | koreiklein/fantasia | calculus/basic/bifunctor.py | Python | gpl-2.0 | 13,217 | 0.019747 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | dlundquist/ansible | lib/ansible/runner/__init__.py | Python | gpl-3.0 | 55,816 | 0.005518 |
import numpy as np
# f(x) = a*x*x*x + b*x*x + c*x + d
# f'(x) = 3*a*x*x + 2*b*x + c
#
# d = x0
# c = dx0
# a + b + c + d = x1
# 3*a + 2*b + c = dx1
#
# a + b + dx0 + x0 = x1
# a + b = x1 - x0 - dx0
# a = x1 - x0 - dx0 - b
#
# 3*a + 2*b + dx0 = dx1
# 3*a + 2*b = dx1 - dx0
# 3*(x1 - x0 - dx0 - b) + 2*b = dx1 - dx0
# -3... | dyf/primopt | spline.py | Python | bsd-2-clause | 1,314 | 0.019787 |
#pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103
from __future__ import absolute_import, division, print_function
import pytest
import numpy as np
from numpy.testing import assert_almost_equal
from matplotlib.figure import Figure
from glue.core.data import CategoricalComponent
from mock import MagicMock
from ..... | JudoWill/glue | glue/core/tests/test_roi.py | Python | bsd-3-clause | 29,076 | 0.000378 |
import sublime
import sublime_plugin
from datetime import datetime
import io
import os
import re
import subprocess
import sys
def get_setting(key, default=None):
settings = sublime.load_settings('tmux.sublime-settings')
os_specific_settings = {}
if sys.platform == 'darwin':
os_specific_settings = ... | huntie/sublime-tmux | tmux.py | Python | mit | 4,727 | 0.004019 |
# -*- 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):
# Deleting field 'Event.date'
db.delete_column(u'photocontest_event', 'da... | endthestart/photocontest | photocontest/photocontest/migrations/0009_auto__del_field_event_date.py | Python | mit | 2,554 | 0.007439 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('accounts', '0005_auto_20150422_0105'),
]
operations = [
migrations.AlterField(
model_name='userp... | vivianbuan/cs3240-s15-team20 | SecureWitness/accounts/migrations/0006_auto_20150423_1615.py | Python | mit | 454 | 0 |
import sys
import os
import re
import logging
import pysam
#
# Class definitions
#
class annotator:
def __init__(self, tabix_db, header, num_output_column):
self.tabix_db = tabix_db
self.header = header
self.num_output_column = int(num_output_column)
def annotate(self, in_mutation_f... | Genomon-Project/GenomonMutationAnnotator | lib/mutanno/annotator.py | Python | lgpl-3.0 | 2,295 | 0.009586 |
from setuptools import setup
setup(name='haios',
version='0.1',
description='Image Search Engine',
url='https://github.com/haikentcode/haios',
author='HITESH KUMAR REGAR (haikent)',
author_email='hiteshnitj16@gmail.com',
license='MIT',
packages=['descriptor','distance','spider... | haikentcode/haios | haios/setup.py | Python | mit | 356 | 0.008427 |
__version__ = '2.0.3'
try:
from .convert import Dictionary
except ImportError:
# To make setup.py work
pass
| dchaplinsky/LT2OpenCorpora | lt2opencorpora/__init__.py | Python | mit | 121 | 0 |
"""Test that a forward-declared class works when its complete definition is in a library"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ForwardDeclTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/lang/objc/forward-decl/TestForwardDecl.py | Python | bsd-3-clause | 2,454 | 0.000815 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | prospwro/odoo | addons/irsid_base/models/__init__.py | Python | agpl-3.0 | 1,032 | 0.000969 |
""" Store only meta data but no real data (except from store state of nodes) """
import logging
import os
import pwd
import yaml
from pySPACE.resources.dataset_defs.base import BaseDataset
class DummyDataset(BaseDataset):
""" Class to store only meta data of collection
This class overrides the 'store' method... | pyspace/test | pySPACE/resources/dataset_defs/dummy.py | Python | gpl-3.0 | 1,581 | 0.011385 |
# Copyright (c) 2017 CorpNewt
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import discord
def name(member : discord.Member):
# A helper function to return the member's display name
nick = name = None
try:
nick = member.nick
except AttributeError:
... | StarbotDiscord/Starbot | libs/displayname.py | Python | apache-2.0 | 6,488 | 0.013255 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | mbohlool/client-python | kubernetes/client/models/v1_group_version_for_discovery.py | Python | apache-2.0 | 4,487 | 0.002006 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import json
from ludobox.content import read_content
from ludobox.routes.api import rest_api
# test helpers
from LudoboxTestCase import LudoboxTestCase
from helpers import delete_data_path, create_empty_data_path, add_samples_to_data_dir
class TestLudoboxWebSe... | ludobox/ludobox | server/tests/test_routes_api.py | Python | agpl-3.0 | 9,003 | 0.00411 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-13 01:17
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('dash', '0002_remove_post_origin'),
]
operations = [
migrations.... | CMPUT404W17T06/CMPUT404-project | dash/migrations/0003_auto_20170313_0117.py | Python | apache-2.0 | 497 | 0.002012 |
# -*- coding: utf-8 -*-
from collections import defaultdict
from itertools import chain
from functools import wraps
from operator import itemgetter
from multiprocessing import (
current_process,
SimpleQueue,
Process,
)
from time import sleep
import logging
import sys
import traceback
from retrying import ... | ATRAN2/Futami | futami/ami.py | Python | gpl-2.0 | 7,977 | 0.001128 |
from copy import copy
import json
from cnxepub.utils import squash_xml_to_text
from cnxml.parse import parse_metadata as parse_cnxml_metadata
from cnxtransforms import cnxml_abstract_to_html
from lxml import etree
__all__ = (
'convert_to_model_compat_metadata',
'scan_for_id_mapping',
'scan_for_uuid_mappi... | Connexions/nebuchadnezzar | nebu/models/utils.py | Python | agpl-3.0 | 5,088 | 0 |
from sqlalchemy import (
Column,
Index,
Integer,
Text,
Table,
ForeignKey,
String,
Boolean,
DateTime,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
relationship,
)
from zope.sqlalchemy import... | jaduff/goodstanding | goodstanding/models.py | Python | bsd-3-clause | 2,768 | 0.004335 |
from httmock import all_requests
@all_requests
def non_json_episode_response(url, request):
return {'status_code': 200, 'content': None}
@all_requests
def unauthorized_episode_response(url, request):
return {'status_code': 401, 'content': '{"error": "access_denied", "error_message": "The resource owner or a... | NickMolloy/rt_api | tests/mock_api.py | Python | gpl-3.0 | 935 | 0.002139 |
import tacticenv
import unittest
from pyasm.security import Batch
Batch()
from pyasm.biz.pipeline_test import ProcessTest
unittest.main()
| Southpaw-TACTIC/TACTIC | src/test/pipeline_test.py | Python | epl-1.0 | 143 | 0.013986 |
# -*- coding: utf-8 -*-
"""VGG16 model for Keras.
# Reference
- [Very Deep Convolutional Networks for Large-Scale Image Recognition](https://arxiv.org/abs/1409.1556)
"""
from __future__ import print_function
from __future__ import absolute_import
import warnings
from keras.models import Model
from keras.layers imp... | cosmos342/VisionClassifier | vgg16.py | Python | mit | 8,410 | 0.005589 |
import os
import datetime
from datetime import timedelta
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from core.utils import date_range
class Package(models.Model):
title = models.CharField(max_length=200, unique=True)
level = models.SmallIntegerF... | hamasho/endojo | apps/games/listening/models.py | Python | gpl-3.0 | 4,489 | 0 |
# coding: utf-8
"""
rita Pipeline
.. module:: rita
:synopsis: rita pipeline
.. moduleauthor:: Adolfo De Unánue <nanounanue@gmail.com>
"""
import os
import subprocess
from pathlib import Path
import boto3
import zipfile
import io
import csv
import datetime
import luigi
import luigi.s3
import pandas as pd
... | nanounanue/rita-pipeline | rita/pipelines/rita.py | Python | gpl-3.0 | 6,982 | 0.006307 |
# (c) 2015, Ovais Tariq <me@ovaistariq.net>
#
# This file is part of mha_helper
#
# 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... | ovaistariq/mha-helper | mha_helper/config_helper.py | Python | gpl-3.0 | 8,633 | 0.00278 |
class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
i = 0
j = len(height)-1
res = 0
while i<j:
res = max(res, min(height[i], height[j]) * (j-i))
if height[i] > height[j]:
... | taulk/oj | LeetCode/[11]container-with-most-water/Solution.py | Python | unlicense | 395 | 0.002532 |
#
# Copyright (c) 2010,2011,2012,2013 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.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.eclipse.org/legal/epl-v10.html
#
# Unless required ... | opennetworkinglab/spring-open-cli | cli/storeclient.py | Python | epl-1.0 | 15,736 | 0.005719 |
"""
Testing for the tree module (sklearn.tree).
"""
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_equal
from nose.tools import assert_raises
from nose.tools import assert... | seckcoder/lang-learn | python/sklearn/sklearn/tree/tests/test_tree.py | Python | unlicense | 15,491 | 0.001291 |
"""Tests for documenteer.sphinext.mockcoderefs."""
from shutil import rmtree
from tempfile import mkdtemp
import pytest
from sphinx.application import Sphinx
import documenteer.sphinxext.mockcoderefs as mockcoderefs
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock
@pytest.fix... | lsst-sqre/sphinxkit | tests/test_sphinxext_mockcoderefs.py | Python | mit | 1,652 | 0 |
import subprocess
import re
import copy
from StringIO import StringIO
import os
import doug
from doug.config import DOUGConfigParser, ControlFile
from scripts import ScriptException
import logging
LOG = logging.getLogger('doug')
_defaultConfig = None
def getDefaultConfig():
global _defaultConfig
if _default... | ogbash/doug | scripts/doug/execution.py | Python | lgpl-2.1 | 8,926 | 0.004593 |
# 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... | huijunwu/heron | heron/tools/ui/src/python/handlers/api/__init__.py | Python | apache-2.0 | 1,275 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | subodhchhabra/glances | glances/plugins/glances_fs.py | Python | lgpl-3.0 | 10,262 | 0.001169 |
'''
Virtual topology
'''
class VTopo(object):
'''
Attributes:
- switches : virtual switch list
- links : virtual links
'''
def __init__(self):
super(VTopo, self).__init__()
self.isStart = False
self.switches = []
self.links = []
def addSwitch(self, vswitc... | TakeshiTseng/HyperRyu | hyper_ryu/vtopo/vtopo.py | Python | mit | 884 | 0 |
# -*- coding: utf-8 -*-
'''
zen Add-on
Copyright (C) 2016 zen
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 v... | Coelhon/MasterRepo.repository | plugin.video.zen/resources/lib/modules/trailer.py | Python | gpl-2.0 | 3,897 | 0.010521 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Author: Thomas Beucher
Module: Experiments
Description: Class used to generate all the trajectories of the experimental setup and also used for CMAES optimization
'''
import numpy as np
import time
#from Utils.ThetaNormalization import normalization, unNormalization... | osigaud/ArmModelPython | Control/Experiments/Experiments.py | Python | gpl-2.0 | 14,422 | 0.014284 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | python/federatedml/feature/homo_feature_binning/homo_binning_base.py | Python | apache-2.0 | 9,934 | 0.003221 |
# -*- coding: utf-8 -*-
"""Test the `faux_string` mark."""
import pytest
def is_numeric(value):
"""Check if value is numeric."""
return value.isnumeric()
def contains_number(value):
"""Check to see if the string contains a number."""
return any(char.isnumeric() for char in value)
def test_mark_pla... | mfalesni/pytest-fauxfactory | tests/test_faux_string.py | Python | gpl-3.0 | 5,253 | 0 |
"""
$url raiplay.it
$type live
$region Italy
"""
import logging
import re
from urllib.parse import urlparse, urlunparse
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
log = logging.getLogger(__name__)
class RaiPlayHLSStream... | chhe/streamlink | src/streamlink/plugins/raiplay.py | Python | bsd-2-clause | 1,786 | 0.00168 |
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
class TestCourseTopic(unittest.TestCase):
pass
| frappe/erpnext | erpnext/education/doctype/course_topic/test_course_topic.py | Python | gpl-3.0 | 154 | 0.006494 |
# Copyright (C) 2017 Antoine Fourmy <antoine dot fourmy at gmail dot com>
#
# 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.
#
# This program is distributed in the hope that it will be useful,
# ... | afourmy/pyNMS | pyNMS/right_click_menus/network_general_menu.py | Python | gpl-3.0 | 1,562 | 0.007042 |
def format_path( str ):
while( str.find( '//' ) != -1 ):
str = str.replace( '//', '/' )
return str
| tencent-wechat/phxsql | phxrpc_package_config/tools/phxsql_utils.py | Python | gpl-2.0 | 103 | 0.106796 |
AUTHORITY_XRN = 'ocf.ofam'
SUBJECT = {'CN':'OfeliaSDKR1',
'C':'SP',
'ST':'Catalunya',
'L':'Barcelona',
'O':'i2CAT',
'OU':'DANA',
}
PARENT_SUBJECT = {'CN':'OfeliaSDKR1',
'C':'SP',
'ST':'Catalunya',
'L'... | ict-felix/stack | vt_manager_kvm/src/python/vt_manager_kvm/communication/sfa/setUp/setup_config.py | Python | apache-2.0 | 416 | 0.036058 |
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge... | stonekyx/binary | vendor/scons-local-2.3.4/SCons/Taskmaster.py | Python | gpl-3.0 | 40,520 | 0.002098 |
# ######################### LICENSE ############################ #
# Copyright (c) 2005-2015, Michele Simionato
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# Redistributi... | Bolton-and-Menk-GIS/restapi | restapi/decorator/__init__.py | Python | gpl-2.0 | 16,306 | 0.000736 |
import contextlib
from uuss.server import model
from lolapps.common import uums
from lolapps.util import json
import os
import simplejson
import struct
import time
try:
# Try importing the C++ extension version
import uuss_pb
except:
# The dynamic python version will automatically be used
pass
from uus... | brianr/uuss | proto.py | Python | mit | 17,229 | 0.003541 |
from lib.lib_game import Window
if __name__ == '__main__':
a = Window('first_map_for_test')
a.Run()
| azon1272/War-for-cookies-v2 | game_window.py | Python | bsd-3-clause | 114 | 0.017544 |
from setuptools import find_packages
from setuptools import setup
import io
import os
VERSION = '0.0.3'
def fpath(name):
return os.path.join(os.path.dirname(__file__), name)
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for fil... | audiencepi/SimilarWeb-Python | setup.py | Python | mit | 1,247 | 0 |
from test.picamera_mock import PiCameraMock as PiCamera
class array(object):
def __init(self):
pass
| CoderBotOrg/coderbot | stub/picamera/camera.py | Python | gpl-2.0 | 113 | 0.00885 |
# Copyright 2015 Mario Graff Guerrero
# 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 wri... | mgraffg/RGP | EvoDAG/population.py | Python | apache-2.0 | 18,497 | 0.000378 |
#
# GeoCoon - GIS data analysis library based on Pandas and Shapely
#
# Copyright (C) 2014 by Artur Wroblewski <wrobell@pld-linux.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 ve... | wrobell/geocoon | geocoon/tests/test_sql.py | Python | gpl-3.0 | 1,771 | 0.000565 |
#!/usr/bin/env python
'''
Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's
Smalltalk testing framework.
This module contains the core framework classes that form the basis of
specific test cases and suites (TestCase, TestSuite etc.), and also a
text-based utility class for running the... | ai-ku/langvis | jython-2.1/Lib/unittest.py | Python | mit | 25,555 | 0.002465 |
# Copyright (c) 2014 Alcatel-Lucent Enterprise
# 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
#
# Un... | OpenTouch/python-facette | src/facette/v1/plot.py | Python | apache-2.0 | 2,559 | 0.008988 |
# -*- coding: utf-8 -*-
import datetime
from django.db import models
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ComponentError'
db.create_table(u'maasserver_componenterror', (
('id', self.gf(... | cloudbase/maas | src/maasserver/migrations/0033_component_error.py | Python | agpl-3.0 | 15,078 | 0.007494 |
# Copyright 2019 The Bazel 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 applicable law... | bazelbuild/bazel-bench | utils/bigquery_upload.py | Python | apache-2.0 | 2,925 | 0.009573 |
import ImageGrab
import os
import time
import win32api, win32con
import quickGrab
import ImageOps
from numpy import *
"""
All coordinates assume a screen resolution of 1920x1080
And window size of 1280x720
"""
## Globals
#Top left corner of game window
pad_x = 320
pad_y = 171
#Size of window
window_x = 1280
window... | doofmars/systems_nominal_bot | code.py | Python | mit | 6,584 | 0.092193 |
'''
This is the code containing the the mathematical functions used for the
assignment
'''
import numpy as np
# cotangent
def cot(x):
return np.cos(x) / np.sin(x)
#The rooted equation in the finite well calculation
def rooted_equation(x, Rsquared=36):
return np.sqrt(Rsquared - x ** 2)
# x*tan(x)
def simm... | LorenzoBi/computational_physics | assignments/1/report/code/math_functions.py | Python | mit | 3,299 | 0.001516 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Integration'] , ['MovingAverage'] , ['Seasonal_WeekOfYear'] , ['AR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Integration/model_control_one_enabled_Integration_MovingAverage_Seasonal_WeekOfYear_AR.py | Python | bsd-3-clause | 167 | 0.047904 |
from gi.repository import GObject
import dbus
from blueman.Functions import *
from blueman.main.SignalTracker import SignalTracker
from blueman.plugins.AppletPlugin import AppletPlugin
from blueman.main.KillSwitchNG import KillSwitchNG, RFKillType, RFKillState
try:
import blueman.main.KillSwitch as _KillSwitch
ex... | nmercier/linux-cross-gcc | linux/lib/python2.7/dist-packages/blueman/plugins/applet/KillSwitch.py | Python | bsd-3-clause | 4,342 | 0.004606 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eHA.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| TheBlackDude/ehealth_academy | server/manage.py | Python | mit | 246 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE.TXT file)
import os
from django.core.exceptions import PermissionDenied
from apps.gallery.models import Gallery
from apps.gallery.models import Picture
from apps.team.utils import asse... | F483/bikesurf.org | apps/gallery/control.py | Python | mit | 2,303 | 0.002605 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis_louvain | base/signals/publisher.py | Python | agpl-3.0 | 1,579 | 0.002535 |
from datetime import date, datetime, time, timedelta
from django.contrib import admin
from django.utils import timezone
from enrichmentmanager.models import Teacher, Student, EnrichmentOption, EnrichmentSlot, EnrichmentSignup, EmailSuppression
from simple_history.admin import SimpleHistoryAdmin
class EditableUntilLi... | rectory-school/rectory-apps | enrichmentmanager/admin.py | Python | mit | 4,641 | 0.011635 |
# coding: utf-8
"""
kinto
Kinto is a minimalist JSON storage service with synchronisation and sharing abilities. It is meant to be easy to use and easy to self-host. **Limitations of this OpenAPI specification:** 1. Validation on OR clauses is not supported (e.g. provide `data` or `permissions` in patch ... | gabisurita/kinto-codegen-tutorial | python-client/test/test_group.py | Python | mit | 2,149 | 0.000931 |
#!/usr/bin/env python
# Note: this file is part of some nnet3 config-creation tools that are now deprecated.
from __future__ import print_function
import os
import argparse
import sys
import warnings
import copy
from operator import itemgetter
def GetSumDescriptor(inputs):
sum_descriptors = inputs
while len(s... | michellemorales/OpenMM | kaldi/egs/wsj/s5/steps/nnet3/components.py | Python | gpl-2.0 | 29,765 | 0.013069 |
from httmock import urlmatch
free_proxy_expected = ['138.197.136.46:3128', '177.207.75.227:8080']
proxy_for_eu_expected = ['107.151.136.222:80', '37.187.253.39:8115']
rebro_weebly_expected = ['213.149.105.12:8080', '119.188.46.42:8080']
prem_expected = ['191.252.61.28:80', '167.114.203.141:8080', '152.251.141.93:8080... | pgaref/HTTP_Request_Randomizer | tests/mocks.py | Python | mit | 9,201 | 0.003695 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-datafactory/azure/mgmt/datafactory/models/self_hosted_integration_runtime_node.py | Python | mit | 6,083 | 0.000329 |
#!/usr/bin/env python
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2018 Raik Gruenberg & Johan Leckner
##
## 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 Softwar... | graik/biskit | archive_biskit2/scripts/Dock/pdb2complex.py | Python | gpl-3.0 | 2,397 | 0.0267 |
#
# livecd.py: An anaconda backend to do an install from a live CD image
#
# The basic idea is that with a live CD, we already have an install
# and should be able to just copy those bits over to the disk. So we dd
# the image, move things to the "right" filesystem as needed, and then
# resize the rootfs to the size o... | icomfort/anaconda | livecd.py | Python | gpl-2.0 | 17,872 | 0.003637 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.