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 |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (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
#... | bjolivot/ansible | lib/ansible/modules/cloud/ovirt/ovirt_hosts_facts.py | Python | gpl-3.0 | 3,456 |
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2004, 2006 Sean C. Gillies
# Copyright (c) 2005 Nuxeo SARL <http://nuxeo.com>
#
# Authors : Sean Gillies <sgillies@frii.com>
# Julien Anguenot <ja@nuxeo.com>
#
# Contact email: sgillie... | herow/planning_qgis | python/ext-libs/owslib/wms.py | Python | gpl-2.0 | 23,814 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 t... | biswajitsahu/kuma | vendor/packages/translate/lang/mr.py | Python | mpl-2.0 | 1,018 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | nburn42/tensorflow | tensorflow/contrib/opt/python/training/nadam_optimizer.py | Python | apache-2.0 | 4,164 |
"""
Generic character device support for serial, parallel, channel, and console
http://libvirt.org/formatdomain.html#elementCharSerial
"""
from virttest.libvirt_xml.devices import base
class CharacterBase(base.TypedDeviceBase):
__slots__ = ('sources', 'targets')
# Not overriding __init__ because ABC canno... | CongSmile/virt-test | virttest/libvirt_xml/devices/character.py | Python | gpl-2.0 | 2,306 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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, either version 3 of th... | InakiZabala/odoomrp-wip | stock_move_purchase_price/__init__.py | Python | agpl-3.0 | 894 |
"""
Meta Data Extension for Python-Markdown
=======================================
This extension adds Meta Data handling to markdown.
Basic Usage:
>>> import markdown
>>> text = '''Title: A Test Doc.
... Author: Waylan Limberg
... John Doe
... Blank_Data:
...
... The body. This ... | frankiecjunle/yunblog | venv/lib/python2.7/site-packages/markdown/extensions/meta.py | Python | mit | 2,757 |
# -*- encoding: 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 t... | ncliam/serverpos | openerp/addons/account_asset/report/account_asset_report.py | Python | agpl-3.0 | 4,260 |
#
# 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... | cconrad/evernotebackup | thrift/transport/TTransport.py | Python | bsd-2-clause | 8,204 |
# -*- coding: utf-8 -*-
import mass_mailing
import mass_mailing_stats
import mail_mail
import mail_thread
import res_config
| ovnicraft/openerp-restaurant | mass_mailing/models/__init__.py | Python | agpl-3.0 | 125 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import datetime
import json
import logging
import sys
from lib.pageframe import PFNCounts
from lib.policy import PolicySet
from lib.subcommand import SubCom... | GladeRom/android_external_chromium_org | tools/deep_memory_profiler/subcommands/policies.py | Python | bsd-3-clause | 14,719 |
"""Test safe_exec.py"""
import hashlib
import os
import os.path
import random
import textwrap
import unittest
from nose.plugins.skip import SkipTest
from capa.safe_exec import safe_exec, update_hash
from codejail.safe_exec import SafeExecException
from codejail.jail_code import is_configured
class TestSafeExec(uni... | abhinavp13/IITBX-edx-platform-dev | common/lib/capa/capa/safe_exec/tests/test_safe_exec.py | Python | agpl-3.0 | 9,805 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | FNST-OpenStack/horizon | openstack_dashboard/dashboards/project/volumes/backups/tabs.py | Python | apache-2.0 | 1,613 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 Ansible Project
# 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
import pytest
from ansible.module_utils._text import to_native
from ansible.m... | aperigault/ansible | test/units/module_utils/common/validation/test_check_type_str.py | Python | gpl-3.0 | 994 |
# Helper module for a test_reflect test
1/0
| mzdaniel/oh-mainline | vendor/packages/twisted/twisted/test/reflect_helper_ZDE.py | Python | agpl-3.0 | 46 |
# (c) 2016, Ansible, 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 di... | alxgu/ansible | lib/ansible/plugins/test/mathstuff.py | Python | gpl-3.0 | 1,561 |
# Util.py - Python extension for perf trace, miscellaneous utility code
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
NSECS_PER_SEC = 1000000000
de... | droidzone/Supernova-Kernel | tools/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | Python | gpl-2.0 | 686 |
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
from selenium.common import exceptions
class NaturalNonVisibleElementsTest(base_test.WebDriverBaseTest):
def test_0x0_pixel_element_is_not_visible(self):
self.driver.get(self.webserv... | youtube/cobalt | third_party/web_platform_tests/webdriver/element_state/visibility_test.py | Python | bsd-3-clause | 15,305 |
# -*- coding: utf-8 -*-
import openerp
from openerp import http
from openerp.http import request
import openerp.addons.website_sale.controllers.main
class website_sale(openerp.addons.website_sale.controllers.main.website_sale):
@http.route(['/shop/payment'], type='http', auth="public", website=True)
def paym... | mycodeday/crm-platform | website_sale_delivery/controllers/main.py | Python | gpl-3.0 | 1,205 |
class WiggleParser(object):
"""
Warning - this does not implement the full specification!
"""
def entries(self, input_fh):
track_name = None
replicon = None
span = None
pos_value_pairs = []
for line in input_fh:
row = line[:-1].split()
i... | tbischler/PEAKachu | peakachulib/wiggle.py | Python | isc | 2,906 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import tempfile
import shutil
import os
from contextlib import contextmanager
from importlib import import_module
from psycopg2.extras import register_composite, CompositeCaster
try:
from StringIO import StringIO
except ImportError:
from io impo... | klichukb/django-migrate-sql | tests/test_app/test_migrations.py | Python | isc | 21,936 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PyOffers documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 31 19:11:54 2016.
#
# 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
# a... | Stranger6667/pyoffers | docs/conf.py | Python | mit | 9,995 |
from .base import Entity,SystemBase
from .component import ComponentBase,MultiComponentBase
from .managers import EntityManager,SystemManager
| Kromey/roglick | roglick/engine/ecs/__init__.py | Python | mit | 143 |
# List aa images with query stringa available
def list_all_images_subparser(subparser):
list_all_images = subparser.add_parser(
'list-all-images',
description=('***List all'
... | dman777/image_share | subparsers/list_all_images.py | Python | mit | 2,198 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from collections import MutableMapping
class BaseClass(MutableMapping): # pragma: no cover
def __init__(self, *args, **kwargs):
self.__dict__.update(*args, **kwargs)
def __setitem__(self, key, value):
sel... | mikejarrett/tvdb-api | tvdb/models/common.py | Python | mit | 652 |
import os
import re
import shutil
import sys
import tempfile
from typing import Any
from typing import cast
from typing import List
from typing import Tuple
import sqlalchemy
from sqlalchemy import testing
from sqlalchemy.testing import config
from sqlalchemy.testing import eq_
from sqlalchemy.testing import fixtures
... | sqlalchemy/sqlalchemy | test/ext/mypy/test_mypy_plugin_py3k.py | Python | mit | 10,474 |
# coding=utf-8
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404, Http404, redirect
from django.views.decorators.csrf import csrf_exempt
def default(request):
return render_to_response('configurator.html', {}, context... | antofik/Wartech | WartechWeb/configurator/views.py | Python | mit | 354 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
# 题目地址:
https://www.codewars.com/kata/56747fd5cb988479af000028/train/python
'''
import time
import unittest
class TestCases(unittest.TestCase):
def test1(self):self.assertEqual(get_middle("test"),"es")
def test2(self):self.assertEqual(get_middle("testing"... | karchi/codewars_kata | 已完成/Get the Middle Character.py | Python | mit | 1,079 |
#!/usr/bin/env python
# $Id: mergedInputExample.py 545 2012-01-18 06:10:03Z cvermilion $
#----------------------------------------------------------------------
# Copyright (c) 2010-12, Pierre-Antoine Delsart, Kurtis Geerlings, Joey Huston,
# Brian Martin, and Christopher Vermilion
#
#------------------... | mickypaganini/SSI2016-jet-clustering | spartyjet-4.0.2_mac/examples_py/mergedInputExample.py | Python | mit | 2,382 |
# 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_09_01/models/security_rule_py3.py | Python | mit | 7,664 |
# Copyright (C) 2004-2019 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
#
# Authors: Aric Hagberg (hagberg@lanl.gov)
# Pieter Swart (swart@lanl.gov)
# Sasha Gutfraind (ag362@cornell.edu)
"... | sserrot/champion_relationships | venv/Lib/site-packages/networkx/algorithms/centrality/degree_alg.py | Python | mit | 3,604 |
import datetime
import logging
import os
import re
import types
from copy import copy
from django.conf import settings
from django.template.defaultfilters import linebreaks as django_linebreaks,\
escapejs as django_escapejs, pluralize as django_pluralize,\
date as django_date
from django.utils.encoding import ... | OpenNews/opennews-source | source/base/helpers.py | Python | mit | 4,414 |
# coding: utf-8
from __future__ import absolute_import
import application
app = application.create_app()
| PostmonAPI/correios.postmon.com.br | main.py | Python | mit | 107 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-02 12:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("Artifactorial", "0002_use_biginteger_for_quota")]
operations = [
migrations.AlterField(
model_name="directory",
... | ivoire/Artifactorial | Artifactorial/migrations/0003_make_directory_path_unique.py | Python | mit | 422 |
def difftest():
a = {1, 2, 3, 4, 5}
b = {5, 6, 7, 8, 9, 10}
print(a)
print(b)
c = a.difference(b)
print(c)
if __name__ == '__main__':
# unionは非破壊的メソッドなので、別のオブジェクトに代入しないと消えます。
difftest()
| ekazyam/study | パーフェクトPython/pp_088_difference差集合.py | Python | mit | 285 |
__author__ = 'casper'
| caspervg/geontology | tests/__init__.py | Python | mit | 22 |
'''
Created on May 16, 2013
@author: aryaveer
'''
from django.forms.util import ErrorList
from django import forms
from courses.models import Role
class DivErrorList(ErrorList):
def __unicode__(self):
return self.as_divs()
def as_divs(self):
if not self: return u''
return u'<div class... | kartikshah1/Test | courses/forms.py | Python | mit | 2,090 |
#pragma repy
if callfunc == "initialize":
# first, create the file, we'll read...
fobj = open("junk_test.out","w")
fobj.close()
# Now the actual test...
try:
fobj = open("junk_test.out", 'r')
fobj.flush()
# flush on a read-only file should be a no-op
finally:
fobj.close()
| sburnett/seattle | repy/tests/ut_repytests_testfileflushnooponreadonly.py | Python | mit | 303 |
import asyncio
import logging
import random
from typing import Optional
import sortedcontainers
from gear import Database
from hailtop import aiotools
from hailtop.utils import (
AsyncWorkerPool,
Notice,
WaitableSharedPool,
periodically_call,
retry_long_running,
run_if_changed,
secret_alnu... | hail-is/hail | batch/batch/driver/instance_collection/pool.py | Python | mit | 19,341 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-04 22:35
from __future__ import unicode_literals
from django.db import migrations
from coordinators.auth_migration_utils import get_coordinators_group, get_permissions
def add_campaignlocationshiftparticipation_rights(apps, schema_editor):
coordina... | mrts/foodbank-campaign | src/coordinators/migrations/0003_auto_20161205_0035.py | Python | mit | 890 |
"""
Tools for modeling unit generators (UGens).
"""
from .basic import Mix, MulAdd, Sum3, Sum4
from .beq import (
BAllPass,
BBandPass,
BBandStop,
BHiCut,
BHiPass,
BHiShelf,
BLowCut,
BLowPass,
BLowShelf,
BPeakEQ,
)
from .bufio import BufRd, BufWr, ClearBuf, LocalBuf, MaxLocalBufs,... | josiah-wolf-oberholtzer/supriya | supriya/ugens/__init__.py | Python | mit | 10,418 |
Midan_Metal_Musketoon0 = [[148, 0, 110, 0, 123, 162, 73, 2.64], u'Midan Metal Musketoon+CRIT12+CRIT12', 1, 14581]
Midan_Metal_Musketoon1 = [[148, 12, 98, 0, 123, 162, 73, 2.64], u'Midan Metal Musketoon+CRIT12+ACC12', 1, 14581]
Midan_Metal_Musketoon2 = [[148, 24, 86, 0, 123, 162, 73, 2.64], u'Midan Metal Musketoon+ACC12... | jrlusby/xiv-bard-calc | inventories/staffbis.py | Python | mit | 6,323 |
import os
from flask import current_app
from .remote import remote
def exec_remote_wmt(host, uuid, which_wmt_exe='wmt-exe', username=None,
password=None, extra_args=None):
extra_args = extra_args or []
which_wmt_slave = os.path.join(os.path.dirname(which_wmt_exe), 'wmt-slave')
cmd ... | mcflugen/wmt-rest | wmt/flask/tasks.py | Python | mit | 620 |
import unittest
class TestExtractUtil(unittest.TestCase):
def test_xyz(self):
self.assertEqual(True, True)
| scruwys/and-the-award-goes-to | tests/test_extract_util.py | Python | mit | 121 |
# coding=utf-8
"""
stream.varint
~~~~~~~~~~~~~
Encode and decode an integer up to 64 bit to/from 'Varint'. See Google
Protobuf library documentation for more details about Varints.
:copyright: (c) 2017 by Ali Ghaffaari.
:license: MIT, see LICENSE for more details.
"""
import sys
import clic... | cartoonist/pystream-protobuf | stream/varint.py | Python | mit | 1,366 |
"""wolfpass.py is a project example using resources from Wolf Pass"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from numpy import load as npload
from .base import BaseExample, exampleproperty
from ..data import... | 3ptscience/steno3dpy | steno3d/examples/wolfpass.py | Python | mit | 16,441 |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import palettable
import richardsplot as rplot
x = np.random.random(size=1000)*6000+3000
y = np.random.normal(loc=0,scale=0.25,size=1000)*1.0e-17
ind = np.argsort(x)
xplot = x[ind]
yplot = y[ind]/1.0e-17
plt.figure(figsize=(8,8))
plt.xlim(30... | gtrichards/richardsplot | testplot1.py | Python | mit | 579 |
# -*- coding: utf-8 -*-
import dis
def disassemble(co, lasti=-1):
"""
Disassemble a code object.
:param co: code object
:type: code
:param lasti: last instruction executed (optional)
:type lasti: int
:returns: disassembled code
:rtype: dict
"""
result = []
code = co.c... | linkdd/errcorrect | errcorrect/disassembler.py | Python | mit | 2,234 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2021 TU Wien.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REST API module for Invenio."""
from __future_... | inveniosoftware/invenio-rest | invenio_rest/views.py | Python | mit | 13,273 |
#! -*- coding: utf-8 -*-
import os
import re
__all__ = ['splitext', 'joinext', 'list_dir']
def splitext(path):
"""Get the extension from a path"""
root, ext = os.path.splitext(path)
return (root, ext) if not ext else (root, ext[1:])
def joinext(name, ext, sep='.'):
"""
>>> joinext('a', 'txt'... | yang3yen/pykit | pylib/path.py | Python | mit | 1,587 |
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
l = len(s)
r = 0
i = j = 0
m = [None] * 256
while j < l:
c = ord(s[j])
if m[c] is not None:
r = max(j - i,... | foomango/leetcode | src/python/3_longest_substring_without_repeating_characters/solution.py | Python | mit | 507 |
# Copyright (c) 2014 - 2016 townhallpinball.org
#
# 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, p... | town-hall-pinball/project-omega | pin/service/pulse_test.py | Python | mit | 3,939 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import absolute_import, unicode_literals
import cPickle
import uuid
from datetime import ... | mic4ael/indico | indico/web/flask/session.py | Python | mit | 7,625 |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Mark Maday
# Copyright (c) 2015 Mark Maday
#
# License: MIT
#
"""This module exports the Htmlhint plugin class."""
import logging
import sublime
from SublimeLinter.lint import LintMatch, NodeLinter
logger = loggi... | mmaday/SublimeLinter-contrib-htmlhint | linter.py | Python | mit | 1,850 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/tav/v20190118/models.py | Python | mit | 8,548 |
import os
from pyven.utils.utils import str_to_file, file_to_str
class Style(object):
DIR = os.path.join(os.environ.get('PVN_HOME'), 'report', 'css')
COUNT = 0
SINGLETON = None
def __init__(self, name='default'):
Style.COUNT += 1
self.name = name
self.line = {'div_style' : ... | mgaborit/pyven | source/pyven/reporting/style.py | Python | mit | 5,043 |
# -*- coding: iso-8859-1 -*-
try:
import Xlib.display
import Xlib.X
import Xlib.XK
import Xlib.error
import Xlib.ext.xtest
haveXlib = True
except ImportError:
haveXlib = False
try:
# TODO - refactor this shit to prevent namespace pollution
from ctypes import *
import win32co... | Buggaboo/Triathlon | TriathlonBeta/OutputManager.py | Python | mit | 18,021 |
#!/usr/bin/env python 3
from accessoryFunctions.accessoryFunctions import MetadataObject
from geneseekr.geneseekr import GeneSeekr
from geneseekr.blast import BLAST
import multiprocessing
from glob import glob
from time import time
import pytest
import os
test_path = os.path.abspath(os.path.dirname(__file__))
__autho... | OLC-Bioinformatics/pythonGeneSeekr | tests/test_blastx.py | Python | mit | 8,082 |
from easythreads import AsyncWorker
def task_a():
print 123
def task_b(n):
for i in range(n):
print 999
pool = AsyncWorker(10)
for _ in range(100) :
pool.append(task_a)
for n in range(100):
pool.append(lambda : task_b(n))
pool.shutdown()
| rfyiamcool/easythreads | test.py | Python | mit | 280 |
from django.db import models
from django.contrib.auth.models import User
class Project(models.Model):
def __str__(self):
return self.name
name = models.CharField(max_length=200, blank=False, null=False)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField... | TangentMicroServices/BuildService | api/models.py | Python | mit | 3,443 |
"""Returns Component from YAML syntax.
name: myComponent
vars:
length: 3
info:
description: just a demo
polarization: TE
...
instances:
mzi:
component: mzi_phase_shifter
settings:
delta_length: ${vars.length}
length_x: 50
pads:
component: pad_a... | gdsfactory/gdsfactory | gdsfactory/read/from_yaml.py | Python | mit | 28,215 |
# Encoding: UTF-8
''' FinancialSession implementation for Swedish Lansforsakringar Bank.
Uses LFABs REST API, based on Björn Sållarps work, with updated client key.
Copyleft 2012 Jacob Hansson <jakewins@gmail.com>
Released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining... | jakewins/bank-api | bank/impl/lfab.py | Python | mit | 5,331 |
name = "Killstreak Announcer"
author = "codesuela"
import base
class Bf3Mod(base.Bf3Mod):
def onLoad(self):
self.playerStreaks = {}
def playerOnKill(self, killer, killed, weapon, headshot):
killer = str(killer).strip()
killed = str(killed).strip()
if killer and killed: # disr... | smowden/b3ef-Battlefield-3-RCON-autoadmin-framework | mods/killstreakannouncer.py | Python | mit | 1,612 |
import subprocess
import os
import jsonasobj
import pandas as pd
import requests
from SPARQLWrapper import SPARQLWrapper, JSON
from ShExJSG import ShExC
from pyshex import PrefixLibrary, ShExEvaluator
from sparql_slurper import SlurpyGraph
from wikidataintegrator import wdi_core, wdi_helpers
from datetime import dateti... | SuLab/scheduled-bots | scheduled_bots/reactome/checkShEx.py | Python | mit | 2,396 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="heatmap.colorbar.title.font", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/python-api | packages/python/plotly/plotly/validators/heatmap/colorbar/title/font/_color.py | Python | mit | 474 |
#!/usr/bin/env python
from pymongo import MongoClient
from time import time
from ..doc import Doc
from ..util import parmapper
from progressbar import ProgressBar, Bar, Counter, ETA, FileTransferSpeed, Percentage, Timer
from nel import logging
log = logging.getLogger()
class Process(object):
def __call__(self, ... | wikilinks/nel | nel/process/process.py | Python | mit | 4,542 |
"""
===================================================================
Support Vector Regression (SVR) using linear and non-linear kernels
===================================================================
Toy example of 1D regression using linear, polynomial and RBF kernels.
"""
print(__doc__)
import matplotlib.p... | DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/examples/svm/plot_svm_regression.py | Python | mit | 1,520 |
# -*- coding: utf-8 -*-
"""
This is part of WebScout software
Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en
Docs RU: http://hack4sec.pro/wiki/index.php/WebScout
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)
Thread class for HostsBrute modules
"""
import... | hack4sec/ws-cli | classes/threads/HostsBruteThread.py | Python | mit | 4,433 |
# -*- coding: utf-8 -*-
#
# Nirvana documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 14 09:20:10 2011.
#
# 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.
#
# All... | njwilson/nirvana-python | docs/conf.py | Python | mit | 7,175 |
# 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-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_scale_set_network_profile.py | Python | mit | 1,812 |
"""
WSGI config for MusicMash project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | castle-c/djangoTutorial | MusicMash/wsgi.py | Python | mit | 396 |
import json
import boto3
import hashlib
from shmenkins import logging, aws
from botocore.exceptions import ClientError
logger = logging.get_logger()
account = None # type: str
topic_build_status_changed = None # type: aws.Topic
cb = None
def handler(event: dict, ignored: dict) -> None:
global account
globa... | rzhilkibaev/shmenkins | lambda-py/builder/src/main.py | Python | mit | 3,720 |
from django.contrib import admin
from models import Category,CodeSnippet,Project,Publication,Conference,ProjectAdmin,Code,Article,ArticleAdmin
class CategoryAdmin(admin.ModelAdmin):
fields = ('title',)
# Register your models here.
admin.site.register(Category,CategoryAdmin)
admin.site.register(CodeSnippet)
admi... | sariyanidi/academics-webpage | mysite/blog/admin.py | Python | mit | 491 |
# 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/v2019_08_01/aio/operations/_vpn_server_configurations_operations.py | Python | mit | 31,822 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import fcntl
import socket
import select
response = 'HTTP/1.1 200 OK\r\nConnection: Close\r\nContent-Length: 1\r\n\r\nA'
server = socket.socket()
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server.bind(('0.0.0.0', 8080))
server.listen(32)
# se... | chaleaoch/jianshu_repo | network_program/nonblocking.py | Python | mit | 839 |
# -*- coding: utf-8 -*-
"""
Configuration
==============
Config file that will be used to specify constants employed in the code.
A normal user shouldn't interact with this file unless there is an extreme need to change the default behaviour.
For overwriting or adding new values to the config, the following should be... | uetke/experimentor | experimentor/config/config.py | Python | mit | 2,076 |
################################################################################
# Easy python interface for posting updates to a slack channel. Usage in README.
#
# Author: Carl Cortright
# Date: 12/20/2016
#
################################################################################
import requests
class slackw... | carlcortright/slack-webhook | slackwebhook/slackwebhook.py | Python | mit | 1,776 |
'''
The rule class.
@author: anze.vavpetic@ijs.si
'''
import json
from collections import defaultdict
from hedwig.core.predicate import UnaryPredicate, BinaryPredicate
from hedwig.core.example import Example
from hedwig.core.helpers import avg, std
from hedwig.core.settings import DEFAULT_ANNOTATION_NAME
class Rule... | anzev/hedwig | hedwig/core/rule.py | Python | mit | 14,746 |
import CardosoTech_GPIO.Platform as Platform
OUT = 0
IN = 1
HIGH = True
LOW = False
RISING = 1
FALLING = 2
BOTH = 3
PUD_OFF = 0
PUD_DOWN = 1
PUD_UP = 2
class BaseGPIO(object):
"""Base class for implementing simple digital IO for a platform.
Implementors are expected to su... | CardosoTech/CardosoTech_Python_GPIO | CardosoTech_GPIO/GPIO.py | Python | mit | 16,029 |
# License MIT (https://opensource.org/licenses/MIT).
from . import pos_cashbox_model
| it-projects-llc/pos-addons | pos_cashbox/models/__init__.py | Python | mit | 85 |
from distutils.core import setup
setup(
name='Django CMS NivoSlider',
version='0.1.2',
author='Ryan Bagwell',
author_email='ryan@ryanbagwell.com',
packages=['nivoslider',],
url='https://github.com/ryanbagwell/django-cms-nivo-slider',
license='LICENSE.txt',
description='A Django CMS caro... | ryanbagwell/django-cms-nivo-slider | setup.py | Python | mit | 487 |
"""
Unofficial Python API for Dicio.com.br
@author Felipe Pontes
@email felipemfpontes@gmail.com
"""
import html
from urllib.request import urlopen
from dicio.utils import Utils
BASE_URL = 'http://www.dicio.com.br/{}'
CHARSET = 'utf-8'
TAG_MEANING = ('class="significado', '</p>')
TAG_ETYMOLOGY = ('class="etim', '</s... | felipemfp/dicio | dicio/dicio.py | Python | mit | 5,198 |
import smtplib
import email.utils
import os
import csv
import email.Message
from email import Charset
from email.header import Header
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import quopri
import jinja2
class MailSender(object):
def __init__(self, toName, toAddr, ticket... | Nicceboy/python-email-imp | src/mailsender.py | Python | mit | 2,867 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import mock
from shim import HDDTempMonitor, MonitorCheckFailure
class TestHDDTempMonitor(unittest.TestCase):
def setUp(self):
self.monitor_id = "monitor_id"
self.monitor_options = {
'device': "/dev/null",
'lowe... | maszczyn/shim | tests/test_hdd_temp_monitor.py | Python | mit | 1,889 |
from django.db import models
from rest_framework import serializers
class Question(models.Model):
version = models.CharField(primary_key=True, max_length=8)
title = models.CharField(max_length=255)
text = models.TextField()
created_on = models.DateTimeField(auto_now_add=True)
updated_on = models.Da... | holycattle/pysqueak-api | api/models.py | Python | mit | 1,714 |
# Exercise 7
# Write a function char_freq() that takes in a string and counts the number of
# times each letter appeared in the string.
# For example, the string "abca" should return a dictionary in the form
# {"a": 2, "b": 1, "c": 1}.
def char_freq(s):
pass
print(char_freq("abca"))
print(char_freq("elephant"))
... | vinaymayar/python-game-workshop | lesson7/char_freq.py | Python | mit | 385 |
import pkg_resources
try:
pkg_resources.get_distribution('numpy')
except pkg_resources.DistributionNotFound:
numpyPresent = False
print("Error: Numpy package not available.")
else:
numpyPresent = True
import numpy as np
try:
pkg_resources.get_distribution('pandas')
except pkg_resources.Distri... | lvphj/epydemiology | epydemiology/phjExploreData.py | Python | mit | 26,912 |
"""test_flask_utils: validates expected behavior for prosper.common.flask_utils"""
import atexit
import importlib.util
from os import path, environ, remove
import platform
import pytest
from plumbum import local
import prosper.common.flask_utils as flask_utils
HERE = path.abspath(path.dirname(__file__))
ROOT = path.... | EVEprosper/ProsperCommon | tests/test_flask_utils.py | Python | mit | 1,995 |
"""
Given a string, find the length of the longest substring without repeating characters.
Examples:
Given "abcabcbb", the answer is "abc", which the length is 3.
Given "bbbbb", the answer is "b", with the length of 1.
Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substri... | weixsong/algorithm | leetcode/3.py | Python | mit | 1,051 |
#!/usr/bin/env python2
#
# Find a sequence of duk_hobject hash sizes which have a desired 'ratio'
# and are primes. Prime hash sizes ensure that all probe sequence values
# (less than hash size) are relatively prime to hash size, i.e. cover the
# entire hash. Prime data is packed into about 1 byte/prime using a
#... | jmptrader/duktape | util/genhashsizes.py | Python | mit | 3,405 |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'django.views.generic.simple.direct_to_template',
{'template': 'index.html'}, na... | pugpe/pugpe_portal | portal/urls.py | Python | mit | 1,303 |
#
# Copyright (c) Elliot Peele <elliot@bentlogic.net>
#
# This program is distributed under the terms of the MIT License as found
# in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/mit-license.php.
#
# This program is distributed in the hope that it... | elliotpeele/pyramid_oauth2_provider | pyramid_oauth2_provider/authentication.py | Python | mit | 3,576 |
#!/usr/bin/env python
# __author__ = "Ronie Martinez"
# __copyright__ = "Copyright 2016-2020, Ronie Martinez"
# __credits__ = ["Ronie Martinez"]
# __maintainer__ = "Ronie Martinez"
# __email__ = "ronmarti18@gmail.com"
import pytest
from latex2mathml.symbols_parser import convert_symbol
@pytest.mark.parametrize(
... | Code-ReaQtor/latex2mathml | tests/test_symbol_parser.py | Python | mit | 530 |
#!/usr/bin/env python3
# https://www.hackerrank.com/challenges/most-commons
import collections
import io
import sys
import unittest
def mangle(s):
counted = collections.Counter()
for entry in s:
counted[entry] += 1
ordered = sorted(
counted.keys(),
key=lambda key: (counted[key] <<... | altermarkive/Coding-Interviews | algorithm-design/hackerrank/most_commons/test_most_commons.py | Python | mit | 1,079 |
def read_all(*files):
"""Read file(s) and return the content
Args:
files (str): variable number of file names
Returns:
combined content as a string
"""
output = []
for f in files:
with open(f, 'r') as IN:
output.append(IN.read())
return "\n".join(output)
| yuhangwang/ninjag-python | ninjag/tk/ioTK/read_all.py | Python | mit | 320 |
import os
from lxml import etree
from pyqtcli import verbose as v
WARNING_TEMPLATE = "Alias \'{}\' already exists in \'{}\' at prefix \'{}\'."
def write_alias(qrc_files, verbose):
"""Write alias for resources within qrc files.
Alias are base in basename of theses resources. In the case where two
resou... | Kynarth/pyqtcli | pyqtcli/makealias.py | Python | mit | 2,341 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many diff... | goldsborough/euler | 31.py | Python | mit | 1,645 |
from unittest import TestCase
import unittest
from equadratures.poly import Poly
from equadratures.sampling_methods.induced import Induced
from equadratures.parameter import Parameter
from equadratures.basis import Basis
import numpy as np
import time
class TestSamplingGeneration(TestCase):
def test_sampling(self)... | psesh/Effective-Quadratures | tests/test_induced.py | Python | mit | 1,796 |
from sqlalchemy.test.testing import eq_, assert_raises, assert_raises_message
from sqlalchemy import *
from sqlalchemy.orm import attributes
from sqlalchemy import exc as sa_exc
from sqlalchemy.orm import exc as orm_exc
from sqlalchemy.orm import *
from sqlalchemy.test.util import gc_collect
from sqlalchemy.test impor... | obeattie/sqlalchemy | test/orm/test_transaction.py | Python | mit | 15,716 |
# Newton's Method to calculate square root
# get three inputs from the user (two ints, 1 float)
num_str = input("Find the square root of integer: ")
while not num_str.isdigit():
print("Pay attention")
num_str = input("Find the square root integer: ")
number_int = int(num_str)
guess_str = input("Initial ... | r-martin-/Code_College | PythonProgramming/newtonsqrt.py | Python | mit | 1,263 |