code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""
1. Subset(second le)
2. LCS
Given two strings 'X' and 'Y', find the length of the longest common substring.
For example, if the given strings are "GeeksforGeeks" and "GeeksQuiz",
the output should be 5 as longest common substring is "Geeks"
[Solution](http://www.geeksforgeeks.org/longest-common-substring/)
DP is O(... | UmassJin/Leetcode | Experience/Longest_Common_Substring.py | Python | mit | 1,722 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | pidah/st2contrib | packs/orion/actions/node_discover_and_add_interfaces.py | Python | apache-2.0 | 2,765 |
from setuptools import setup
setup(
name='corputil',
version='0.7.0',
packages=['corputil'],
package_data={'corputil': ['stopwords/*.txt']},
install_requires=['nltk'],
url='',
license='',
author='Sascha Can',
author_email='Sascha.Can@gmail.com',
description=''
)
| Saytiras/corputil | setup.py | Python | mit | 305 |
#!/usr/bin/env python
command = oslc("../common/shaders/testpnoise.osl")
command += testshade("-g 512 512 -od uint8 -o Cout out.tif -param noisename perlin testpnoise")
outputs = [ "out.txt", "out.tif" ]
| rlmh/OpenShadingLanguage | testsuite/pnoise-perlin/run.py | Python | bsd-3-clause | 205 |
#!/usr/bin/python
#
# Copyright (C) 2006, 2007, 2010, 2011 Google Inc.
#
# 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... | sarahn/ganeti | test/py/ganeti.utils_unittest.py | Python | gpl-2.0 | 12,151 |
"""
Specific permissions for the micromasters app
"""
from rolepermissions.permissions import register_object_checker
from rolepermissions.checkers import has_permission
from roles.models import Role
from roles.roles import Permissions
@register_object_checker()
def can_advance_search(role, user, program):
"""
... | mitodl/micromasters | roles/permissions.py | Python | bsd-3-clause | 953 |
from c2corg_api.models.route import Route, RouteLocale, ROUTE_TYPE
from c2corg_api.models.document_tag import DocumentTag, DocumentTagLog
from c2corg_api.models.user import User
from c2corg_api.tests.views import BaseTestRest
from c2corg_api.views.document_tag import get_tag_relation
def has_tagged(user_id, document_... | c2corg/v6_api | c2corg_api/tests/views/test_document_tag.py | Python | agpl-3.0 | 4,952 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
import urlparse
import re
import werkzeug.urls
from openerp import tools
from openerp import SUPERUSER_ID
from openerp.osv import osv, fields
URL_REGEX = r'(\bhref=[\'"]([^\'"]+)[\'"])'
class MailMail(osv.... | syci/OCB | addons/mass_mailing/models/mail_mail.py | Python | agpl-3.0 | 5,729 |
"""Create atomic displacements."""
# Copyright (C) 2011 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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 r... | atztogo/phonopy | phonopy/phonon/modulation.py | Python | bsd-3-clause | 11,079 |
__author__ = 'Jeddah'
__project__ = "WaterDemandMdeol"
import sampling_db as DB
import C_ApplianceType as Appliance
import C_UnitType as Unit
import C_ResidentialUnit as residential
import C_CommercialUnit as commercial
class WaterDemandModel():
"""
"""
__residential_units = [] # the number o... | christianurich/DynaMind-ToolBox | DynaMind-Performance-Assessment/3rdparty/CD3Waterbalance/WaterDemandModel/C_WaterDemandModel.py | Python | gpl-2.0 | 9,765 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('Direccion', '0001_initial'),
('Telefono', '0003_auto_20150319_1627'),
('Segmento', '0003_auto_20150320_0842'),
('Cond... | jrmendozat/mtvm | Proveedor/migrations/0001_initial.py | Python | gpl-2.0 | 4,084 |
#! /usr/bin/python
#fitting parameters: minimum, initial guess and maximum values
F0 = [0.1, 0.51, 2.]
R0 = [100., 101., 102.]
gamma0 = [1., 1.2, 1.3]
Temp0 = [299., 300., 300.]
W0 = [5.2, 5.21, 5.22]
#ploting parameters
markers = 'o'
colors = 'b'
font = 45
lw = 5
mw = 15
import numpy as np
import sys
import os
imp... | AndKyr/GETELEC | python/fitdata.py | Python | gpl-3.0 | 1,968 |
"""
This example opens the connection in async mode (does not work properly in Python 2.7).
"""
import os
import time
from msl.equipment import (
EquipmentRecord,
ConnectionRecord,
Backend,
)
record = EquipmentRecord(
manufacturer='Pico Technology',
model='5244B', # update for your PicoScope
... | MSLNZ/msl-equipment | msl/examples/equipment/picotech/picoscope/open_unit_async.py | Python | mit | 1,130 |
# test errors from bad operations (unary, binary, etc)
# unsupported unary operators
try:
~None
except TypeError:
print('TypeError')
try:
~''
except TypeError:
print('TypeError')
try:
~[]
except TypeError:
print('TypeError')
# unsupported binary operators
try:
False in True
except TypeErro... | bvernoux/micropython | tests/basics/op_error.py | Python | mit | 962 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | fernandalavalle/mlab-ns | server/mapreduce/lib/files/blobstore.py | Python | apache-2.0 | 4,936 |
from lab_assistant.storage.backends.base import StorageBackend
from lab_assistant.storage.backends.null import NullBackend
from lab_assistant.storage.backends.redis import RedisBackend
from lab_assistant.tests import cases
import lab_assistant
class FakeStorage(StorageBackend):
pass
class TestGetStorage(cases.T... | joealcorn/lab_assistant | lab_assistant/tests/test_storage.py | Python | mit | 2,837 |
import pytest
from detectem.core import HarProcessor
from detectem.settings import INLINE_SCRIPT_ENTRY, MAIN_ENTRY
class TestHarProcessor:
HAR_NO_URL_REDIRECT = [
{"request": {"url": "http://domain.tld/"}, "response": {}},
{"request": {"url": "http://domain.tld/js/script.js"}, "response": {}},
... | spectresearch/detectem | tests/test_core.py | Python | mit | 1,799 |
from django.conf.urls import patterns, url
from home.views import IndexView
urlpatterns = patterns('',
url(r'^$', IndexView.as_view(), name='index'),
) | sophilabs/djangoboot | app/home/urls.py | Python | mit | 157 |
from vutman.scripts import generate_vut_to_file
def run(output_path):
generate_vut_to_file(output_path)
| daniellawrence/django-vutman | scripts/generate_vut.py | Python | mit | 110 |
"""
Trail Marker
------------
The ``trail`` marker is like the ``line`` marker, but it allows properties of
the line (such as thickness) to vary along the length of the line.
This shows a simple example of the trail mark using stock prices.
"""
# category: other charts
import altair as alt
from vega_datasets import dat... | ellisonbg/altair | altair/vegalite/v2/examples/trail_marker.py | Python | bsd-3-clause | 464 |
# -*- 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... | googleads/google-ads-python | google/ads/googleads/v8/services/services/webpage_view_service/transports/grpc.py | Python | apache-2.0 | 10,127 |
from threading import Thread
from loyalty import Loyalty, TopAlters, get_top_alters, text_top_category, Entropy
from utils import HOME
import json
import os
import pandas as pd
import numpy as np
PATH = HOME + '/Dropbox'
INPUT_FRIENDS = PATH + '/LoyaltyDists/friends/'
INPUT_USERS = PATH + '/LoyaltyDists/user/'
OUTPU... | jblupus/PyLoyaltyProject | loyalty/loyalty2.py | Python | bsd-2-clause | 3,916 |
#! /usr/bin/env python
##############################################################################
# Based on DendroPy Phylogenetic Computing Library.
#
# Copyright 2010 Jeet Sukumaran and Mark T. Holder.
# All rights reserved.
#
# See "LICENSE.txt" for terms and conditions of usage.
#
# If you use this work o... | mtholder/peyotl | peyotl/test/support/pathmap.py | Python | bsd-2-clause | 8,329 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/node_health.py | Python | mit | 2,273 |
import dexml
from dexml import fields
class PatchElement(dexml.Model):
class meta:
tagname = "patch"
order_sensitive = False
name = fields.String(tagname="name")
patchName = fields.String(tagname="patchName")
patchHash = fields.String(tagname="patchHash")
targetHash = fields.String(tagname="targetH... | RasPlex/plex-home-theatre | plex/Update-Installer/manifest-tools/update.py | Python | gpl-2.0 | 2,367 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
##
## This file is part of DaBroker, a distributed data access manager.
##
## DaBroker is Copyright © 2014 by Matthias Urlichs <matthias@urlichs.de>,
## it is licensed under the GPLv3. See the file `README.rst` fo... | smurfix/DaBroker | dabroker/unit/conn.py | Python | gpl-3.0 | 10,356 |
import asyncio
import time
import logging
import re
import os
import gc
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.schema import MetaData
import cloudbot
from cloudbot.client import Client
from cloudbot.config import Config
from cloudbot.reloader impor... | Zarthus/CloudBotRefresh | cloudbot/bot.py | Python | gpl-3.0 | 10,636 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
'''
Simple web server that demonstrates how browser/server interactions
work for GET and POST requests. Use it as a starting point to create a
custom web server for handling specific requests but don't try to use
it for any production work.
You start by creating a simpl... | CohibAA/simple-python-web-server | webserver.py | Python | mit | 22,978 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
class TOnlineIE(InfoExtractor):
IE_NAME = 't-online.de'
_VALID_URL = r'https?://(?:www\.)?t-online\.de/tv/(?:[^/]+/)*id_(?P<id>\d+)'
_TEST = {
'url': 'http://www.t-online.de/tv/sport/fussbal... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/tonline.py | Python | gpl-3.0 | 1,712 |
"""
Copyright (c) 2015 Andreea Georgescu
Created on Sun Mar 1 19:51:42 2015
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.
... | Andreea-G/Codds_DarkMatter | src/experiment_HaloIndep.py | Python | gpl-2.0 | 31,067 |
from __future__ import division
from __future__ import generators | Microsoft/PTVS | Python/Tests/TestData/Grammar/FromFuture24.py | Python | apache-2.0 | 65 |
# HEX = '{:x}'.format
#
#
# class Converter(object):
# @staticmethod
# def to_ascii(s):
# return ''.join(chr(int(s[a:a + 2], 16)) for a in xrange(0, len(s), 2))
#
# @staticmethod
# def to_hex(s):
# return ''.join(HEX(ord(b)) for b in s)
class Converter(object):
@staticmethod
de... | the-zebulan/CodeWars | katas/kyu_5/ascii_hex_converter.py | Python | mit | 435 |
import os
from gears.environment import Environment
from gears.finders import FileSystemFinder
from gears_coffeescript import CoffeeScriptCompiler
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
ASSETS_DIR = os.path.join(ROOT_DIR, 'assets')
STATIC_DIR = os.path.join(ROOT_DIR, 'static')
env = Environment(STAT... | gears/gears-coffeescript | example/compile.py | Python | isc | 518 |
#!/usr/bin/env python
###############################################################################
# #
# fileEntity.py #
# ... | minillinim/ScreamingBackpack | screamingbackpack/fileEntity.py | Python | gpl-3.0 | 4,536 |
#! /usr/bin/env python3
"""
http://oj.leetcode.com/problems/binary-tree-level-order-traversal/
Given a binary tree, return the level order traversal of its nodes' values.
(ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ \
9 20
/ \
15 7
return its lev... | deput/leetcode | binary_tree_level_order_traversal.py | Python | mit | 1,634 |
import os
# We'll render HTML templates and access data sent by POST
# using the request object from flask. Redirect and url_for
# will be used to redirect the user once the upload is done
# and send_from_directory will help us to send/show on the
# browser the file that the user just uploaded
from flask import Flask, ... | davidbradway/fusefit | webui/app/views.py | Python | mit | 2,160 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tanchao'
import sys
SIZE = 256 # defined in challenge description
MATRIX = [[0] * SIZE for i in range(SIZE)]
def set_col(orders_):
col_ = orders_[1] - 1
val_ = orders_[2]
for i in range(SIZE):
MATRIX[i][col_] = val_
def set_row(orde... | tanchao/algo | archive/codeeval/py/query_board.py | Python | mit | 1,315 |
# 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 Everytrace(CMakePackage):
"""Get stack trace EVERY time a program exits."""
homepage ... | iulian787/spack | var/spack/repos/builtin/packages/everytrace/package.py | Python | lgpl-2.1 | 1,235 |
#
# robin.py
#
# Apply customizations for a MKS Robin
def prepare(address, ldname, fwname):
import pioutil
if pioutil.is_pio_build():
import marlin
def encrypt(source, target, env):
marlin.encrypt_mks(source, target, env, fwname)
marlin.relocate_firmware(address)
marlin.custom_ld_script(ldname)
marlin.a... | LVD-AC/Marlin | buildroot/share/PlatformIO/scripts/robin.py | Python | gpl-3.0 | 345 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 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 us... | EmanueleCannizzaro/scons | test/Fortran/module-subdir.py | Python | mit | 3,309 |
"""
This file is part of ocean.
SEA 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.
SEA is distributed in the hope that it will be useful,
... | neuromancer/ocean | src/Analysis.py | Python | gpl-3.0 | 1,848 |
"""Brings up a DNS server with container (skydns + skydock) that allow
different dockers to see each other by hostnames.
"""
import common
import docker
def up(uid):
create_service = '{0}/createService.js'.format(common.get_script_dir())
skydns = docker.run(
image='crosbymichael/skydns',
det... | xorver/oneprovider_ccm | bamboos/docker/environment/dns.py | Python | mit | 1,107 |
../../../../share/pyshared/oauth/__init__.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/oauth/__init__.py | Python | gpl-3.0 | 44 |
# -*- coding: UTF-8 -*-
__kupfer_name__ = _("Shorten Links")
__kupfer_actions__ = ("ShortenLinks", )
__description__ = _("Create short aliases of long URLs")
__version__ = "2011-03-01"
__author__ = "Karol Będkowski <karol.bedkowski@gmail.com>"
import httplib
import urllib
from kupfer.objects import Leaf, Action, Sour... | Theragon/kupfer | kupfer/plugin/shorten_links.py | Python | gpl-3.0 | 4,025 |
#!/usr/bin/env python
# Copyright 2021 Google LLC 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... | googleapis/python-analytics-admin | samples/properties_user_links_batch_get.py | Python | apache-2.0 | 2,230 |
#!/usr/bin/env python
#
# GrovePi Example for using the Grove Temperature & Humidity Sensor Pro
# (http://www.seeedstudio.com/wiki/Grove_-_Temperature_and_Humidity_Sensor_Pro)
#
# The GrovePi connects the Raspberry Pi and Grove sensors.
# You can learn more about GrovePi here: http://www.dexterindustries.com/GroveP... | penoud/GrovePi | Software/Python/grove_dht_pro.py | Python | mit | 2,333 |
#
# Copyright (C) 2010 Cardapio Team (tvst@hotmail.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, either version 3 of the License, or
# (at your option) any later version.
#
# ... | genesi/cardapio | src/plugins/command_launcher.py | Python | gpl-3.0 | 4,494 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 Palo Alto Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | PaloAltoNetworks-BD/ansible-pan | library/panos_address_object.py | Python | isc | 5,097 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Built-in mask mixin class.
The design uses `Masked` as a factory class which automatically
generates new subclasses for any data class that is itself a
subclass of a predefined masked class, with `MaskedNDArray`
providing such ... | pllim/astropy | astropy/utils/masked/core.py | Python | bsd-3-clause | 45,844 |
import json
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
class TestSubmitService(TestCase):
fixtures = ['test_users', 'test_contest', 'test_full_package',
'test_problem_instance', 'test_messages', 'test... | papedaniel/oioioi | oioioi/submitservice/tests.py | Python | gpl-3.0 | 1,593 |
from RMPY.rig import rigSingleJoint
from RMPY.rig import rigBase
import pymel.core as pm
class RigPropModel(rigBase.BaseModel):
def __init__(self):
super(RigPropModel, self).__init__()
self.single_joints = []
class RigProp(rigBase.RigBase):
def __init__(self, *args, **kwargs):
super(... | rendermotion/RMMel | rig/rigProp.py | Python | lgpl-3.0 | 1,843 |
"""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)
... | invisiblek/python-for-android | python3-alpha/python3-src/Lib/test/test_htmlparser.py | Python | apache-2.0 | 13,425 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (... | jumpstarter-io/nova | nova/db/sqlalchemy/models.py | Python | apache-2.0 | 52,354 |
#!/usr/bin/env python3
"""
wsdump.py
websocket - WebSocket client library for Python
Copyright 2021 engn33r
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/LICE... | liris/websocket-client | bin/wsdump.py | Python | lgpl-3.0 | 6,906 |
"""
Adds this import line:
from builtins import XYZ
for each of the functions XYZ that is used in the module.
"""
from __future__ import unicode_literals
from lib2to3 import fixer_base
from lib2to3.pygram import python_symbols as syms
from lib2to3.fixer_util import Name, Call, in_special_context
from libfuturi... | noam09/deluge-telegramer | telegramer/include/libpasteurize/fixes/fix_future_builtins.py | Python | gpl-3.0 | 1,450 |
import datetime
one_day = datetime.timedelta(days=1)
def get_semana(date):
"""Return the full week (Monday first) of the week containing the given date.
'date' may be a datetime or date instance (the same type is returned).
"""
day_idx = (date.weekday()) % 7 # turn sunday into 0, monday into 1, etc.
sunda... | mchaparro/horarios | horarios/views/dias_semana.py | Python | apache-2.0 | 518 |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# copyright 2003-2010 Sylvain Thenault, all rights reserved.
# contact mailto:thenault@gmail.com
#
# This file is part of logilab-astng.
#
# logilab-astng is free software: you can redi... | gkarlin/django-jenkins | build/logilab-astng/raw_building.py | Python | lgpl-3.0 | 13,712 |
from contextlib import contextmanager
from resource import getrusage, RUSAGE_SELF
import sys
import time
from invoke.vendor.six import wraps
from spec import skip
def current_cpu_usage():
rusage = getrusage(RUSAGE_SELF)
return rusage.ru_utime + rusage.ru_stime
@contextmanager
def assert_cpu_usage(lt, verb... | mkusz/invoke | integration/_util.py | Python | bsd-2-clause | 1,491 |
import sys
import logging
import os
from os.path import dirname, split
def install_service(argv):
from .servicehelpers import handle_command_line
new_argv = [dirname(__file__)]
for arg in argv:
new_argv.append(arg)
handle_command_line(new_argv)
if __name__ == '__main__':
sys.path.append(o... | xmedius/sendsecure-filepoller | sendsecurefilepoller/sendsecurefilepoller.py | Python | mit | 2,266 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=====================
Classifier comparison
=====================
A comparison of a several classifiers in scikit-learn on synthetic datasets.
The point of this example is to illustrate the nature of decision boundaries
of different classifiers.
This should be taken with ... | fabianp/scikit-learn | examples/classification/plot_classifier_comparison.py | Python | bsd-3-clause | 4,895 |
import bstree
RED = 0
BLACK = 1
class RBTreeNode(bstree.BSTreeNode):
"""A node of a Red-Black Tree"""
def __init__(self, k, v, nil=None):
super(RBTreeNode, self).__init__(k, v, nil)
self.color = BLACK
self.size = 0
def update_size(self):
"""Update the size attribute u... | anonion0/nsec3map | n3map/tree/rbtree.py | Python | gpl-3.0 | 8,290 |
# Copyright 2013-2021 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 RGoDb(RPackage):
"""A set of annotation maps describing the entire Gene Ontology
A se... | LLNL/spack | var/spack/repos/builtin/packages/r-go-db/package.py | Python | lgpl-2.1 | 1,209 |
from __future__ import print_function, unicode_literals
import argparse
import ConfigParser
import sys
import requests
from .utils import Session
def parse_arguments(argv):
parser = argparse.ArgumentParser(
description="Delete JIRA users",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,... | singingwolfboy/jira-migrate | jira_migrate/users.py | Python | mit | 2,540 |
"""
Browser set up for acceptance tests.
"""
# pylint: disable=no-member
# pylint: disable=unused-argument
from base64 import encodestring
from json import dumps
from logging import getLogger
import requests
from django.conf import settings
from django.core.management import call_command
from lettuce import after, b... | pepeportela/edx-platform | common/djangoapps/terrain/browser.py | Python | agpl-3.0 | 10,330 |
# 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, s... | sasha-gitg/python-aiplatform | .sample_configs/param_handlers/delete_data_item_sample.py | Python | apache-2.0 | 708 |
from __future__ import absolute_import, unicode_literals
from django_pg.utils.gis import gis_backend
if gis_backend:
from django.contrib.gis.db.models import *
from django_pg.models.base import Model, Manager, GeoManager
else:
from django.db.models import *
from django_pg.models.base import Model, Mana... | lukesneeringer/django-pgfields | django_pg/models/__init__.py | Python | bsd-3-clause | 363 |
from datetime import timedelta
from functools import partial
import itertools
import json
import operator
from operator import add
import os
from time import time, sleep
import sys
import pytest
from tornado import gen
from tornado.queues import Queue
from tornado.ioloop import IOLoop
import streamz as sz
from stre... | mrocklin/streams | streamz/tests/test_core.py | Python | bsd-3-clause | 35,537 |
# coding: utf-8
from __future__ import unicode_literals, division, print_function
import os
from pymatgen.util.testing import PymatgenTest
from pymatgen.core.structure import Structure
from pymatgen.core.units import Ha_to_eV
from pymatgen.io.abinitio.abiobjects import *
import warnings
test_dir = os.path.join(os.... | yanikou19/pymatgen | pymatgen/io/abinitio/tests/test_abiobjects.py | Python | mit | 4,064 |
"""
Example producer that sends a single message and exits.
You can use `complete_receive.py` to receive the message sent.
"""
from __future__ import absolute_import, unicode_literals
from kombu import Connection, Producer, Exchange, Queue
#: By default messages sent to exchanges are persistent (delivery_mode=2),
... | urbn/kombu | examples/complete_send.py | Python | bsd-3-clause | 1,211 |
#-------------------------------------------------------------------------------
# Copyright 2017 Cognizant Technology Solutions
#
# 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:... | CognizantOneDevOps/Insights | PlatformAgents/com/cognizant/devops/platformagents/agents/artifactmanagement/nexus/NexusAgent3.py | Python | apache-2.0 | 7,233 |
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.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 License,... | bram85/topydo | test/facilities.py | Python | gpl-3.0 | 1,802 |
from __future__ import absolute_import, unicode_literals
from contextlib import contextmanager
from os.path import normpath
from pprint import pformat
import django
from django import http
from django.conf.urls import url
from django.db.models.query import QuerySet, RawQuerySet
from django.template import Context, Re... | seperman/django-debug-toolbar | debug_toolbar/panels/templates/panel.py | Python | bsd-3-clause | 8,872 |
#!/usr/bin/env python
"""
Convert a series of images to a CSS animation. Outputs an image file
containing the frames of the animation and an HTML file with sample CSS
for embedding the animation on a page.
Usage: walt FILENAMES... [options]
Options:
--help Show this screen.
--version ... | Osmose/walt | walt.py | Python | mit | 4,090 |
from collections import OrderedDict
from flask import (
Blueprint, render_template, request, flash, redirect, url_for, abort
)
from flask.ext import menu
from sqlalchemy.orm import aliased
from sqlalchemy.orm.strategy_options import Load
from sqlalchemy.sql.expression import select
from models import *
from forms ... | qqalexqq/monkeys | views.py | Python | mit | 10,528 |
#! -*- coding: utf-8 -*-
import ftplib
import socket
import os
from miscellaneous.MisExceptions import FtpConnectError
from miscellaneous.MisExceptions import FtpLoginError
from miscellaneous.MisExceptions import FtpDownloadError
from miscellaneous.MisExceptions import FtpUploadError
class BaseFtp(object):
CONNEC... | fumanne/miscellaneous | miscellaneous/MisFtp.py | Python | gpl-3.0 | 4,377 |
# -*- coding: utf-8 -*-
## begin license ##
#
# "Seecr Test" provides test tools.
#
# Copyright (C) 2012-2015, 2019-2021 Seecr (Seek You Too B.V.) https://seecr.nl
#
# This file is part of "Seecr Test"
#
# "Seecr Test" is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Publi... | seecr/seecr-test | test/utilstest.py | Python | gpl-2.0 | 10,633 |
# -*- coding: utf-8 -*-
"""Electromagnetic radiation
"""
| woutdenolf/spectrocrunch | spectrocrunch/sources/__init__.py | Python | mit | 58 |
#*****************************************************************************
# fseed.py
#
# SEED builder for SeisComP
#
# (c) 2005 Andres Heinloo, GFZ Potsdam
#
# 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 Sof... | IPGP/webobs | CODE/bin/arclinkfetch/share/seiscomp3af/seiscomp/fseed.py | Python | gpl-3.0 | 82,130 |
"""Managing infections for deployments"""
from . import subset_sum
from .infection import InfectionControl, Infector, CDC
__all__ = ["InfectionControl", "Infector", "CDC", "subset_sum"]
| stephen-khan/feature_infection | feature_infection/__init__.py | Python | unlicense | 188 |
#!/usr/bin/env python
#
# Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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 th... | linostar/timeline-clone | po/import-po-from-launchpad-export.py | Python | gpl-3.0 | 1,586 |
#!/usr/bin/env python
import os
import django
from os import path
from django.conf import settings
from django.core.management import call_command
def main():
if not settings.configured:
module_root = path.dirname(path.realpath(__file__))
settings.configure(
DEBUG = False,
... | ixc/django-fluent-contents | makemessages.py | Python | apache-2.0 | 634 |
""" Management command to cleanup old waiting enrollments """
from __future__ import absolute_import, unicode_literals
import logging
from django.core.management.base import BaseCommand
from ... import tasks
logger = logging.getLogger(__name__)
class Command(BaseCommand):
"""
Deletes enrollments not tied ... | ESOedX/edx-platform | lms/djangoapps/program_enrollments/management/commands/expire_waiting_enrollments.py | Python | agpl-3.0 | 1,114 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | scripnichenko/nova | nova/db/sqlalchemy/migration.py | Python | apache-2.0 | 40,653 |
import os, sys
import imp
import time
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
constants = imp.load_source('modulename', 'constants.py')
from decimal import *
def create_an_accept_payment_transaction(amount):
# Create a merchantAuthenticationType object with authenticatio... | AuthorizeNet/sample-code-python | AcceptSuite/create-an-accept-payment-transaction.py | Python | mit | 5,389 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from beethoven import settings
urlpatterns = patterns(
'',
url(r'^$', 'accounts.views.index', name='index'),
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('allauth.urls')),
url(r'^', include('cours... | lockhawksp/beethoven | beethoven/urls.py | Python | mit | 683 |
import json
from django.test.client import Client
from django.utils.timezone import now, timedelta, localtime
from django.contrib.auth.models import User
from todo_lists.models import (
ToDoList,
ToDoContext,
ToDo,
)
class ToDoViewsTestCaseMixin(object):
def create_n_todos(self, n, user, todo_list):
... | pawartur/django-todo-lists | todo_lists/tests/mixins.py | Python | bsd-3-clause | 2,802 |
from mock import Mock
import pytest
import pytest_twisted
from twisted.internet import defer
from nav.ipdevpoll.jobs import SuggestedReschedule
from nav.ipdevpoll.plugins.snmpcheck import SnmpCheck
@pytest.fixture
def plugin():
netbox = Mock()
agent = Mock()
containers = dict()
return SnmpCheck(netb... | hmpf/nav | tests/unittests/ipdevpoll/plugins_snmpcheck_test.py | Python | gpl-3.0 | 2,539 |
# @Author: Manuel Rodriguez <valle>
# @Date: 10-May-2017
# @Email: valle.mrv@gmail.com
# @Filename: listview.py
# @Last modified by: valle
# @Last modified time: 01-Mar-2018
# @License: Apache license vesion 2.0
from kivy.uix.anchorlayout import AnchorLayout
from kivy.lang import Builder
from kivy.properties imp... | vallemrv/tpvB3 | tpv_for_eetop/valle_libs/components/listview.py | Python | apache-2.0 | 1,446 |
'''
Copyright (c) <2012> Tarek Galal <tare2.galal@gmail.com>
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,
m... | yah0o2010/whatsploit | Yowsup/connectionmanager.py | Python | mit | 44,255 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-17 18:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('annonce', '0009_auto_20160917_1303'),
]
operations = [
migrations.AlterFiel... | firasbenmakhlouf/JobLookup | annonce/migrations/0010_auto_20160917_1854.py | Python | mit | 454 |
#!/usr/bin/python
# =======================================================================
# This file is part of MCLRE.
#
# MCLRE 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... | augustoqm/MCLRE | src/recommender_execution/run_rec_mrbpr.py | Python | gpl-3.0 | 5,871 |
""" Pipeless / examples.py. MIT licensed.
Basic functionality
>>> from pipeless import pipeline
>>> function, run, _ = pipeline(lambda item, e: None)
>>> @function
... def up_one(_): return _+1
>>> list(run([0, 1, 3]))
[1, 2, 4]
>>> @function
... def twofer(_):
... yield _
... yield _
>>> list(run([0, 1, 3]))
... | andychase/pipeless | examples.py | Python | mit | 1,451 |
# -*- coding: utf-8 -*-
import json
import datetime
from datetime import date
import turbotlib
from bs4 import BeautifulSoup
import bs4
import requests
#FUNCTIONS
#retrieve a document at a given URL as parsed html tree
def get_doc(source_url):
response = requests.get(source_url)
html = response.content
doc = Beaut... | dinotash/opencorporates | ro-sec-licences/scraper.py | Python | mit | 5,840 |
# -*- coding: utf-8 -*-
#
# Ceres Solver documentation build configuration file, created by
# sphinx-quickstart on Sun Jan 20 20:34:07 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... | af-silva/cartographer_ros | thirdparty/ceres_solver/docs/source/conf.py | Python | apache-2.0 | 7,935 |
"""
Test thread stepping features in combination with frame select.
"""
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class ThreadSteppingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/lang/c/stepping/TestThreadStepping.py | Python | bsd-3-clause | 3,367 |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from fest.views import score, rateMe, home, result_action, ItemListView, ItemDetailScoreView, ItemDetailView, confirm_rating, save_score, SpecialAwardListView
from django.contrib import admin... | rashivkp/animation-fest | fest/urls.py | Python | agpl-3.0 | 1,781 |
#!/usr/bin/env python
# Copyright (C) 2009-2010:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken 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 F... | wbsavage/shinken | test/test_config.py | Python | agpl-3.0 | 1,302 |
# Copyright (C) 2010 by Kevin Saff
# This file is part of the CA scanner.
# The CA scanner 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 la... | kcsaff/CA | src/charts/_scantop.py | Python | gpl-3.0 | 7,923 |
# -*- coding:utf-8 -*-
#
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program 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, eit... | Endika/hr | hr_payroll_period/hr_attendance.py | Python | agpl-3.0 | 4,381 |
# coding: utf-8
r"""Offset operations"""
import logging
from OCC.BRepOffset import BRepOffset_Skin
from OCC.BRepOffsetAPI import BRepOffsetAPI_MakeOffset, \
BRepOffsetAPI_MakeOffsetShape
from OCC.GeomAbs import GeomAbs_Arc, GeomAbs_Tangent, GeomAbs_Intersection
from aocutils.exceptions import OffsetShapeExcepti... | guillaume-florent/aoc-utils | aocutils/operations/offset.py | Python | lgpl-3.0 | 3,535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.