code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
"""Index interaction code
"""
| RalfBarkow/Zettelkasten | venv/lib/python3.9/site-packages/pip/_internal/index/__init__.py | Python | gpl-3.0 | 30 |
import os
FILEPATH = os.path.join(
os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'blns.txt')
"""Path to the file"""
def naughty_strings(filepath=FILEPATH):
"""Get the list of naughty_strings.
By default this will get the strings from the blns.txt file
Code is a simple port of what i... | eugenekolo/kololib | testing/big-bad-naughty-strings/naughtystrings/__init__.py | Python | mit | 982 |
# -*- 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... | diogocs1/comps | web/addons/base_report_designer/__openerp__.py | Python | apache-2.0 | 1,794 |
# Support for the iTunes format
# Copyright 2010-2015 Kurt McKee <contactme@kurtmckee.org>
# Copyright 2002-2008 Mark Pilgrim
# All rights reserved.
#
# This file is a part of feedparser.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following con... | mcus/SickRage | lib/feedparser/namespaces/itunes.py | Python | gpl-3.0 | 4,131 |
from __future__ import absolute_import
from django.db import models
from django.test import TestCase
from .models import Author, Book
signal_output = []
def pre_save_test(signal, sender, instance, **kwargs):
signal_output.append('pre_save signal, %s' % instance)
if kwargs.get('raw'):
signal_output.... | LethusTI/supportcenter | vendor/django/tests/regressiontests/signals_regress/tests.py | Python | gpl-3.0 | 3,724 |
'''This folder contains various example scripts demonstrating MAVLink functionality.'''
| AndreasAntener/mavlink | pymavlink/examples/__init__.py | Python | lgpl-3.0 | 88 |
#!/usr/bin/python -u
#
# imports the API description and fills up a database with
# name relevance to modules, functions or web pages
#
# Operation needed:
# =================
#
# install mysqld, the python wrappers for mysql and libxml2, start mysqld
# - mysql-server
# - mysql
# - php-mysql
# - MySQL-python
# Chan... | taget/libvirt | docs/index.py | Python | lgpl-2.1 | 37,181 |
default_app_config = '%s.apps.AppConfig' % __name__
| ic-labs/glamkit-sponsors | sponsors/__init__.py | Python | mit | 52 |
# $Id: 100_resample_lf_8_48.py 2052 2008-06-25 18:18:32Z nanang $
#
from inc_cfg import *
# simple test
test_param = TestParam(
"Resample (large filter) 8 KHZ to 48 KHZ",
[
InstanceParam("endpt", "--null-audio --quality 10 --clock-rate 48000 --play-file wavs/input.8.wav --rec-file wavs/tmp.48.wav")
]
)
| lxki/pjsip | tests/pjsua/scripts-media-playrec/100_resample_lf_8_48.py | Python | gpl-2.0 | 316 |
import errno
import logging
import sys
import warnings
from socket import error as SocketError, timeout as SocketTimeout
import socket
try: # Python 3
from queue import LifoQueue, Empty, Full
except ImportError:
from Queue import LifoQueue, Empty, Full
import Queue as _ # Platform-specific: Windows
fr... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py | Python | apache-2.0 | 31,251 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into depot_tools.
"""
def Ch... | Chilledheart/chromium | tools/valgrind/drmemory/PRESUBMIT.py | Python | bsd-3-clause | 1,175 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | 3dfxsoftware/cbss-addons | lunch/__openerp__.py | Python | gpl-2.0 | 2,636 |
import frappe
def execute():
frappe.reload_doctype('System Settings')
last = frappe.db.get_global('scheduler_last_event')
frappe.db.set_value('System Settings', 'System Settings', 'scheduler_last_event', last)
| gangadharkadam/saloon_frappe | frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py | Python | mit | 215 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | isvaldo/Ola_Bemobenses | tests/Selenium/environment/lib/python3.4/site-packages/selenium/webdriver/chrome/service.py | Python | cc0-1.0 | 4,488 |
#!/usr/bin/python
# 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 distributed... | alxgu/ansible | lib/ansible/modules/cloud/amazon/lambda_facts.py | Python | gpl-3.0 | 13,097 |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | JetChars/vim | vim/bundle/python-mode/pymode/libs/logilab/common/ureports/nodes.py | Python | apache-2.0 | 5,838 |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.lint
~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 0.5
This module provides a middleware that performs sanity checks of the WSGI
application. It checks that :pep:`333` is properly implemented and warns
on some common HTTP errors such as non-empty respons... | sauloal/PiCastPy | werkzeug/contrib/lint.py | Python | mit | 12,238 |
from __future__ import unicode_literals
import datetime
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.util import (lookup_field, display_for_field,
display_for_value, label_for_field)
from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_... | edisonlz/fruit | web_project/base/site-packages/django/contrib/admin/templatetags/admin_list.py | Python | apache-2.0 | 16,417 |
import unicodedata
import sys
from setuptools.extern import six
# HFS Plus uses decomposed UTF-8
def decompose(path):
if isinstance(path, six.text_type):
return unicodedata.normalize('NFD', path)
try:
path = path.decode('utf-8')
path = unicodedata.normalize('NFD', path)
path = ... | ohduran/CrowdFinanceInfographic | virtualenv/lib/python3.5/site-packages/setuptools/unicode_utils.py | Python | mit | 995 |
# Copyright (C) 2010 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 or agreed to in writ... | RKD314/yumstat | yumstat/apiclient/discovery.py | Python | mit | 35,847 |
"""
Tests for content rendering
"""
from unittest import TestCase
import ddt
from discussion_api.render import render_body
def _add_p_tags(raw_body):
"""Return raw_body surrounded by p tags"""
return "<p>{raw_body}</p>".format(raw_body=raw_body)
@ddt.ddt
class RenderBodyTest(TestCase):
"""Tests for re... | MakeHer/edx-platform | lms/djangoapps/discussion_api/tests/test_render.py | Python | agpl-3.0 | 3,254 |
# -----------------------------------------------------------------------------
# yacc_literal.py
#
# Grammar with bad literal characters
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex imp... | dpac-vlsi/SynchroTrace | util/ext/ply/test/yacc_literal.py | Python | bsd-3-clause | 1,566 |
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.comments.models import Comment
from django.utils.translation import ugettext_lazy as _, ungettext_lazy
from django.contrib.comments import get_model
from django.contrib.comments.v... | edisonlz/fruit | web_project/base/site-packages/django/contrib/comments/admin.py | Python | apache-2.0 | 3,736 |
#!/usr/bin/env python
#
# Copyright (c) 2015, Simon Howard
#
# Permission to use, copy, modify, and/or 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 TH... | fragglet/midisnd | midi.py | Python | isc | 4,962 |
# yaranullin/config.py
#
# Copyright (c) 2012 Marco Scopesi <marco.scopesi@gmail.com>
#
# 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... | ciappi/Yaranullin | yaranullin/config.py | Python | isc | 2,801 |
#! /usr/bin/env python
import sys, pgq.setadmin
if __name__ == '__main__':
script = pgq.setadmin.SetAdmin('set_admin', sys.argv[1:])
script.start()
| ssinger/skytools-cvs | python/setadm.py | Python | isc | 159 |
from .base import IntegrationBaseTestCase
from beancmd import bury
class BuryTestCase(IntegrationBaseTestCase):
def test_bury_all_runnable(self):
self.bs1.client.use('some-tube')
for i in range(100):
self.bs1.client.put_job(str(i))
assert self.bs1.status()['current-jobs-ready'... | EasyPost/beancmd | tests/integration/test_bury.py | Python | isc | 641 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | DemiMarie/SlipRock | .ycm_extra_conf.py | Python | isc | 6,434 |
from hypothesis import given
from hypothesis.strategies import text
from cv2stuff.hypothesis_code import encode, decode
@given(text())
def test_decode_inverts_encode(s):
assert decode(encode(s)) == s
| jskksj/cv2stuff | cv2stuff/tests/test_hypothesis_code.py | Python | isc | 206 |
"""A symbolic AI that forms decisions by using a decision tree."""
import random
from .interface import IPlayerController
from model.card import Card
class SymbolicAI_PC(IPlayerController):
"""player controller that returns resolutes its choices using a decision tree.
It is called symbolic because it is n... | DrSLDR/mgmag-proj | gravitas/controller/symbolic.py | Python | mit | 7,657 |
import os
import argparse
import re
import numpy as np
from model import *
np.random.seed(1337)
def get_engine(address = "postgresql+pg8000://script@localhost:5432/ccfd"):
# disk_engine = create_engine('sqlite:///'+data_dir+db_name,convert_unicode=True)
# disk_engine.raw_connection().connection.text_factory =... | bottydim/detect-credit-card-fraud | ccfd_dnn/model_eval.py | Python | mit | 6,921 |
#
# Copyright (c) 2014 Tom Carroll
#
# 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, publish, dis... | haxsaw/actuator | src/actuator/provisioners/example_resources.py | Python | mit | 2,612 |
"""Log MAVLink stream."""
import argparse
from pymavlink import mavutil
import pymavlink.dialects.v10.ceaufmg as mavlink
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--verbose", action='store_true',
help="print messages to STDOUT")
parse... | cea-ufmg/pyfdas | pyfdas/mavlog.py | Python | mit | 891 |
from tests.integration.star_wars import star_wars_test_urls, BLOCK_2_DEFAULT_ANSWERS
from tests.integration.star_wars.star_wars_tests import StarWarsTestCase
class TestEmptyRadioBoxes(StarWarsTestCase):
def test_radio_boxes_mandatory_empty(self):
self.login()
first_page = self.start_questionnai... | qateam123/eq | tests/integration/star_wars/test_radio_boxes.py | Python | mit | 1,487 |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:2979")
pwd = raw_input("Enter old wallet passphrase: ")
pwd2 = raw_input("Enter new wallet passphrase: ")
access.walletpassphrasechange(pwd, pwd2) | Arkhash/arkhash | contrib/wallettools/walletchangepass.py | Python | mit | 219 |
from mysqldef import *
from util import *
from lscastrodef import *
from lscabsphotdef import *
from lscsnoopy import *
from sqlcl import *
from sites import *
from externaldata import *
from myloopdef import *
from cosmics import *
from lscpsfdef import *
from banzaicat import *
__version__ = "unknown"
try:
from ... | svalenti/lcogtsnpipe | trunk/src/lsc/__init__.py | Python | mit | 478 |
# In production set the environment variable like this:
# DJANGO_SETTINGS_MODULE=my_proj.settings.production
from .base import * # NOQA
import logging.config
# For security and performance reasons, DEBUG is turned off
DEBUG = False
# Must mention ALLOWED_HOSTS in production!
ALLOWED_HOSTS = ['172.16.0.... | LeeYiFang/Carkinos | src/Carkinos/settings/production.py | Python | mit | 3,010 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import request, render_template, jsonify, Markup, abort, \
send_from_directory
from . import app, redis
from .utils import check_signature, get_jsapi_signature_data
from .response import wechat_response
from .plugins import score, library
from .models import... | paicha/gxgk-wechat-server | main/routes.py | Python | mit | 6,009 |
# Copyright (c) 2011 Nokia
#
# 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, publish, distribu... | skyostil/tracy | src/analyzer/Charting.py | Python | mit | 2,058 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', include('dashboard.urls', namespace='dashboard')),
u... | DigitalMockingbird/EULAThingy | eulathingy/urls.py | Python | mit | 637 |
"""
pdf2image is a light wrapper for the poppler-utils tools that can convert your
PDFs into Pillow images.
"""
import os
import platform
import re
import uuid
import tempfile
import shutil
from subprocess import Popen, PIPE
from PIL import Image
from .parsers import (
parse_buffer_to_ppm,
parse_buff... | Kankroc/pdf2image | pdf2image/pdf2image.py | Python | mit | 8,412 |
import urllib
from google.appengine.ext import ndb
class MobileClient(ndb.Model):
"""
This class repesents a mobile client that has registered with the server
We store a messaging ID (e.g. Google Cloud Messaging sender ID) as well
as a per-user unique key that is generated client side and sent up.
... | phil-lopreiato/frc-notebook-server | models/mobile_client.py | Python | mit | 1,097 |
import logging
from django import forms
from django.conf import settings
from django.forms import ModelForm
from app.models import ExtendedUser, UserFiles
logger = logging.getLogger(__name__)
class ExtendedUserForm(ModelForm):
first_name = forms.CharField(required=False, max_length=100)
last_name = forms.C... | ashwch/CrossTab | app/forms.py | Python | mit | 1,236 |
#This line asks the user to input an integer that will be recorded as my age
my_age = input("Enter your age:")
#This line asks the user to input an integer that will be recorded as days_in_a_year
days_in_a_year = input("How many days are in a year?")
#This line states how many hours are in a day
hours_in_a_day = 24
#Th... | chrisortman/CIS-121 | k0458928/assignment04.py | Python | mit | 914 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class People:
__name = 'furzoom'
__age = 22
gender = 'female'
__country = 'China'
def print_name(self):
print(self.__name)
def set_name(self, name):
print(id(self.__name))
self.__name = name
print(id(self.__name))
... | Furzoom/learnpython | pythonCore/ch13/class_test.py | Python | mit | 2,030 |
"""
File: DaqDevDiscovery01.py
Library Call Demonstrated: mcculw.ul.get_daq_device_inventory()
mcculw.ul.create_daq_device()
mcculw.ul.release_daq_device()
Purpose: Discovers DAQ devices and assigns board number to
... | mccdaq/mcculw | examples/ui/DaqDevDiscovery01.py | Python | mit | 5,694 |
from lxml import etree
from healthvaultlib.utils.xmlutils import XmlUtils
from healthvaultlib.itemtypes.healthrecorditem import HealthRecordItem
class AppspecificInformation(HealthRecordItem):
def __init__(self, thing_xml=None):
super(AppspecificInformation, self).__init__()
self.type_id = 'a503... | rajeevs1992/pyhealthvault | src/healthvaultlib/itemtypes/appspecificinformation.py | Python | mit | 961 |
# 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-containerinstance/azure/mgmt/containerinstance/models/operation_list_result.py | Python | mit | 955 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Doit task definitions."""
DOIT_CONFIG = {
'default_tasks': [
'flake8',
'docs',
],
'continue': True,
'verbosity': 1,
'num_process': 2,
'par_type': 'thread',
}
def task_flake8():
return {
'actions': ['flake8 m2r test... | miyakogi/m2r | dodo.py | Python | mit | 448 |
# -*- coding: utf-8 -*-
'''
Created on 2012-7-3
@author: lihao
'''
try: import httplib
except ImportError:
import http.client as httplib
import urllib
import time
import hashlib
import json
import top
import itertools
import mimetypes
'''
定义一些系统变量
'''
SYSTEM_GENERATE_VERSION = "taobao-sdk-python-20151214"
P_AP... | BillBillBillBill/WishTalk-server | WishTalk/top/api/base.py | Python | mit | 10,416 |
#
# Copyright (C) 2011 by Brian Weck
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
#
import pymongo, time
from . import log, config, reddit, queue
import utils
#
# match configured magic words by author or by mod
#
class Matcher:
matched_items = []
#
def __init__(se... | bweck/cssbot | cssbot/process.py | Python | mit | 4,907 |
# -*- coding: utf-8 -*-
"""
InformationMachineAPILib.Models.UserData
"""
from InformationMachineAPILib.APIHelper import APIHelper
class UserData(object):
"""Implementation of the 'UserData' model.
TODO: type model description here.
Attributes:
email (string): TODO: type description her... | information-machine/information-machine-api-python | InformationMachineAPILib/Models/UserData.py | Python | mit | 2,966 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... | neocogent/electrum | electrum/gui/qt/transaction_dialog.py | Python | mit | 15,958 |
from django.shortcuts import render
from user.decorators import user_view
from repository.decorators import repository_view
@user_view
@repository_view
def repository(request, user, repository, **kwargs):
return render(request, 'app.html')
| gitmill/gitmill | django/repository/views.py | Python | mit | 245 |
from decimal import Decimal
from braintree.util.http import Http
import braintree
import warnings
from braintree.add_on import AddOn
from braintree.descriptor import Descriptor
from braintree.discount import Discount
from braintree.exceptions.not_found_error import NotFoundError
from braintree.resource_collection impor... | eldarion/braintree_python | braintree/subscription.py | Python | mit | 8,098 |
import unittest
import MonitorManager
import RamByteMonitor
import Constants
import logging
import Utils
#TODO figure out proper logging practice.
logging.basicConfig(level=logging.INFO)
class TestMonitorManager(unittest.TestCase):
def setUp(self):
self.manager = MonitorManager.MonitorManager()
... | tadgh/Shizuka | src/test_client/test_MonitorManager.py | Python | mit | 2,845 |
#!/usr/bin/env python
import sys
from setuptools import setup
if sys.hexversion < 0x030200a1:
print ("LightSweeper requires python 3.2 or higher.")
print("Exiting...")
sys.exit(1)
setup(name='LightSweeper',
version='0.6b',
description='The LightSweeper API',
author='The LightSweeper Team',
... | lightsweeper/lightsweeper-api | setup.py | Python | mit | 528 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-11 14:30
from __future__ import unicode_literals
from django.db import migrations
import isi_mip.choiceorotherfield.models
class Migration(migrations.Migration):
dependencies = [
('climatemodels', '0011_auto_20160407_1050'),
]
opera... | bruecksen/isimip | isi_mip/climatemodels/migrations/0012_auto_20160411_1630.py | Python | mit | 775 |
import logging
import socket
from . import arcade
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
class Switch:
remote_ip = None
remote_port = 9999
state = None
commands = {'info': '{"system":{"get_sysinfo":{}}}',
'on': u'{"system... | droberin/blackhouse | blackhouse/__init__.py | Python | mit | 2,518 |
"""
Created on 25 Dec 2018
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
example:
{"device": "scs-bgx-401", "topic": "south-coast-science-demo/brighton/loc/1/climate",
"lastSeenTime": "2020-10-23T08:52:20Z", "last_write": "2020-10-23T08:52:20Z",
"message": "{\"val\": {\"hmd\": 68.4, \"tmp\": 19.8, \"bar\... | south-coast-science/scs_core | src/scs_core/aws/data/byline.py | Python | mit | 8,542 |
"""
Zoolander's color handling module.
"""
import operator
class HexMetaClass(type):
OPERATORS = ("add", "sub", "mul", "div")
def __new__(mcs, name, bases, attrs):
cls = type.__new__(mcs, name, bases, attrs)
def overload(op):
"""
Overload this operator with a function ... | fitzgen/zoolander | zoolander/colors.py | Python | mit | 1,572 |
"""empty message
Revision ID: 0047 add smtp
Revises: 0046 remove long description
Create Date: 2020-11-08 01:28:28.386704
"""
# revision identifiers, used by Alembic.
revision = '0047 add smtp'
down_revision = '0046 remove long description'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### c... | NewAcropolis/api | migrations/versions/0047.py | Python | mit | 1,247 |
"""
Default experiment for clean smp
Should be self-contained requiring now external packages or processes.
Robot: Point mass
World: open linear (1D) space
Task: null task: task performance is always null no matter what
Brain: null brain: just output null
Loss: 0
"""
import time
from smq.utils import make_column_... | x75/smq | experiments/conf/default.py | Python | mit | 2,364 |
import config
from git import Repository
import os
import yaml
from fnmatch import fnmatch
class Role:
@classmethod
def tree(cls, repository):
return RoleFactory(repository).tree()
@classmethod
def clear(cls, repository):
return RoleFactory(repository).clear()
def __init__(self, n... | iamdork/dork | dork/matcher.py | Python | mit | 7,851 |
# -*- coding: utf-8 -*-
import time
from multiprocessing.pool import Pool
import colored
import numpy as np
from dnutils import out, stop, trace, getlogger, ProgressBar, StatusMsg, bf, loggers, newlogger, logs, edict, ifnone, \
ifnot, allnone, allnot, first, sleep, __version__ as version, waitabout
import unitt... | danielnyga/dnutils | tests/testp3.py | Python | mit | 8,270 |
def kth_smallest(arr, k):
n = len(arr)
a = 0
b = n
while a < b:
piv = a
for i in range(a, b):
if arr[piv] > arr[i]:
arr[i], arr[piv] = arr[piv], arr[i]
piv = i
if piv == k:
return arr[piv]
elif piv < k:
a... | stevetjoa/algorithms | kth_smallest_loop.py | Python | mit | 470 |
# Copyright (c) 2009-2020 - Simon Conseil
# Copyright (c) 2013 - Christophe-Marie Duquesne
# Copyright (c) 2017 - Mate Lakat
# 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... | kontza/sigal | sigal/settings.py | Python | mit | 5,695 |
# -*- coding: utf-8 -*-
"""
Created on Thu May 29 12:28:08 2014
@author: david
"""
import numpy as np
import sys
import os
from osgeo import gdal
from osgeo import ogr
from osgeo import osr
from osgeo import gdal_array
from osgeo import gdalconst
from scipy.ndimage import filters
class Empty_Grid():
def __init... | dav-stott/phd-thesis | fw_gridding_idw.py | Python | mit | 12,343 |
import requests
from .route import Route
class UserRoute(Route):
def me(self):
"""
Return the currently authenticated user
:rtype: dict
"""
return self._get_json('user')
def user(self, id):
"""
Return the user with given id
:rtype: dict
... | caspervg/pylex | src/pylex/user.py | Python | mit | 1,830 |
"""
dotcloud.ui.colors - Pythonic wrapper around colorama
Usage:
colors = Colors()
# Format string inlining
print '{c.green}->{c.reset} Hello world!'.format(c=colors)
# Call
print colors.blue('Hello world!')
# Wrapper
with colors.red:
print 'Hello world'
"""
import sys
import c... | andresriancho/dotcloud-cli | dotcloud/ui/colors.py | Python | mit | 2,257 |
from durable.lang import *
import math
import datetime
import json
_fact_count = 0
def create_and_post(fact):
global _fact_count
fact['id'] = _fact_count
fact['sid'] = 1
post('waltzdb', fact)
_fact_count += 1
def create_and_assert(fact):
global _fact_count
fact['id'] = _fact_count
fact... | jruizgit/rules | testpy/waltzdb.py | Python | mit | 44,448 |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 18 17:13:52 2012
@author: moriarty
"""
## Desired Distance
DIST = 25
TIME_LIMIT = 20
TURN_TIME = 2
START_POWER = 70
_KP = 0.25 #0.5
_KI = 0.001 #1
_KD = 1.0
import math as mth
from nxt.locator import *
from nxt.motor import *
from nxt.sensor import ... | moriarty/csci-homework | 4155/labs/nxt/wallfollower.py | Python | mit | 2,898 |
# Python - 3.6.0
test.assert_equals(evil(1), "It's Odious!")
test.assert_equals(evil(2), "It's Odious!")
test.assert_equals(evil(3), "It's Evil!")
| RevansChen/online-judge | Codewars/8kyu/evil-or-odious/Python/test.py | Python | mit | 148 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import sys
from shutil import copyfile
class DashboardFactory(object):
def __init__(self, name, app_root=None, quiet=False):
self.name = name
self.quiet = quiet
if app_root is None:
app_root = os.path.ab... | martinp/jarvis2 | jarvis/util/create_dashboard.py | Python | mit | 3,472 |
#!/usr/bin/env python
import numpy as np
# Create features for tagging a sequence.
def create_features(f, g, history):
tempf = []
tempa = []
tempm = []
for line in f:
if line != '\n':
idstr = line.split()[3]
if line == '\n':
templen = np.size(tempf,0)
... | tapomayukh/projects_in_python | classification/Classification_with_CRF/old_crfsuite_package/old code/feature_conversion.py | Python | mit | 5,099 |
# 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-datafactory/azure/mgmt/datafactory/models/operation_metric_availability.py | Python | mit | 1,181 |
# -*- coding: utf-8 -*-
import os
from codecs import encode, decode
import re
LINUX_ROOT = u"/"
def trim_quote(text):
if len(text) > 2 and text[0] == '"' and text[-1] == '"':
text = text[1:-1]
return text
def to_unicode(text, encoding="utf8"):
if type(text) == unicode:
return text
... | Gateswong/GatesMusicPet | music_pet/utils.py | Python | mit | 4,849 |
"""
sinewave
========
Generates a sinusoidal wave of programmable period. 32 points are generated per cycle.
Arguments::
{
"period" : the period of the cycle e.g. "PT10M"
(the above can be an array, in which case multiple sinewaves are generated and added. This can be useful for Fourier synthesis,... | DevicePilot/synth | synth/timefunctions/sinewave.py | Python | mit | 5,812 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Message',
fields=[
('id', models.AutoField(seri... | neoslaw/django | contact/migrations/0001_initial.py | Python | mit | 594 |
# -*- coding: UTF-8 -*-
from django.core.management.base import BaseCommand
from django_datawatch.datawatch import Scheduler
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'--force',
action='store_true',
dest='force',
defa... | RegioHelden/django-datawatch | django_datawatch/management/commands/datawatch_run_checks.py | Python | mit | 701 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TodoList'
db.create_table(u'todos_todolist', (
(u'id', self.gf('django.db.models... | endthestart/safarido | safarido/todos/migrations/0001_initial.py | Python | mit | 3,046 |
from __future__ import unicode_literals
from django.test import TestCase
from accelerator.tests.factories import ProgramPartnerTypeFactory
class TestProgramPartnerType(TestCase):
def test_str(self):
program_partner_type = ProgramPartnerTypeFactory()
assert program_partner_type.partner_type in s... | masschallenge/django-accelerator | accelerator/tests/test_program_partner_type.py | Python | mit | 423 |
import collections
import numpy as np
import sympy
from sym2num import function, var
def reload_all():
"""Reload modules for testing."""
import imp
for m in (var, function):
imp.reload(m)
if __name__ == '__main__':
reload_all()
g = var.UnivariateCallable('g')
h = var.Univariat... | dimasad/sym2num | examples/function_example.py | Python | mit | 896 |
import json, logging
class Farm:
"""
Main class holding the whole farm.
"""
def __init__(self,json_file):
"""
"""
# load in json file
data = json.loads(open(json_file,'r').read())
# Make sure required data is in the json file
required_attr_list = ["lat... | harmsm/thefarm | thefarm/farm.py | Python | mit | 853 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.trial import unittest
from twisted.python.runtime import platform
from twisted.python.win32 import cmdLineQuote
class CommandLineQuotingTests(unittest.TestCase):
"""
Tests for L{cmdLineQuote}.
"""
def test_argWithou... | Varriount/Colliberation | libs/twisted/python/test/test_win32.py | Python | mit | 1,001 |
import unittest
from botlang import BotlangSystem
from botlang.extensions.storage import StorageApi
class DummyStore(StorageApi):
def __init__(self):
self.backend = {}
def put(self, key, value, expiration=None):
self.backend[key] = value
def get(self, key):
return self.backend.... | PostCenter/botlang | tests/storage/test_storage_extensions.py | Python | mit | 3,005 |
import base64
import json
import responses
from mapbox.services.datasets import Datasets
username = 'testuser'
access_token = 'pk.{0}.test'.format(
base64.b64encode(b'{"u":"testuser"}').decode('utf-8'))
def test_class_attrs():
"""Get expected class attr values"""
serv = Datasets()
assert serv.api_... | mapbox/mapbox-sdk-py | tests/test_datasets.py | Python | mit | 8,145 |
from pahera.models import Person
from django.db import connection, transaction
from pahera.Utilities import DictFetchAll
# To check whether there exists a user with same email or phone no before registering the new user..!!!
def VerifyTheUser(data):
cursor = connection.cursor()
email = data['email']
phone ... | thebachchaoproject/bachchao-server | pahera/PythonModules/CheckIfUserExists_mod.py | Python | mit | 1,431 |
#!usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author magic
"""
import urllib2
def download(url, user_agent='wswp', num_retries=2):
print 'Downloading:', url
headers = {'User-Agent': user_agent}
request = urllib2.Request(url, headers=headers)
try:
html = urllib2.urlopen(request).read()
... | csunny/blog_project | source/libs/spider/common.py | Python | mit | 694 |
from application import app
from flask.ext.pymongo import PyMongo
mongo = PyMongo(app, "MONGO")
| megrela/flask-cms-control-panel | application/mongo_db/__init__.py | Python | mit | 98 |
##Write Python statements to prompt for and collect values
##for the time in hours and minutes (two integer quantities).
def time():
hours = input('What are the hours ')
minutes = input('What are the minutes ')
if (int(hours) >= 1 and int(hours) <= 12 and int(minutes) >= 0 and int(minutes) <= 59):
... | biggapoww/Python-CIS-5 | simple pypy/compute_time_8.py | Python | mit | 375 |
"""
.. module:: lcpsd
:synopsis: Generate signals from PSD models.
.. moduleauthor:: Riccardo Campana <campana@iasfbo.inaf.it>
"""
import numpy as np
import astropy.modeling.models
from .psd_models import *
def lcpsd(dt=1., nbins=65536, mean=0., rms=1., seed=None, models=None, phase_shift=None, time_shift=None, v... | pabell/pylcsim | lcpsd.py | Python | mit | 5,329 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-09-21 15:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0001_initial'),
]
operations = [
migrations.AlterField(
... | wenxiaomao1023/wenxiaomao | article/migrations/0002_auto_20160921_1518.py | Python | mit | 587 |
from . import TheInternetTestCase
from helium.api import ComboBox, select
class DropdownTest(TheInternetTestCase):
def get_page(self):
return "http://the-internet.herokuapp.com/dropdown"
def test_dropdown_exists(self):
self.assertTrue(ComboBox("Dropdown List").exists())
def test_select_value(self):
self.asser... | bugfree-software/the-internet-solution-python | tests/test_dropdown.py | Python | mit | 614 |
# Python 3.8.3
import re
class Rule:
PATTERN = re.compile(r"(\d+): (\d+|\"[ab]\")( \d+)?(?: \| (\d+)( \d+)?)?")
RULES = {}
def __init__(self, string):
match = self.PATTERN.match(string)
self.id = int(match.group(1))
self.RULES[self.id] = self
if match.group(2).isnumeric... | foxscotch/advent-of-code | 2020/19/p1.py | Python | mit | 2,106 |
# -*- coding: utf-8 -*-
import json
import os
from tornado import web
from notebook.base.handlers import APIHandler
from .handlers import notebook_dir
def _trim_notebook_dir(dir):
if not dir.startswith("/"):
return os.path.join(
"<notebook_dir>", os.path.relpath(dir, notebook_... | lspvic/jupyter_tensorboard | jupyter_tensorboard/api_handlers.py | Python | mit | 2,197 |
"""
Author: Eric J. Ma
License: MIT
A Python module that provides helper functions and variables for encoding amino
acid features in the protein interaction network. We encode features in order
to feed the data into the neural fingerprinting software later on.
"""
amino_acids = [
"A",
"B",
"C",
"D",
... | ericmjl/protein-interaction-network | proteingraph/features.py | Python | mit | 501 |
# 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 ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/structured_value.py | Python | mit | 3,167 |
#http://stackoverflow.com/questions/882712/sending-html-email-using-python
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
class MailAgent(object):
"""docstring for MailAgent"""
def __init__(self, mail, smtp, pseudo, passw):
super(MailAgent, self).__init__()
s... | capuccinatore/krobot | krobot/mail.py | Python | mit | 1,324 |
import _plotly_utils.basevalidators
class ShowlegendValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(self, plotly_name="showlegend", parent_name="cone", **kwargs):
super(ShowlegendValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/cone/_showlegend.py | Python | mit | 404 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.