code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the view classes."""
from __future__ import unicode_literals
import sys
import unittest
from plaso.cli import views
from tests import test_lib as shared_test_lib
from tests.cli import test_lib
class TestBaseTableView(views.BaseTableView):
"""Class that... | rgayon/plaso | tests/cli/views.py | Python | apache-2.0 | 6,676 |
import numpy as np
import os
import sys
import tensorflow as tf
import time
import v3.classification.model as model
from inputs.classification.construct import construct_network_input_nodes
from network_utils import add_logits
from proto_utils import _int64_feature, _float_feature, _bytes_feature
def _convert_to_cla... | gvanhorn38/inception | v3/classification/test.py | Python | mit | 10,079 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from setuptools import setup
setup(name="bankers",
version="0.0.1",
description="Bankers - This is an implementation of the banker's deadlock algorithm",
author="Max Klingmann <KlingmannM@gmail.com>",
author_email="KlingmannM@gmail.com",
pa... | mkli90/bankers | setup.py | Python | gpl-2.0 | 771 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2016 Rapptz
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 r... | jicruz/heroku-bot | lib/discord/invite.py | Python | gpl-3.0 | 4,306 |
# -*- coding: utf-8 -*-
'''
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
This class holds example code how to use the dream algorithm
'''
import numpy as np
try:
import spotpy
except ImportError:
import sys
sys.path.append("."... | thouska/spotpy | spotpy/examples/tutorial_padds_hymod.py | Python | mit | 4,964 |
from distutils import log
from distutils.core import setup
from distutils.command.build import build
from distutils.command.install_scripts import install_scripts
import glob
import sys
from mikidown.config import __version__
class miki_build(build):
def run(self):
# Check the python version
try:
... | ckolumbus/mikidown | setup.py | Python | mit | 2,051 |
# Matrix Grapher and Transformer
'''
sources: Alg 2H Textbook, my dad
'''
# The user enters points to form a shape. Then, they select a transformation and the computer graphs the transformed shape.
'''
This document should become the functional specification of the project you are working on.
A functional specificat... | anoushkaalavilli/Final-Project | project.py | Python | mit | 6,494 |
"""Commands part of Websocket API."""
import asyncio
import voluptuous as vol
from homeassistant.auth.permissions.const import POLICY_READ
from homeassistant.const import EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL
from homeassistant.core import DOMAIN as HASS_DOMAIN, callback
from homeassistant.exceptions imp... | mKeRix/home-assistant | homeassistant/components/websocket_api/commands.py | Python | mit | 8,513 |
#!/usr/bin/python2
import sys
import subprocess
import itertools
from pprint import pprint
if len(sys.argv) < 4:
print 'You must specify 3 arguments:'
print '1. The path to the directory with log files'
print '2. The start time'
print '3. The end time'
sys.exit(1)
path = sys.argv[1]
start_time =... | beloglazov/ccpe-2014-experiments | results/do-execution-times.py | Python | apache-2.0 | 3,092 |
from rustypy.rswrapper import Tuple
# primitives:
def rust_bind_int_func(int_arg: int) -> int:
rval = int_arg + 1
return rval
def rust_bind_float_func(float_arg: float) -> float:
rval = float_arg + 0.5
return rval
def rust_bind_str_func(str_arg: str) -> str:
rval = str_arg + "added this in P... | iduartgomez/rustypy | tests/py_test_lib/test_package/basics/primitives.py | Python | bsd-3-clause | 1,156 |
"""An API for feeding operations asynchronously to Chopsticks."""
from __future__ import print_function
import sys
import traceback
from functools import partial
from collections import deque
from .tunnel import loop, PY2, BaseTunnel
from .group import Group, GroupOp
__metaclass__ = type
class NotCompleted(Exception... | lordmauve/chopsticks | chopsticks/queue.py | Python | apache-2.0 | 5,971 |
r"""UUID objects (universally unique identifiers) according to RFC 4122.
This module provides immutable UUID objects (class UUID) and the functions
uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
UUIDs as specified in RFC 4122.
If all you want is a unique ID, you should probably call uuid1() ... | bussiere/pypyjs | website/demo/home/rfk/repos/pypy/lib-python/2.7/uuid.py | Python | mit | 21,448 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-03 07:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
class Migration(migrations.Migration):
initial = True
dependencies = [
('routes'... | meshy/django-conman | example/example/migrations/0001_initial.py | Python | bsd-2-clause | 1,026 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Isaku Yamahata
# 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/... | salv-orlando/MyRepo | nova/tests/image/test_s3.py | Python | apache-2.0 | 4,917 |
from fabric.api import run
from fabric.decorators import with_settings
from fabric.colors import green, yellow
from deployer.tasks.requirements import install_requirements
@with_settings(warn_only=True)
def setup_virtualenv(python_version='', app_name='', app_dir='', repo_url=''):
print(green("Setting up virtuale... | streema/deployer | deployer/tasks/virtualenv.py | Python | mit | 576 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# Copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# ... | savoirfairelinux/l10n-canada | hr_expense_line_supplier_unported/__openerp__.py | Python | agpl-3.0 | 2,130 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vps_monitor.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| J22Melody/VPS-Monitor | manage.py | Python | gpl-2.0 | 254 |
# =============================================================================
# periscope-ps (unis)
#
# Copyright (c) 2012-2016, Trustees of Indiana University,
# All rights reserved.
#
# This software may be modified and distributed under the terms of the BSD
# license. See the COPYING file for details.
#
# T... | periscope-ps/unis | periscope/gemini.py | Python | bsd-3-clause | 6,179 |
class BasicGravityComponent:
"""
Initializes the object.
"""
def __init__(self, _id, desc):
self._id = _id
self.desc = desc
"""
Sets up the object.
"""
def setUp(self, actor, entity):
actor.terminalVelocity = actor.stateDict["termina... | maximx1/PyPlatformerEngine | pyplatformerengine/components/BasicGravityComponent.py | Python | mit | 650 |
#Example from Michael Kay to ??? on 4 Feb 2000, with well-formedness corrections
from Xml.Xslt import test_harness
sheet_1 = """<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
>
<xsl:output method='text'/>
<xsl:variable name="pos">
<xsl:for-each select="//element[descendant::y[.='z... | Pikecillo/genna | external/4Suite-XML-1.0.2/test/Xml/Xslt/Borrowed/km_20000204.py | Python | gpl-2.0 | 2,437 |
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
import numpy
from Bio.SVDSuperimposer import SVDSuperimposer
from Bio.PDB.PDBExceptions i... | NirBenTalLab/proorigami-cde-package | cde-root/usr/lib64/python2.4/site-packages/Bio/PDB/Superimposer.py | Python | mit | 2,332 |
# 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
# d... | noironetworks/neutron | neutron/tests/functional/cmd/test_ovs_cleanup.py | Python | apache-2.0 | 2,936 |
import sys
sys.path.append("./m1")
import mul
sum = mul.mul(2,2)
print(multip) | 40423139/2017springcd_hw | data/print1.py | Python | agpl-3.0 | 80 |
"""
This Command is based in Django Perseus Command,
but with super powers and Kronoscode magic.
"""
# -*- coding: utf-8 -*-
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
from django.core.cache import get_cache
from django_perseus.utils import ru... | CacaoMovil/guia-de-cacao-django | cacao_app/cacao/management/commands/render_guia.py | Python | bsd-3-clause | 3,438 |
# -*- coding: utf-8 -*-
import sfml as sf
WIDTH = 640
HEIGHT = 480
TITLE = "Python SFML Class Example 2"
settings = sf.ContextSettings()
settings.depth_bits = 24
settings.antialiasing_level = 1
class Bla:
# initialize
def __init__(self):
self.window = sf.RenderWindow(sf.VideoMode(WIDTH, HEIGHT),
... | akademikbilisim/ab2015-python-oyun | class_ornek_2.py | Python | mit | 1,816 |
import sys
from pluralsight.licensing import LicensingAPIClient
from pluralsight.reports import ReportsAPIClient
from pprint import pprint
# get the API key and plan from the command line
api_key = sys.argv[1]
plan = sys.argv[2]
# Create a client to the licensing API
client = LicensingAPIClient(plan, api_key)
# Get ... | tonybaloney/pluralsight | example.py | Python | apache-2.0 | 635 |
#!/usr/bin/env python
# coding: utf-8
from datetime import datetime
from distutils import spawn
import argparse
import json
import os
import platform
import shutil
import socket
import sys
import urllib
import urllib2
import main
from main import config
##############################################################... | lipis/life-line | run.py | Python | mit | 12,739 |
#!/usr/bin/env python
#
# Copyright 2007 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | GoogleCloudPlatform/appengine-python-standard | src/google/appengine/api/dispatchinfo.py | Python | apache-2.0 | 6,643 |
from django.contrib.gis.geos import prototypes as capi
from django.contrib.gis.geos.coordseq import GEOSCoordSeq
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.geometry import (
GEOSGeometry, ProjectInterpolateMixin,
)
from django.contrib.gis.geos.point import Point
from django... | DONIKAN/django | django/contrib/gis/geos/linestring.py | Python | bsd-3-clause | 5,843 |
#!/usr/bin/env python
#
# ELBE - Debian Based Embedded Rootfilesystem Builder
# Copyright (C) 2013 Linutronix GmbH
#
# This file is part of ELBE.
#
# ELBE 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, eithe... | kennethlyn/elbe | elbepack/commands/get_archive.py | Python | gpl-3.0 | 1,758 |
from django.conf.urls import url
from app import views
urlpatterns = [
# Matches any html file - to be used for gentella
# Avoid using your .html in your resources.
# Or create a separate django app.
url(r'^.*\.html', views.gentella_html, name='gentella'),
# The home page
url(r'^index$', views... | Haroldgomez777/Techword | app/urls.py | Python | gpl-3.0 | 387 |
cost, zeros = map(int, input().split())
print(int(round(cost, -zeros))) | JonSteinn/Kattis-Solutions | src/Slatkisi/Python 3/main.py | Python | gpl-3.0 | 71 |
# Copyright (C) 2010 Wil Mahan <wmahan+fatics@gmail.com>
#
# This file is part of FatICS.
#
# FatICS 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 the License, or
# (at your optio... | ecolitan/fatics | test/test_adjourn.py | Python | agpl-3.0 | 9,209 |
from __future__ import absolute_import, print_function
import sys
import logging
import pprint
import random
from getpass import getpass
logFormatter = logging.Formatter(
"%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s")
log = logging.getLogger('joinmarket')
log.setLevel(logging.DEBUG)
join... | chris-belcher/joinmarket-clientserver | jmbase/jmbase/support.py | Python | gpl-3.0 | 2,806 |
# the implementation here is a bit crappy.
from boxbranding import getBoxType
import time
from Directories import resolveFilename, SCOPE_CONFIG
boxtype = getBoxType()
PERCENTAGE_START = 50
PERCENTAGE_END = 100
profile_start = time.time()
profile_data = {}
total_time = 1
profile_file = None
try:
f... | n3wb13/OpenNfrGui-5.0-1 | lib/python/Tools/Profile.py | Python | gpl-2.0 | 2,665 |
import cPickle as pickle
import glob
import json
import math
import os
import sys
import cv2
import h5py
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import scipy.io
import scipy.stats
import skimage
import skimage.transform
import skimage.io
# The... | escorciav/linux-utils | ipython/profile/00_import_sciqnd.py | Python | mit | 516 |
from pyvisdk.esxcli.executer import execute_soap
from pyvisdk.esxcli.base import Base
class StorageCoreDevice(Base):
'''
Operations pertaining to the pluggable storage architectures' logical devices on the system. The operation currently allowed is to list the available devices on the system and the filters a... | xuru/pyvisdk | pyvisdk/esxcli/handlers/ha_cli_handler_storage_core_device.py | Python | mit | 2,507 |
import json
import pytest
import requests
from sqlalchemy.exc import IntegrityError
import bauble.db as db
from bauble.model import Report
import test.api as api
@pytest.fixture
def setup(organization, session):
setup.organization = session.merge(organization)
setup.user = setup.organization.owners[0]
se... | Bauble/bauble.api | test/spec/test_report.py | Python | bsd-3-clause | 2,284 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
unified_strdate,
US_RATINGS,
)
class PBSIE(InfoExtractor):
_VALID_URL = r'''(?x)https?://
(?:
# Direct video URL
video\.pbs\.org/(?:viralplayer|video)/(?P<id>[0-9]+)/? ... | 0x7678/youtube-dl | youtube_dl/extractor/pbs.py | Python | unlicense | 6,398 |
from __future__ import print_function
from __future__ import division
import numpy as np
import sys
import argparse
import time
import re
import gzip
import os
import logging
from collections import defaultdict
from operator import itemgetter
__version__ = "1.0"
def main():
parser=argparse.ArgumentParser(descr... | blajoie/vcf2fasta | scripts/vcf2fasta.py | Python | apache-2.0 | 8,351 |
from cli import *
from sim_commands import *
#
# ------------------------ info -----------------------
#
def yn(val):
return iff(val, "yes", "no")
def timer_info(obj, c):
return [ ("Frequency, Hz", obj.clock_freq_hz[c])]
def timer_status(obj, c):
return [ ("Counter", obj.count[c]),
("Count Register", obj.ini... | iniverno/RnR-LLC | simics-3.0-install/simics-3.0.31/amd64-linux/lib/python/mod_8254_commands.py | Python | gpl-2.0 | 1,493 |
class Root:
pass
| morepath/morepath_cerebral_todomvc | server/model.py | Python | bsd-3-clause | 21 |
#!usr/env/python
# filename: test_integration.py
import os
import sys
from Bio import SeqIO
from abutils.core.sequence import Sequence
from ..core import abstar
def test_api_integration_bcr_1k():
test_data = os.path.abspath('abstar/test_data/test_1k.fasta')
with open(test_data, 'r') as f:
test_seq... | briney/abstar | abstar/tests/test_integration.py | Python | mit | 1,009 |
# LICENSE BSD 2 CLAUSE #
# Copyright 2011 Mirio. All rights reserved. #
# Redistribution and use in source and binary forms, with or without modification, are #
# permitted provided tha... | Mirio/torblock | torblock.py | Python | bsd-2-clause | 2,616 |
# Copyright (c) 2016-2017 Philip Hane
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and... | secynic/nfsinkhole | nfsinkhole/apparmor.py | Python | bsd-2-clause | 3,520 |
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
from quodlibet.config import RATINGS
from tests... | elbeardmorez/quodlibet | quodlibet/tests/test_formats_xiph.py | Python | gpl-2.0 | 19,856 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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,
... | datalogics/scons | test/SourceCode.py | Python | mit | 3,424 |
"""
Logger di varie info per ogni host
"""
from novaclient import client as novaclient
from ceilometerclient import client as ceiloclient
import os
from os import environ as env
import time
def start(hosts, sleep_sec, base_dir):
print 'You must be admin to use this script'
# start logger
time_dir = get_... | MisterPup/OpenStack-Neat-Ceilometer | alarm_test/info_logger.py | Python | apache-2.0 | 6,034 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | GoogleCloudPlatform/python-compat-runtime | appengine-compat/exported_appengine_sdk/google/appengine/api/mail.py | Python | apache-2.0 | 47,061 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from xml.dom import minidom, Node
from os import listdir
from os.path import isfile, join
import urllib
import base64
from xml.sax.saxutils import escape
import hashlib
files = [f for f in listdir("hashes/") if isfile(join("hashes",f))]
def unwrap(x):
if x == None:
re... | xnyhps/capsdb | verify.py | Python | cc0-1.0 | 4,602 |
# encoding: 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 'FunctionalArea'
db.create_table('profiles_functionalarea', (
('id', self.gf('django.db... | chirilo/remo | remo/profiles/migrations/0018_auto__add_functionalarea.py | Python | bsd-3-clause | 8,327 |
# (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | duncanwp/iris | lib/iris/tests/integration/concatenate/__init__.py | Python | lgpl-3.0 | 915 |
"""Utilities to help work with log files"""
import os
import re
from robottelo.common import get_app_root, ssh
LOGS_DATA_DIR = os.path.join(get_app_root(), 'data', 'logs')
class LogFile(object):
"""
References a remote log file. The log file will be downloaded to allow
operate on it using python
"... | apagac/robottelo | robottelo/log.py | Python | gpl-3.0 | 1,199 |
import logging
import pendulum
from pynamodb.attributes import (UnicodeAttribute, UTCDateTimeAttribute)
from pynamodb.exceptions import DoesNotExist
from pynamodb.models import Model
from . import BaseLocker, Lock, LockAccessDenied
log = logging.getLogger(__name__)
class DynamoLock(Model):
class Meta:
... | jwplayer/rssalertbot | rssalertbot/locking/dynamo.py | Python | mit | 2,370 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... | tysonholub/twilio-python | twilio/rest/monitor/v1/event.py | Python | mit | 15,718 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | Lezval/horizon | django-openstack/django_openstack/dash/views/instances.py | Python | apache-2.0 | 11,808 |
# -*- coding: utf-8 -*-
"""
ReklaminiaiParduotuviųLankstinukai
Copyright (C) <2014> <Algirdas Butkus> <butkus.algirdas@gmail.com>
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 ve... | deadsoft/Reklaminiai-Parduotuviu-Lankstinukai | imagedeleter.py | Python | agpl-3.0 | 1,780 |
# -*- encoding: utf-8 -*-
from odoo import models, fields, api, _
class UpdateInvoiceLineWizard(models.TransientModel):
_name = 'update.invoice.line.wizard'
invoice_lines = fields.One2many('update.invoice.line.wizard.line', 'wizard_id', u'Invoice Lines')
def contract_line(self, line, active_id):
... | thinkopensolutions/tkobr-addons | tko_contract/wizard/update_invoice_lines.py | Python | agpl-3.0 | 1,663 |
"""
This is the main Cobbler module. It contains all code related to the Cobbler server and the CLI.
External applications should only make use of the ``cobbler.api`` module.
"""
| cobbler/cobbler | cobbler/__init__.py | Python | gpl-2.0 | 179 |
from CommonServerPython import *
value = demisto.args()["value"]
chars = demisto.args().get("chars", "")
demisto.results(value.strip(chars))
| demisto/content | Packs/CommonScripts/Scripts/StripChar/StripChar.py | Python | mit | 142 |
import unittest
from chess.pieces import create_piece, King, Queen, Bishop, Rook, Knight
class TestPieces(unittest.TestCase):
def test_create_pieces(self):
self.assertEqual(create_piece('k'), King())
self.assertEqual(create_piece('q'), Queen())
self.assertEqual(create_piece('b'), Bishop(... | srxavi/chess_permutations | chess/test/test_pieces.py | Python | gpl-3.0 | 1,908 |
# -*- coding: utf-8 -*-
#
# Copyright 2003-2019 University of Tromsø, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
... | unioslo/cerebrum | Cerebrum/modules/no/uit/Email.py | Python | gpl-2.0 | 10,667 |
''' Running instructions:
python find_outliers.py CHICAGO_CRIME_DATA.csv NUM_DATA_POINTS_AFTER STOP_AFTER
'''
import cPickle as pickle
import lib
import numpy as np
import sys
import sklearn.ensemble
num_after = int(sys.argv[2])
stop_after = int(sys.argv[3])
classifier = pickle.load(open('classifier.pickle'))
... | msipos/chicago-crime-outliers | find_outliers.py | Python | mit | 967 |
"""
Tests for the Course Outline view and supporting views.
"""
import datetime
import re
from unittest.mock import Mock, patch
import ddt
from completion.waffle import ENABLE_COMPLETION_TRACKING_SWITCH
from completion.models import BlockCompletion
from completion.test_utils import CompletionWaffleTestMixin
from dja... | arbrandes/edx-platform | openedx/features/course_experience/tests/views/test_course_outline.py | Python | agpl-3.0 | 34,442 |
import subprocess
import detect
import cv2
import cv2.cv as cv
import time
BRIGHTNESS = "40"
def checkUser(img):
gray = cv2.cvtColor(img, cv.CV_RGB2GRAY)
gray = cv2.equalizeHist(gray)
eyes = detect.detect(gray)
if len(eyes) <= 0:
return 0
else:
return 1
vc = cv2.VideoCapture(0)
ret, frame = vc.read()
conti... | lepisma/Sche | start.py | Python | mit | 705 |
import functools
import operator
class Env(dict):
"""
Computational environment for some expression.
Implemented with recursive composition -
each environment has the outer environment.
Every lookup for a name N in the environment E
with outer environment O goes like this:
1) E.lookup(N)... | begor/lisp | lisp/environment.py | Python | mit | 2,626 |
self.description = "Upgrade to a package that provides less than before"
lp1 = pmpkg("pkg1")
lp1.depends = ["imaginary"]
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2")
lp2.provides = ["imaginary", "real"]
self.addpkg2db("local", lp2)
p = pmpkg("pkg2", "1.0-2")
p.provides = ["real"]
self.addpkg(p)
self.args = "-U ... | kylon/pacman-fakeroot | test/pacman/tests/upgrade052.py | Python | gpl-2.0 | 487 |
class AttributeObject(object):
"""
mock = AttributeObject(hello='world')
mock.hello # 'world'
"""
def __init__(self, **kwargs):
self.kwargs = kwargs
for key, value in kwargs.items():
setattr(self, key, value)
def __repr__(self):
return '<AttributeObject: ... | hzlf/openbroadcast | website/cms/test_utils/util/mock.py | Python | gpl-3.0 | 527 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-oslogin | google/cloud/oslogin_v1/services/os_login_service/transports/base.py | Python | apache-2.0 | 10,518 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012-2013 Zuza Software Foundation
# Copyright 2013 Evernote Corporation
#
# This file is part of Pootle.
#
# Pootle 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 Softw... | evernote/pootle | pootle/apps/staticpages/urls.py | Python | gpl-2.0 | 1,786 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/oval_5/sc/windows/EntityItemAddrTypeType.py | Python | gpl-3.0 | 1,187 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... | chrismattmann/girder | girder/models/model_base.py | Python | apache-2.0 | 34,389 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | seankelly/buildbot | master/buildbot/changes/gitpoller.py | Python | gpl-2.0 | 15,724 |
from lino.gendoc.styles import getDefaultStyleSheet
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.units import inch
from reportlab.platypus import Paragraph, Frame
import unittest
class MyCase(unittest.TestCase):
def setUp(self):
styles = getDefaultStyleSheet()
self.story = []
... | MaxTyutyunnikov/lino | obsolete/tests/54.py | Python | gpl-3.0 | 1,392 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Violin Memory, Inc.
# 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
#
# ... | rlucio/cinder-violin-driver-havana | cinder/volume/drivers/violin/vxg/core/node.py | Python | apache-2.0 | 23,503 |
#!/usr/bin/env python
"""Test client RDFValues."""
import socket
from grr.lib import rdfvalue
from grr.lib import type_info
from grr.lib.rdfvalues import client as rdf_client
from grr.lib.rdfvalues import test_base
from grr.proto import jobs_pb2
class UserTests(test_base.RDFValueTestCase):
"""Test the User Proto... | darrenbilby/grr | lib/rdfvalues/client_test.py | Python | apache-2.0 | 6,812 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectiona... | mmottahedi/neuralnilm_prototype | scripts/e498.py | Python | mit | 6,885 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author:
# Mateusz Kruszyński <mateusz.kruszynski@gmail.com>
#
import os.path, sys, time, os
#import speller_graphics_manager as sgm
from multiplexer.multiplexer_constants import peers, types
from obci.configs import settings, variables_pb2
from obci.logic import log... | BrainTech/openbci | obci/logic/logic_home_peer.py | Python | gpl-3.0 | 1,024 |
#!/usr/bin/env python
from numpy.distutils.core import setup
from numpy.distutils.core import Extension
setup(name='py-bgo',
version='0.2',
descreption='Bayesian gloabl optimization',
author='Ilias Bilionis',
author_email='ibilion@purdue.edu',
keywords=['Bayesian global optimization', '... | PredictiveScienceLab/py-bgo | setup.py | Python | mit | 384 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
import sys
import nose
def absolute_path(path):
return os.path.abspath(os.path.normpath(path))
dir_path = absolute_path(os.path.dirname(__file__))
parent_dir_path = os.path.dirname(dir_path)
sys.path[0:0] = [parent_dir_path]
# Explicitly define which ... | gorakhargosh/pathtools | tests/run_tests.py | Python | mit | 825 |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
Takes the filesystem image created by the Dockerfile generated by
pre_flatpak_create/update_dockerfile, extracts the tree at /var/tmp/flatpak-bui... | DBuildService/atomic-reactor | atomic_reactor/plugins/prepub_flatpak_create_oci.py | Python | bsd-3-clause | 7,337 |
"""Implementation of the DOM Level 3 'LS-Load' feature."""
import copy
import warnings
import xml.dom
from xml.dom.NodeFilter import NodeFilter
__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"]
class Options:
"""Features object that has variables set for each DOMBuilder feature.
The DOMBuil... | xyuanmu/XX-Net | python3.8.2/Lib/xml/dom/xmlbuilder.py | Python | bsd-2-clause | 12,403 |
def need_xor(a, given):
if a == given:
return 0
return 1
def xor(s, k):
x = need_xor(s[0], s[1])
for i in s[2:k + 1]:
x = need_xor(x, i)
return x
def decipher(b, n, k):
l = n + k - 1
s = b[l - 1]
x = int(s)
for i in range(l - 2, l - k - 1, -1):
z = need_xo... | Nithanaroy/random_scripts | SODA2016/cipher.py | Python | mit | 939 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | elopio/snapcraft | tests/unit/commands/test_version.py | Python | gpl-3.0 | 1,276 |
import os
import re
import sass
from static_precompiler import exceptions, utils
from django.utils import encoding
from . import scss
__all__ = (
"SCSS",
"SASS",
)
class SCSS(scss.SCSS):
IMPORT_RE = re.compile(r"@import\s+(.+?)\s*;", re.DOTALL)
indented = False
is_compass_enabled = False
... | liumengjun/django-static-precompiler | static_precompiler/compilers/libsass.py | Python | mit | 3,084 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""Death by Captcha HTTP and socket API clients.
There are two types of Death by Captcha (DBC hereinafter) API: HTTP and
socket ones. Both offer the same functionalily, with the socket API
sporting faster responses and using way less connections.
To access the socket AP... | dantebarba/docker-media-server | plex/Sub-Zero.bundle/Contents/Libraries/Shared/deathbycaptcha.py | Python | gpl-3.0 | 17,470 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
DTM2TIF.py
---------------------
Date : May 2014
Copyright : (C) 2014 by Niccolo' Marchi
Email : sciurusurbanus at hotmail dot it
***********************... | wonder-sk/QGIS | python/plugins/processing/algs/lidar/fusion/DTM2TIF.py | Python | gpl-2.0 | 2,470 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2015, Adrian Sampson.
#
# 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 t... | kelvinhammond/beets | beets/logging.py | Python | mit | 4,354 |
#!/usr/bin/env python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| ... | huiyiqun/check_mk | cmk/utils.py | Python | gpl-2.0 | 2,201 |
# coding=utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
"""Concatenate js files to create jsfunfuzz.
"""
import io
from pathlib import Path
def link_fuzzer... | nth10sd/funfuzz | src/funfuzz/js/link_fuzzer.py | Python | mpl-2.0 | 1,155 |
# -*- coding: utf-8 -*-
default_app_config = 'comuni_italiani.apps.ComuniItalianiConfig' | kbytesys/django_comuni_italiani | comuni_italiani/__init__.py | Python | lgpl-2.1 | 88 |
from django.conf import settings
def setting(suffix, default):
return getattr(settings, 'SLACK_%s' % suffix, default)
TOKEN = setting('TOKEN', None)
CHANNEL = setting('CHANNEL', '#general')
USERNAME = setting('USERNAME', 'bot')
ICON_URL = setting('ICON_URL', None)
ICON_EMOJI = setting('ICON_EMOJI', None)
BACKEND... | avorio/django-slack | django_slack/app_settings.py | Python | bsd-3-clause | 484 |
import pytest
import requests
from libturpial.lib.services.media.preview.base import PreviewMediaService
from tests.helpers import DummyResponse
class TestPreviewBase:
@classmethod
@pytest.fixture(autouse=True)
def setup_class(self, monkeypatch):
self.preview = PreviewMediaService()
def test... | satanas/libturpial | tests/services/preview/test_preview_base.py | Python | gpl-3.0 | 843 |
"""
Combination of multiple media players into one for a universal controller.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.universal/
"""
import logging
# pylint: disable=import-error
from copy import copy
from homeassistant.components.... | luxus/home-assistant | homeassistant/components/media_player/universal.py | Python | mit | 14,412 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('work', '0002_auto_20160424_2250'),
]
operations = [
migrations.AlterField(
model_na... | bonnieblueag/farm_log | work/migrations/0003_auto_20160425_0341.py | Python | gpl-3.0 | 461 |
from __future__ import division
import numpy
from chainer.training import extension
class LinearShift(extension.Extension):
"""Trainer extension to change an optimizer attribute linearly.
This extension changes an optimizer attribute from the first value to the
last value linearly within a specified d... | anaruse/chainer | chainer/training/extensions/linear_shift.py | Python | mit | 2,795 |
##
# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | skarra/CalDAVClientLibrary | caldavclientlibrary/protocol/http/data/__init__.py | Python | apache-2.0 | 606 |
# PYMT Plugin integration
IS_PYMT_PLUGIN = True
PLUGIN_TITLE = 'Bubble Battle !'
PLUGIN_AUTHOR = 'Mathieu Virbel'
PLUGIN_DESCRIPTION = 'Fight the bubbles !!!!! ]:X'
from pymt import *
from OpenGL.GL import *
from random import random, randint
class Basic(MTWidget):
def __init__(self, **kwargs):
super(Basi... | nuigroup/pymt-widgets | examples/games/bubblebattle/bubblebattle.py | Python | lgpl-3.0 | 10,109 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="font", parent_name="isosurface.legendgrouptitle", **kwargs
):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/plotly.py | packages/python/plotly/plotly/validators/isosurface/legendgrouptitle/_font.py | Python | mit | 1,540 |
import sys
for line in sys.stdin:
# If there is no line...
if len(line) == 0:
# Skip
pass
# If the line contains data, split it
line = line.split(" ")
# If it's settings...
if line[0] == "settings":
# Store game data
pass
# If it's update...
if line[0] == "update":
# Store game update
pass
# I... | jacksarick/My-Code | Python/4_in_row_basic.py | Python | mit | 468 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.