code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Copyright (C) 2005 John Arbash-Meinel <john@arbash-meinel.com>
# Modified up by: Todd Whiteman <ToddW@ActiveState.com>
#
# This file is part of paramiko.
#
# Paramiko 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
# Softwa... | dindahaus/edgessh | paramiko/win_pageant.py | Python | gpl-2.0 | 4,973 |
import os
os.system('rm -rf /usr/share/subterfuge/')
os.system('rm -rf /bin/subterfuge')
| siddh1234/subterfuge | uninstall.py | Python | gpl-3.0 | 92 |
#!/usr/bin/python
# (c) 2018-2019, NetApp, Inc
# (c) 2018 Piotr Olczak <piotr.olczak@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '... | thaim/ansible | lib/ansible/modules/storage/netapp/na_ontap_motd.py | Python | mit | 7,427 |
# Copyright: (c) 2018, Pluribus Networks
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn_connection_s... | anryko/ansible | test/units/modules/network/netvisor/test_pn_connection_stats_settings.py | Python | gpl-3.0 | 3,155 |
from django.contrib import admin
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.contrib.contenttypes.admin import GenericTabularInline
from django.contrib.contenttypes.models import ContentType
from django.forms.formsets import DEFAULT_MAX_NUM
from django.forms.... | frankvdp/django | tests/generic_inline_admin/tests.py | Python | bsd-3-clause | 16,347 |
from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import SavedSearch
@register(SavedSearch)
class SavedSearchSerializer(Serializer):
def serialize(self, obj, attrs, user):
return {
'id': str(obj.id),
'name': obj.name,... | Kryz/sentry | src/sentry/api/serializers/models/savedsearch.py | Python | bsd-3-clause | 406 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_unquote,
compat_urllib_parse_urlparse,
)
from ..utils import (
sanitized_Request,
str_to_int,
unified_strdate,
)
from ..aes import aes_decrypt_text
class SpankwireIE(Inf... | nandhp/youtube-dl | youtube_dl/extractor/spankwire.py | Python | unlicense | 4,853 |
baz = 100 | xNUTs/PTVS | Python/Tests/TestData/MultiProjectAnalysis/PythonLibrary/fob.py | Python | apache-2.0 | 9 |
# 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... | Northrend/mxnet | example/gluon/kaggle_k_fold_cross_validation.py | Python | apache-2.0 | 6,871 |
# 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... | szha/mxnet | python/mxnet/symbol/numpy/_internal.py | Python | apache-2.0 | 840 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | FNST-OpenStack/horizon | horizon/test/tests/templatetags.py | Python | apache-2.0 | 5,373 |
"""Lite version of scipy.linalg.
Notes
-----
This module is a lite version of the linalg.py module in SciPy which
contains high-level Python interface to the LAPACK library. The lite
version only accesses the following LAPACK functions: dgesv, zgesv,
dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/linalg/linalg.py | Python | bsd-2-clause | 75,738 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.core import util
# Bring in tvcm module for basic JS components capabilities.
util.AddDirToPythonPath(
util.GetChromiumSrcDir(),
'thi... | 7kbird/chrome | tools/telemetry/telemetry/web_components/tvcm_stub.py | Python | bsd-3-clause | 549 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Marius Gedminas <marius@pov.lt>
# (c) 2016, Matthew Gamble <git@matthewgamble.net>
#
# 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... | sysadmind/ansible-modules-extras | source_control/git_config.py | Python | gpl-3.0 | 7,329 |
# Copyright 2013 Intel Corporation
#
# 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 ... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/db/sqlalchemy/migrate_repo/versions/228_add_metrics_in_compute_nodes.py | Python | gpl-2.0 | 1,583 |
#
# (c) 2016 Red Hat Inc.
#
# 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) any later version.
#
# Ansible is d... | alxgu/ansible | lib/ansible/plugins/terminal/ironware.py | Python | gpl-3.0 | 2,700 |
from __future__ import absolute_import, unicode_literals
from datetime import date
import warnings
from django import forms
from django.core.exceptions import FieldError, ValidationError
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms.models import (modelform_factory, ModelChoiceField,... | atruberg/django-custom | tests/model_forms_regress/tests.py | Python | bsd-3-clause | 23,659 |
"""Tests for validate-modules regexes."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from validate_modules.main import TYPE_REGEX
@pytest.mark.parametrize('cstring,cexpected', [
['if type(foo) is Bar', True],
['if Bar is type(foo)', True],
['if ... | aperigault/ansible | test/lib/ansible_test/tests/validate-modules-unit/test_validate_modules_regex.py | Python | gpl-3.0 | 1,796 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | chand3040/sree_odoo | openerp/addons/account/__openerp__.py | Python | agpl-3.0 | 7,503 |
#!/usr/bin/env python
#
# Wrapper script for starting the biopet-seqstat JAR package
#
# This script is written for use with the Conda package manager and is copied
# from the peptide-shaker wrapper. Only the parameters are changed.
# (https://github.com/bioconda/bioconda-recipes/blob/master/recipes/peptide-shaker/pept... | zachcp/bioconda-recipes | recipes/biopet-seqstat/biopet-seqstat.py | Python | mit | 3,367 |
#!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# This module 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... | stianvi/ansible-modules-core | cloud/openstack/os_user_group.py | Python | gpl-3.0 | 3,146 |
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | scripnichenko/nova | nova/api/openstack/compute/legacy_v2/contrib/flavor_rxtx.py | Python | apache-2.0 | 2,175 |
def foo(*arg, a=1, b=2):
pass
foo(<arg1>1, <arg2>2, <arg3>b=10, <arg4>a=20)
| asedunov/intellij-community | python/testData/paramInfo/Py3kPastTupleArg.py | Python | apache-2.0 | 79 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class CppNamespaceEnvironment(object):
def __init__(self, namespace_pattern):
self.namespace_pattern = namespace_pattern
| scheib/chromium | tools/json_schema_compiler/cpp_namespace_environment.py | Python | bsd-3-clause | 290 |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Norwegian municipalities (fylker) fro use as `choices`
in a formfield.
This exists in this standalone file so that it's on ly imported into memory
when explicitly needed.
"""
from __future__ import unicode_literals
MUNICIPALITY_CHOICES = (
('akershus', 'Akershus... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/contrib/localflavor/no/no_municipalities.py | Python | bsd-3-clause | 965 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_summary \
import AccountsReceivableSummary
def execute(filt... | manassolanki/erpnext | erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.py | Python | gpl-3.0 | 482 |
"""
Wrapper for loading templates from the filesystem.
"""
from django.core.exceptions import SuspiciousFileOperation
from django.template import Origin, TemplateDoesNotExist
from django.utils._os import safe_join
from .base import Loader as BaseLoader
class Loader(BaseLoader):
def __init__(self, engine, dirs=... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/template/loaders/filesystem.py | Python | mit | 1,507 |
#!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies inclusion of $HOME/.gyp/includes.gypi works.
"""
import os
import TestGyp
test = TestGyp.TestGyp()
os.environ['HOME'] = os.p... | nawawi/wkhtmltopdf | webkit/Source/ThirdParty/gyp/test/home_dot_gyp/gyptest-home-includes.py | Python | lgpl-3.0 | 760 |
# -*- coding: utf-8 -*-
import itertools
import openerp.modules.registry
import openerp
from openerp.tests import common
class CreatorCase(common.TransactionCase):
model_name = False
def __init__(self, *args, **kwargs):
super(CreatorCase, self).__init__(*args, **kwargs)
self.model = None
... | diogocs1/comps | web/openerp/addons/test_impex/tests/test_export.py | Python | apache-2.0 | 19,124 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ocean_stories', '0007_auto_20150122_2225'),
]
operations = [
migrations.AlterField(
model_name='oceanstorysectio... | MidAtlanticPortal/marco-portal2 | marco/portal/ocean_stories/migrations/0008_auto_20150203_2337.py | Python | isc | 459 |
#!/usr/bin/env python
"""
Create schematic of chest with custom potions.
"""
import os, sys
import Tkinter, tkFileDialog, ttk
import struct
import pynbt
class PotionEffect:
def __init__(self, i, amp, dur):
self.id = i
self.amplifier = amp
self.duration = dur
... | kamyu2/pynbt-tools | Potion Chest.py | Python | isc | 14,215 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_dress
----------------------------------
Tests for the `BuiltinType` dress method
"""
import unittest
from numbers import Number
from finitio.types import BuiltinType
from finitio.exceptions import DressError
class TestBuiltinTypeConstructor(unittest.TestCase... | llambeau/finitio.py | tests/type/builtin_type/test_dress.py | Python | isc | 963 |
# Copyright (C) 2016-2020 Internet Systems Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET ... | isc-projects/forge | tests/softwaresupport/kea4_server/mysql_reservation.py | Python | isc | 899 |
from .colored_traceback import add_hook, Colorizer
| staticshock/colored-traceback.py | colored_traceback/__init__.py | Python | isc | 51 |
#!/usr/bin/env python
# Copyright (c) 2011 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND T... | utah-scs/RAMCloud | scripts/config.py | Python | isc | 4,734 |
# urllib3/connectionpool.py
# Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import logging
import socket
from base64 import b64encode
from socket import error as S... | dvska/requesocks | requesocks/packages/urllib3/connectionpool.py | Python | isc | 24,422 |
import yaml
from requests import Session
from requests.adapters import HTTPAdapter
from requests.exceptions import ConnectionError, ConnectTimeout, HTTPError
from .messaging import die
from .yaml import safe_load
try:
from urllib3.util.retry import Retry
except ImportError:
# Requests < 2.16.0
from reques... | timeoutdigital/treehugger | treehugger/ec2.py | Python | isc | 1,795 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2022 F4PGA 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
#
# Unl... | SymbiFlow/prjuray | fuzzers/002-tilegrid/cmt_right/top.py | Python | isc | 3,117 |
from math import tau
import numpy as np
import pandas as pd
from pandas import to_datetime
mars_years = {28: "2006-01-23",
29: "2007-12-10",
30: "2009-10-27",
31: "2011-09-15",
32: "2013-08-01",
33: "2015-06-19",
34: "2017-05-05",
... | michaelaye/planet4 | planet4/stats.py | Python | isc | 3,662 |
"""Test system functionality with an Auth0 code/verifier."""
import asyncio
import logging
from aiohttp import ClientSession
from simplipy import API
from simplipy.errors import SimplipyError
_LOGGER = logging.getLogger()
SIMPLISAFE_AUTHORIZATION_CODE = "<AUTHORIZATION_CODE>"
SIMPLISAFE_CODE_VERIFIER = "<CODE_VERIF... | w1ll1am23/simplisafe-python | examples/test_client_by_auth.py | Python | mit | 2,257 |
def attrsetter( attribute, *static_value ):
"""
Attrsetter function.
The examples below show the 2 supported modes in conjunction with itertools.imap().
import itertools
import itermate.operator
>>> class Foo(object):
>>> bar = 0
... | hweickert/itermate | itermate/operator.py | Python | mit | 1,071 |
# -*- coding: utf-8 -*-
"""High level wrapper for Serial resources.
This file is part of PyVISA.
:copyright: 2014-2020 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from .. import attributes, constants
from ..attributes import Attribute
from .messagebased import Me... | pyvisa/pyvisa | pyvisa/resources/serial.py | Python | mit | 3,638 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VmPrimaryFailoverEvent(vim, *args, **kwargs):
'''This event records a fault tolerance... | xuru/pyvisdk | pyvisdk/do/vm_primary_failover_event.py | Python | mit | 1,272 |
"""Python client for Sift Science's API.
See: https://siftscience.com/docs/references/events-api
"""
import json
import requests
import requests.auth
import sys
if sys.version_info[0] < 3:
import six.moves.urllib as urllib
_UNICODE_STRING = str
else:
import urllib.parse
_UNICODE_STRING = str
import s... | SiftScience/sift-python | sift/client.py | Python | mit | 32,268 |
from sanic.response import text
from threading import Event
import asyncio
from queue import Queue
def test_create_task(app):
e = Event()
async def coro():
await asyncio.sleep(0.05)
e.set()
app.add_task(coro)
@app.route("/early")
def not_set(request):
return text(e.is_se... | lixxu/sanic | tests/test_create_task.py | Python | mit | 931 |
#!/usr/bin/python
#-*-coding: utf-8 -*-
"""
Created on Tue Jan 06 16:29:22 2015
@author: Wasit
"""
import numpy as np
import pandas as pd
#boundary T score
#boundary=[50, 55, 60, 70, 80, 85, 90]
boundary=[40, 45, 50, 60, 70, 80, 85]
gtext=['F','D','D+','C','C+','B','B+','A']
gnum={'F':0.0,'D':1.0,'D+':1.5,'C':2.0,'C+... | wasit7/A2F | gen_report.py | Python | mit | 5,204 |
__author__ = 'sashgorokhov'
__email__ = 'sashgorokhov@gmail.com'
import os, time
os.startfile('convertui.cmd')
files = [
r'..\modules\forms\downloadform\ui.py',
r'..\modules\forms\mainform\ui.py',
r'..\modules\forms\mainform\components\audiolist\components\audiolistitemwidget\ui.py',
r'..\modules\form... | sashgorokhov/VK-P-P-Music-Project | resourses/convertui.py | Python | mit | 885 |
import sys
import numpy as np
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5 import uic
from PyQt5.QtGui import *
from scipy.misc import imread, imsave
from canny import gradient, thin_nonmaximum, thin_hysteresis
from hough import hough_learn, hough_detect
import math
import cv2
class Image():
... | jekahy/EIASR | src/demo_gui.py | Python | mit | 12,660 |
"""pyramid_fullauth's installation file."""
from setuptools import setup
setup()
| fizyk/pyramid_fullauth | setup.py | Python | mit | 82 |
#!/usr/bin/env python
# encoding: utf-8
"""
Maps for cmd interface settings
Code adapted from ezpadova - Morgan Fousneau, MIT License
"""
from __future__ import print_function, unicode_literals, division
import sys
if sys.version_info[0] > 2:
py3k = True
from urllib.parse import urlencode
from urllib im... | jonathansick/padova | padova/interface.py | Python | mit | 3,657 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-logic/azure/mgmt/logic/logic_management_client.py | Python | mit | 9,328 |
from django.test import TestCase
from . import models
class TestPerson(TestCase):
def test_read_write(self):
"""Make sure we can read/write to the person table"""
person = models.Person.objects.create(name='Lisa')
self.assertTrue(models.Person.objects.filter(name=person.name).exists())
| WimpyAnalytics/django-readonly-schema | readonly/legacy/tests.py | Python | mit | 320 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/express_route_circuits_arp_table_list_result_py3.py | Python | mit | 1,269 |
import pytest
from fastapi.testclient import TestClient
from docs_src.dependencies.tutorial004 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/items/": {
"get": {
"responses": {
... | tiangolo/fastapi | tests/test_tutorial/test_dependencies/test_tutorial004.py | Python | mit | 4,481 |
"""
Testing helper functions for cleaning different field types
"""
import pytest
from mcwriter.exceptions import CleaningError, ConfigError, MissingFieldError
from mcwriter.cleaning import (_clean_mandatory_str_fields,
_clean_optional_str_fields,
_clean_man... | pocin/kbc-mailchimp-writer | tests/test_cleaning.py | Python | mit | 7,820 |
class Item: # python3
def __init__(self, name, description, weight, value):
self.name = name
self.description = description
self.weight = weight
self.value = value
def describe(self):
msg = """Name = {}\nDescription = {}\nWeight = {} lbs\nValue = {} gol... | utilForever/ProgrammingPractice | Solutions/keyakoto/Game Shop/Part1/gameshop1.py | Python | mit | 623 |
from conch.distance.dct import DctFunction
def test_dct(reps_for_distance):
source, target = reps_for_distance
func = DctFunction()
dist = func(source, target)
| mmcauliffe/python-acoustic-similarity | tests/test_distance_dct.py | Python | mit | 174 |
"""
This should results in an average return of ~3000 by the end of training.
Usually hits 3000 around epoch 80-100. Within a see, the performance will be
a bit noisy from one epoch to the next (occasionally dips dow to ~2000).
Note that one epoch = 5k steps, so 200 epochs = 1 million steps.
"""
from gym.envs.mujoco ... | vitchyr/rlkit | examples/td3.py | Python | mit | 3,872 |
import os, sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import apx
import unittest
import remotefile
import time
class MockTransmitHandler(remotefile.TransmitHandler):
def __init__(self):
self.transmittedData=bytearray()
def send(self, data):
... | cogu/py-apx | tests/file_manager_test.py | Python | mit | 1,710 |
#!/usr/bin/env python3
"""An interactive viewer for todo-txt."""
import os
import re
import sys
import time
import argparse
import subprocess
import curses
from contextlib import contextmanager, suppress
"""Maps a priority to a color. First entry is priority A, second B, and so on.
If there are more priorities than ... | aengl/lsi | lsi.py | Python | mit | 18,583 |
import _plotly_utils.basevalidators
class OffsetgroupValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="offsetgroup", parent_name="histogram", **kwargs):
super(OffsetgroupValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_na... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram/_offsetgroup.py | Python | mit | 410 |
# DO NOT USE
# python setup.py install
# See http://docs.ros.org/hydro/api/catkin/html/user_guide/setup_dot_py.html
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['tiptri_detection'],
package_dir={'': 'src'}
)
setup(**d)
| sigproc/robotic_surgery | src/ros/tiptri_detection/setup.py | Python | mit | 319 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
import numpy as np
from nltk.tokenize import word_tokenize, sent_tokenize
from nltk.corpus import wordnet as wn
def get_synset(tuple_word_pos):
""" Returns the most common synset for the word/pos pair `tuple_word_pos`,
or `None` if the word is unknown to WordNet """
w... | ptoman/icgauge | icgauge/utils_similarity.py | Python | mit | 1,753 |
from pkg_resources import get_distribution
__version__ = get_distribution('s3-modify-headers').version
| Appstrakt/s3-modify-headers | src/s3_modify_headers/__init__.py | Python | mit | 104 |
# -*- coding: utf-8 -*-
from django.core.paginator import InvalidPage, Paginator
from django.http import Http404
from django.utils.http import urlencode
from .yt_paginator import YTPaginator, YTPage
def get_page_number(obj_number, per_page):
if obj_number < per_page:
return 1
elif obj_number % per_p... | nitely/Spirit | spirit/core/utils/paginator/__init__.py | Python | mit | 1,138 |
from pythonforandroid.recipe import PythonRecipe
class FlaskRecipe(PythonRecipe):
version = '2.0.3'
url = 'https://github.com/pallets/flask/archive/{version}.zip'
depends = ['setuptools']
python_depends = ['jinja2', 'werkzeug', 'markupsafe', 'itsdangerous', 'click']
call_hostpython_via_targetp... | kivy/python-for-android | pythonforandroid/recipes/flask/__init__.py | Python | mit | 393 |
from ppf.core import trade_utils
from ppf.model import model
from ppf.model.hull_white import *
class hull_white_lattice_model_factory(object):
def __call__(self, trd, env, model_args = None):
'''
>>> from ppf.date_time import date
>>> pd = date(2008, 05, 01)
>>> from ppf.market import environment
... | iamaris/ppf | ppf/model/model_factories.py | Python | mit | 4,210 |
"""
Consistent Overhead Byte Stuffing (COBS)
Unit Tests
This version is for Python 2.x.
"""
from array import array
import random
import unittest
import sys
sys.path.append('..')
from tinystack import cobs
def infinite_non_zero_generator():
while True:
for i in xrange(1,50):
for j in xrang... | uozuAho/tinystack | python/test/test_cobs.py | Python | mit | 6,273 |
import urllib2
import json
OS_API = '_______'
#url =''
#above is provided by website. a JSON url code. This is for reference now. Repeatable URL is below.
def OS_Search(query):
api_key = OS_API
url = 'thePiecesOfTheURLThatAlwaysAreTheSame' + api_key
senator = query
final_url = url + "senatorName"... | Durnlaw/Open-secrets | archive/OSAPI(Original).py | Python | mit | 781 |
from rest_framework.serializers import ModelSerializer
from django.contrib.auth.models import User
class UserSerializer(ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'password')
extra_kwargs = {'password': {'write_only': True}}
def create(self, validated_data)... | KirovVerst/photogram | users/serializers.py | Python | mit | 473 |
from typing import List
import math
import heapq
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
heap = [(list.val, index, list) for index, list in enumera... | shobhitmishra/CodingProblems | LeetCode/Session3/MergeKSortedListII.py | Python | mit | 1,021 |
from datetime import datetime
from django.http import HttpResponse
from django import forms
from django.contrib import auth
from django.contrib.auth import login, logout
from django.contrib.auth.models import User
from django.core import serializers
from django.db.models import Q
from django.shortcuts import render, re... | moiseslorap/RIT | Intro to Software Engineering/Release 1/HealthNet/HealthNetApp/views.py | Python | mit | 21,119 |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('basic/', views.basic, name='basic'),
]
| Pyroseza/Random | TornAPI/User/urls.py | Python | mit | 163 |
from functools import partial
from itertools import groupby
from operator import attrgetter
from django.forms.models import (
ModelChoiceIterator, ModelChoiceField, ModelMultipleChoiceField
)
class GroupedModelChoiceIterator(ModelChoiceIterator):
def __init__(self, field, groupby):
self.groupby = gro... | gamernetwork/gn-django | gn_django/form/grouped_model_choice_field.py | Python | mit | 1,541 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
from abc import abstractproperty
from django.conf import settings
from django.utils.six.moves.urllib import parse
import kolibri
from kolibri.plugins import hooks
logger = lo... | indirectlylit/kolibri | kolibri/core/theme_hook.py | Python | mit | 5,590 |
# coding: utf-8
from __future__ import print_function
import os
from os.path import join as pjoin
import shutil
from setuptools import setup, find_packages
from setuptools.command.install import install as _install
PROJECT_NAME = 'isaac'
setup(
name=PROJECT_NAME,
version='1.0',
packages=find_packages(),... | chaobin/isaac | setup.py | Python | mit | 420 |
# Python - 3.6.0
odd_func = lambda i, j: len(i) < len(j)
even_func = lambda i, j: len(i) > len(j)
def arrange(strng):
ts = strng.split(' ')
for i in range(len(ts) - 1):
comp_func = odd_func if i & 1 else even_func
if comp_func(ts[i], ts[i + 1]):
ts[i], ts[i + 1] = ts[i + 1], ts[i]
... | RevansChen/online-judge | Codewars/6kyu/up-and-down/Python/solution1.py | Python | mit | 431 |
from fastapi import FastAPI, Path
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str | None = None
price: float
tax: float | None = None
@app.put("/items/{item_id}")
async def update_item(
*,
item_id: int = Path(..., title="The ID of the item to... | tiangolo/fastapi | docs_src/body_multiple_params/tutorial001_py310.py | Python | mit | 551 |
from sqlalchemy import UniqueConstraint
from sqlalchemy.orm import relationship
from zeeguu_core.model.topic import Topic
from zeeguu_core.model.user import User
import sqlalchemy
import zeeguu_core
db = zeeguu_core.db
class TopicSubscription(db.Model):
"""
A topic subscription is created when
... | mircealungu/Zeeguu-Core | zeeguu_core/model/topic_subscription.py | Python | mit | 1,949 |
#!/usr/bin/python
#
# Filename: osx_chicken_loop_youtube_video.py
#
# Version: 1.0.0
#
# Author: Joe Gervais (TryCatchHCF)
#
# Summary:
#
# Part of the DumpsterFire Toolset. See documentation at https://github.com/TryCatchHCF/DumpsterFire
#
#
# Description:
#
# Opens a 10-hour chicken sounds loop on Youtube in the de... | TryCatchHCF/DumpsterFire | FireModules/Shenanigans/osx_chicken_loop_youtube_video.py | Python | mit | 1,759 |
# -*- coding: utf-8 -*-
"""
Python 2.7.x, 3.2+ compatability module.
"""
import sys
is_py2 = sys.version_info[0] == 2
def with_metaclass(meta, *bases):
"""Create a base class with a metaclass.
Taken from python's "six" package source code:
http://pythonhosted.org/six/#six.with_metaclass
"""
# Thi... | michalbachowski/pylock | pylock/_compat.py | Python | mit | 981 |
from __future__ import print_function, division
import six
import datetime
import os
from collections import Counter, OrderedDict
import warnings
import pandas as pd
np = pd.np
from pug.nlp.util import listify, make_datetime, ordinal_float, make_filename
from pug.nlp.util import quantize_datetime, datetime_from_ordi... | hobson/pug-invest | pug/invest/plot.py | Python | mit | 23,580 |
#!/usr/bin/env python
# I2C implementation of ADXL345 expect two parameters: alternate and port
# This sample tries to autodetect these parameters
import sys
import os
from adxl345.i2c import ADXL345
def main():
# Find all available I2C devices
i2c_devs = [int(d[-1]) for d in os.listdir("/dev/") if "i2c-" in d]
... | alexismeneses/py-adxl345 | sample/autodetect-sample.py | Python | mit | 842 |
from pythonds.graphs import PriorityQueue, Graph, Vertex
def prim(G,start):
pq = PriorityQueue()
for v in G:
v.setDistance(sys.maxsize)
v.setPred(None)
start.setDistance(0)
pq.buildHeap([(v.getDistance(),v) for v in G])
while not pq.isEmpty():
currentVert = pq.delMin()
... | robin1885/algorithms-exercises-using-python | source-code-from-author-book/Listings-for-Second-Edition/listing_7_12.py | Python | mit | 661 |
# obtain MODIS SCA as independent process from main script - convenient to run these jobs more flexibly
# takes path to config ini file as sole arg
import sys
import subprocess
from configobj import ConfigObj
config = ConfigObj(sys.argv[1])
wd = config["main"]["wd"]
# generate shapefile from sim domain to define MODI... | joelfiddes/topoMAPP | getMODISsca.py | Python | mit | 591 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from polymorphic.models import PolymorphicModel
from autoslug import AutoSlugField
from rest_framework.response import Response
from rest_framework import status
from cms.common import mixins, utils
f... | HurtowniaPixeli/pixelcms-server | cms/pages/models.py | Python | mit | 4,598 |
#!/usr/bin/python3
# # # # # ##### # #### # #####
# # # # # # # # # # # #
# # # #### ##### # # # # #
####### # # # # # # ### # #
# whatisit v0.1.0
# a hash/encoding/string-type looker-upper, currently with only a few algorithms
# and stuff to match with but hopefully mo... | JoeGlancy/whatisit | whatisit.py | Python | mit | 10,022 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from kolibri.core.webpack.hooks import FrontEndCoreAssetHook
from kolibri.core.webpack.hooks import FrontEndCoreHook
from kolibri.core.webpack.hooks import WebpackBundleHook
class FrontEndCoreAppAsset... | lyw07/kolibri | kolibri/core/kolibri_plugin.py | Python | mit | 670 |
#!/usr/bin/env python
# -*- coding: ascii -*-
from __future__ import division
"""Higher order singular value decomposition routines
as introduced in:
Lieven de Lathauwer, Bart de Moor, Joos Vandewalle,
'A multilinear singular value decomposition',
SIAM J. Matrix Anal. Appl. 21 (4), 2000, 1253-1278
impleme... | pengyuan/markov2tensor | utils/hosvd.py | Python | mit | 16,536 |
from neb.api import TrinityResource
class NodeStatistic(TrinityResource):
def calculate(self, node_id, statistic):
return self.get(self._statistic_path(node_id), stat=statistic)
@staticmethod
def _statistic_path(node_id):
return 'node/%s/stats' % node_id
def request(self, *args, **kwa... | peplin/neb | neb/statistic.py | Python | mit | 613 |
# 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_08_01/aio/operations/_network_management_client_operations.py | Python | mit | 7,052 |
import json
import os
import wandb
from wandb.cli import cli
from wandb.apis.internal import InternalApi
import pytest
from tests import utils
from .test_launch import mocked_fetchable_git_repo, mock_load_backend # noqa: F401
def test_launch(runner, test_settings, live_mock_server, mocked_fetchable_git_repo):
... | wandb/client | tests/tests_launch/test_launch_cli.py | Python | mit | 9,504 |
from __future__ import unicode_literals
from django.db import models
from .document import Document
from django.dispatch import receiver
from django.db.models.signals import post_save
from ..pdf2png import convert
class Page(models.Model):
image = models.ImageField(upload_to='documents/%Y/%m/%d')
document = mo... | muhakh/CSE371Project | models/page.py | Python | mit | 848 |
#! /usr/bin/env python
# Copyright 2020 John Hanley.
#
# 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, me... | jhanley634/testing-tools | problem/text/reviewing/example/regex1.py | Python | mit | 1,359 |
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__author__ = "d01"
__email__ = "jungflor@gmail.com"
__copyright__ = "Copyright (C) 2015-16, Florian JUNG"
__license__ = "MIT"
__version__ = "0.1.0... | the01/python-paps | paps/si/app/sensor.py | Python | mit | 12,470 |
#!/usr/bin/env python
import sys, json, random, datetime
def main():
date_created = datetime.datetime.utcnow().isoformat() + 'Z'
for line in sys.stdin:
example = line.strip().split('\t')
print json.dumps({
"date_created": date_created,
"random_key": float(example[0]),
... | yatmingyatming/LogisticRegressionSGDMapReduce | parse_svmlight_reducer.py | Python | mit | 494 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import linregress
from scipy.optimize import curve_fit
spannung1, strom1 = np.genfromtxt('Rohdaten/50ohm.txt',unpack=True)
strom1 = strom1 * 0.001
plt.plot(strom1, spannung1,'k.',label='$Klemmenspannung$')
#plt.legend(loc='best')
plt.grid()
#plt.xlim(... | mwindau/praktikum | v301/50ohm.py | Python | mit | 1,044 |
"""
Python2-specific versions of various functions used by stomp.py
"""
NULL = '\x00'
def input_prompt(prompt):
"""
Get user input
"""
return raw_input(prompt)
def decode(byte_data):
"""
Decode the byte data to a string - in the case of this Py2 version, we can't really do a... | GeneralizedLearningUtilities/SuperGLU | python_module/stomp/backward2.py | Python | mit | 926 |
from django.dispatch import Signal
user_matches_update = Signal(providing_args=['user'])
| Darkduke68/MatchMaker | matches/signals.py | Python | mit | 90 |
import base64
import logging
import pickle
try:
from django.utils.timezone import now as datetime_now
datetime_now # workaround for pyflakes
except ImportError:
from datetime import datetime
datetime_now = datetime.now
from django.core.mail import EmailMessage
from django.db import models
PRIORITIE... | duh386/django-mailer | mailer/models.py | Python | mit | 6,893 |