text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# $Id: uas-subscribe-terminated-retry.py 4188 2012-06-29 09:01:17Z nanang $
#
import inc_const as const
PJSUA = ["--null-audio --max-calls=1 --id sip:pjsua@localhost --add-buddy $SIPP_URI"]
PJSUA_EXPECTS = [[0, "", "s"],
[0, "Subscribe presence of:", "1"],
[0, "Presence subscription .* is TERMINATED", "... | AlexanderVangelov/pjsip | tests/pjsua/scripts-sipp/uas-subscribe-terminated-retry.py | Python | gpl-2.0 | 374 | 0.026738 |
from ds_store import DSStore, DSStoreEntry
from burp import IBurpExtender
from burp import IScannerCheck
from burp import IExtensionStateListener
from burp import IScanIssue
import StringIO
from urlparse import urlparse
def traverse_ds_store_file(d):
"""
Traverse a DSStore object from the node and yeld each ... | j4v/DS_Store-Scanner | dsstore_scanner.py | Python | gpl-3.0 | 6,357 | 0.001573 |
blocklevel = ["blockquote", "div", "form", "p", "table", "video", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "details", "article", "header", "main"]
def normalizeEnter(src):
#Deletes all user defined for readability reason existing line breaks that are issues for the HTML output
for elem in blocklevel:
while src.fin... | ValorNaram/isl | inputchangers/002.py | Python | mit | 1,044 | 0.029693 |
alternative = [
(1024 ** 5, 'PB'),
(1024 ** 4, 'TB'),
(1024 ** 3, 'GB'),
(1024 ** 2, 'MB'),
(1024 ** 1, 'KB'),
(1024 ** 0, (' byte', ' bytes')),
]
def size(bytes, system=alternative):
"""Human-readable file size.
"""
for factor, suffix in system:
if bytes >= factor:
... | shashi792/courtlistener | alert/lib/filesize.py | Python | agpl-3.0 | 789 | 0 |
'''
Created on 2016/8/25
:author: hubo
'''
from namedstruct import *
from namedstruct.namedstruct import BadFormatError, BadLenError, Parser, _create_struct
def _copy(buffer):
try:
if isinstance(buffer, memoryview):
return buffer.tobytes()
else:
return buffer[:]
excep... | hubo1016/vlcp | vlcp/utils/zookeeper.py | Python | apache-2.0 | 26,134 | 0.034438 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2020 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... | ubuntu-core/snapcraft | tests/unit/plugins/v2/test_go.py | Python | gpl-3.0 | 3,433 | 0.000874 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | UManPychron/pychron | pychron/spectrometer/tasks/spectrometer_task.py | Python | apache-2.0 | 11,184 | 0.00152 |
import httplib2
import os
import mimetypes
import time
from apiclient import discovery, errors
from googleapiclient.http import MediaFileUpload
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
try:
import argparse
flags = argparse.ArgumentParser(parents=[too... | dsloop/FranERP | app/google_drive_api.py | Python | mit | 3,922 | 0.000255 |
# -*- coding: utf-8 -*-
"""
Test models, managers, and validators.
"""
import ddt
from completion import waffle
from completion.test_utils import CompletionWaffleTestMixin
from django.urls import reverse
from rest_framework.test import APIClient
import six
from openedx.core.djangolib.testing.utils import skip_unless... | edx-solutions/edx-platform | openedx/tests/completion_integration/test_views.py | Python | agpl-3.0 | 9,482 | 0.001476 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
from .woa_normbias import woa_normbias
from cotede.fuzzy im... | castelao/CoTeDe | cotede/qctests/fuzzylogic.py | Python | bsd-3-clause | 2,680 | 0.002985 |
import os, sys
import myfun
import numpy as np
import matplotlib as mpl
mpl.use('ps')
import matplotlib.pyplot as plt
import lagrangian_stats
import fio
## READ archive (too many points... somehow)
# args: name, dayi, dayf, days
#label = 'm_25_1_particles'
#label_25 = 'm_25_1_particles'
label = 'm_25_2_512'
label_2... | jungla/ICOM-fluidity-toolbox | 2D/U/plot_drate_z.py | Python | gpl-2.0 | 3,339 | 0.03504 |
#!/usr/bin/env python
# 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.
''' Base class for postprocessing of RC files.
'''
import sys
class PostProcessor(object):
''' Base class for postprocessing of... | JoKaWare/WTL-DUI | tools/grit/grit/tool/postprocess_interface.py | Python | bsd-3-clause | 1,029 | 0.004859 |
from SimpleCV import Camera, Display
import time
import wx
def slika_klik():
cam = Camera(0)
display = Display()
cam.getImage().show()
i = 0
while display.isNotDone():
start_time = time.clock()
img = cam.getImage()
if display.mouseLeft:
img.s... | GajaZ/Locevanje_odpadkov | kamera_klik.py | Python | gpl-3.0 | 666 | 0.016517 |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... | edespino/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/walrepl/gpinitstandby/__init__.py | Python | apache-2.0 | 6,141 | 0.007816 |
#!/usr/bin/env python
from _api import *
from _intoptparse import *
| adamhadani/HBasta | hbasta/__init__.py | Python | apache-2.0 | 69 | 0 |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import fs_uae_launcher.fsui as fsui
from ..Settings import Settings
from ..I18N import _, ngettext
from .Skin import Skin
class LauncherFileDialog(fsui.FileDia... | cnvogelg/fs-uae-gles | launcher/fs_uae_launcher/ui/LauncherFileDialog.py | Python | gpl-2.0 | 2,280 | 0.002632 |
__author__ = 'dkador'
class BasePersistenceStrategy(object):
"""
A persistence strategy is responsible for persisting a given event
somewhere (i.e. directly to Keen, a local cache, a Redis queue, etc.)
"""
def persist(self, event):
"""Persists the given event somewhere.
:param ev... | isotoma/KeenClient-Python | keen/persistence_strategies.py | Python | mit | 1,595 | 0 |
from contextlib import contextmanager
import threading
try: # python 3
import tkinter
from tkinter import messagebox
from tkinter import filedialog
from tkinter import simpledialog
from tkinter import scrolledtext
from tkinter import Scrollbar
from tkinter import N
from tkinter import ... | henryiii/semester | semester/gui/sandals.py | Python | mit | 15,589 | 0.007569 |
#!/usr/bin/env python3
# DepGen.py - produce a make dependencies file for Scintilla
# Copyright 2019 by Neil Hodgson <neilh@scintilla.org>
# The License.txt file describes the conditions under which this software may be distributed.
# Requires Python 3.6 or later
import sys
sys.path.append("..")
from scripts import ... | martinrotter/textilosaurus | src/libtextosaurus/3rd-party/scintilla/gtk/DepGen.py | Python | gpl-3.0 | 752 | 0.014628 |
# Copyright 2014 Mirantis 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... | sniperganso/python-manilaclient | manilaclient/tests/functional/base.py | Python | apache-2.0 | 10,433 | 0 |
#
# FishPi - An autonomous drop in the ocean
#
# Main View classes for POCV UI.
#
import tkFont
from Tkinter import *
from PIL import Image, ImageTk
class MainView(Frame, object):
""" MainView class for POCV UI. """
def __init__(self, master, view_controller):
super(MainView, self).__init__(mas... | FishPi/FishPi-POCV---Command---Control | fishpi/ui/main_view_tk.py | Python | bsd-2-clause | 13,484 | 0.010902 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# 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
#... | MostlyOpen/odoo_addons_jcafb | myo_professional_cst/__openerp__.py | Python | agpl-3.0 | 1,550 | 0.000645 |
#!/usr/bin/env python
import sys
import argparse
import collections
import numpy as np
import tifffile as TIFF
import sane
import click
import toml
def quick_scan(settings = {}, test = False):
"""Make scan using first scanning device found by SANE driver.
"""
# init and find devices
sane.init()
... | pmagwene/unscanny | scanit.py | Python | gpl-3.0 | 1,722 | 0.013937 |
# coding: utf-8
"""
Secure JavaScript Login
~~~~~~~~~~~~~~~~~~~~~~~
:copyleft: 2012-2015 by the secure-js-login team, see AUTHORS for more details.
:created: by JensDiemer.de
:license: GNU GPL v3 or above, see LICENSE for more details
"""
from __future__ import unicode_literals, print_function
i... | jedie/django-secure-js-login | tests/test_utils/selenium_test_cases.py | Python | gpl-3.0 | 5,276 | 0.003033 |
# Copyright (C) 2010 Oregon State University et al.
#
# 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.
#
# This program i... | dmS0Zq/ganeti_webmgr | ganeti_webmgr/ganeti_web/views/importing.py | Python | gpl-2.0 | 7,249 | 0 |
"""
Extensible validation for Python dictionaries.
This module implements Cerberus Validator class
:copyright: 2012-2015 by Nicola Iarocci.
:license: ISC, see LICENSE for more details.
Full documentation is available at http://python-cerberus.org
"""
from collections import Callable, Hashable, It... | calve/cerberus | cerberus/cerberus.py | Python | isc | 45,426 | 0.000154 |
# -*- coding: utf-8 -*-
"""
Eve Demo (Secured)
~~~~~~~~~~~~~~~~~~
This is a fork of Eve Demo (https://github.com/pyeve/eve-demo)
intended to demonstrate how a Eve API can be secured by means of
Flask-Sentinel.
For demonstration purposes, besides protecting a couple API endpoints
with a Be... | nicolaiarocci/eve-oauth2 | run.py | Python | bsd-3-clause | 917 | 0.001091 |
# -*- coding:utf-8 -*-
# ##### BEGIN LGPL LICENSE BLOCK #####
# GEOS - Geometry Engine Open Source
# http://geos.osgeo.org
#
# Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
# Copyright (C) 2005 2006 Refractions Research Inc.
# Copyright (C) 2001-2002 Vivid Solutions Inc.
# Copyright (C) 1995 Olivier Devill... | s-leger/archipack | pygeos/op_valid.py | Python | gpl-3.0 | 31,278 | 0.000959 |
# Compatible with ranger 1.6.0 through 1.7.*
#
# This plugin adds the new macro %date which is substituted with the current
# date in commands that allow macros. You can test it with the command
# ":shell echo %date; read"
# from __future__ import (absolute_import, division, print_function)
import time
import range... | amerlyq/airy | ranger/plugins/macro_date.py | Python | mit | 866 | 0 |
import pytest
class TestNcftp:
@pytest.mark.complete("ncftp ")
def test_1(self, completion):
assert completion
@pytest.mark.complete("ncftp -", require_cmd=True)
def test_2(self, completion):
assert completion
| algorythmic/bash-completion | test/t/test_ncftp.py | Python | gpl-2.0 | 245 | 0 |
"""
Apply permissions on a project.
"""
import sys
import opal.core
import opal.perm
PERMISSIONS = {
'administrate': 'PROJECT_ALL'
}
def add_arguments(parser):
"""
Add command specific options
"""
opal.perm.add_permission_arguments(parser, PERMISSIONS.keys())
parser.add_argument('--project', ... | apruden/opal | opal-python-client/src/main/python/opal/perm_project.py | Python | gpl-3.0 | 1,309 | 0.00382 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by iFantastic on 15/09/05
import sqlite3
#TODO: Add more class method for Database Class.
class Database():
def __init__(self, db_name):
self.db = sqlite3.connect(db_name.decode('utf-8'))
# self.db = sqlite3.connect(':memory:')
self.... | VirgiliaBeatrice/VocabularyGenerator | src/sqlbase.py | Python | mit | 4,534 | 0.001764 |
# 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 logging
import os
import sys
from telemetry import decorators
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.co... | markYoungH/chromium.src | tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_backend.py | Python | bsd-3-clause | 9,745 | 0.008722 |
"""This is the base receiver for the base model."""
from flask import request
from typing import Optional, Union, Dict, List
RequestData = Dict[str, Union[str, dict, List[dict]]]
class BaseReceiver:
"""This is the base receiver class for the base model."""
def __init__(self):
"""Use base model for ... | WheatonCS/Lexos | lexos/receivers/base_receiver.py | Python | mit | 1,956 | 0 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'GoogleProduct.google_shopping_updated'
db.add_column(u'gm... | estuans/django-oscar-gmerchant | gmerchant/migrations/0007_auto__add_field_googleproduct_google_shopping_updated.py | Python | bsd-3-clause | 13,944 | 0.00753 |
import sys
from collections import defaultdict
from itertools import chain
from ieml import error
from ieml.commons import logger
from ieml.dictionary.table.table import *
class TableStructure:
# define a forest of root paradigm
# This class defines :
# - for each paradigm :
# o the parent tab... | IEMLdev/propositions-restful-server | ieml/dictionary/table/table_structure.py | Python | gpl-3.0 | 3,891 | 0.003341 |
# encoding: utf-8
# module PyKDE4.kdecore
# from /usr/lib/python3/dist-packages/PyKDE4/kdecore.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtNetwork as __PyQt4_QtNetwork
class KDateTime(): # skipped bases: <class 'sip.wrapper'>
# no d... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyKDE4/kdecore/KDateTime.py | Python | gpl-2.0 | 5,923 | 0.011312 |
'''
Date : 2017-4-21
Author : Chilam
Application : Person Detector based on OpenCV HOG and SVM detector
'''
# import the necessary packages
from __future__ import print_function
from imutils.object_detection import non_max_suppression
from imutils import paths
import numpy as np
import argparse
import im... | knaffe/Face_Recog_sys | person_detectior/detect_motion.py | Python | mit | 2,007 | 0.014449 |
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py | Python | mit | 12,428 | 0.004425 |
#! /usr/bin/env python3
import sys
from itertools import product
from mule_local.JobMule import *
from mule.exec_program import *
from mule.InfoError import *
jg = JobGeneration()
"""
Compile parameters
"""
params_compile_sweet_mpi = ['enable', 'disable']
params_compile_threading = ['omp', 'off']
params_compile_th... | schreiberx/sweet | tests/20_platforms_job_generation/benchmark_create_job_scripts.py | Python | mit | 3,673 | 0.002723 |
# -*- coding: utf-8 -*-
"""
requests.structures
~~~~~~~~~~~~~~~~~~~
Data structures that power Requests.
"""
class CaseInsensitiveDict(dict):
''''''
@property
def lower_keys(self):
if not hasattr(self, '_lower_keys') or not self._lower_keys:
self._lower_keys = dict((k.lower(), k) ... | DarthMaulware/EquationGroupLeaks | Leak #1 - Equation Group Cyber Weapons Auction - Invitation/EQGRP-Free-File/Firewall/EXPLOITS/ELCO/fosho/requests/structures.py | Python | unlicense | 1,453 | 0.002753 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import re
import sys
import tarfile
import numpy as np
from six.moves import urllib
import tensorflow as tf
import time
class Classifier:
def __init__(self, prefix):
self.DATA_URL... | vignettist/image-import | import_classify.py | Python | mit | 4,535 | 0.005072 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_generated_aiplatform_v1_dataset_service_list_annotations_sync.py | Python | apache-2.0 | 1,539 | 0.0013 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron
# Copyright 2015, TODAY Clouder SASU
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License with Attribution
# ... | microcom/clouder | clouder_template_docker/__openerp__.py | Python | gpl-3.0 | 1,398 | 0 |
# -*- coding: utf-8 -*-
"""
Created on Tue May 31 10:57:02 2016
@author: noore
"""
import bioservices.kegg
import pandas as pd
kegg = bioservices.kegg.KEGG()
cid2name = kegg.list('cpd')
cid2name = filter(lambda x: len(x) == 2, map(lambda l : l.split('\t'), cid2name.split('\n')))
cid_df = pd.DataFrame(cid2name, colum... | dmccloskey/component-contribution | component_contribution/kegg_database.py | Python | mit | 860 | 0.004651 |
from math import *
import math
import random, time
import BuildGeometry
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObjectAI
from pandac.PandaModules import *
from toontown.golf import PhysicsWorldBase
from toontown.toonbase import ToontownGlobals
class DistributedPhy... | ToonTownInfiniteRepo/ToontownInfinite | toontown/golf/DistributedPhysicsWorldAI.py | Python | mit | 2,425 | 0.004536 |
import sys
import pigpio
import time
from colorama import Fore, Back, Style
def set_speed(lspeed, rspeed):
pi.hardware_PWM(left_servo_pin, 800, int(lspeed)*10000)
pi.hardware_PWM(right_servo_pin, 800, int(rspeed)*10000)
pi = pigpio.pi()
left_servo_pin = 13
right_servo_pin = 12
dead_pin = 17
die_distance = 8
... | yanadsl/ML-Autocar | test.py | Python | mit | 519 | 0.00578 |
#!/usr/local/bin/python
"""
Handles Google Service Authentication
"""
# TODO(rrayborn): Better documentation
__author__ = "Rob Rayborn"
__copyright__ = "Copyright 2014, The Mozilla Foundation"
__license__ = "MPLv2"
__maintainer__ = "Rob Rayborn"
__email__ = "rrayborn@mozilla.com"
__status__ = "Development"
from Ope... | mozilla/user-advocacy | lib/web_api/google_services.py | Python | mpl-2.0 | 4,807 | 0.008945 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version(*file_paths):
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename).read()
ve... | comandrei/django-shortcircuit | setup.py | Python | bsd-3-clause | 2,291 | 0.000873 |
import codecs
import logging
logger = logging.getLogger(__name__)
class TextAnalyzer:
def __init__(self):
logger.debug('-- Initializing TextAnalyzer --')
"""
Deze functie leest een stopwoorden file (stoplist_tno.tab) in en retourneert deze woorden in
een dictionary
""... | beeldengeluid/linkedtv-editortool | src/linkedtv/text/TextAnalyzer.py | Python | gpl-2.0 | 1,003 | 0.013958 |
from threading import Thread, Event
from time import sleep
from garage import Garage
import logging
from time import time
logger = logging.getLogger('garage_state_mon')
class LastStateTransitionMonitor(Thread):
def __init__(self, dao, config, state=Garage.closed, notify_callback=None):
Thread.__init__(... | drweaver/py_garage_server | garage_state_mon.py | Python | mit | 1,828 | 0.036105 |
'''
Basic hash table to practice working through hash table logic...
'''
class HashTable():
def __init__(self):
CURRENT_SIZE = 10
self.table_size = CURRENT_SIZE
# self.table = [0] * self.table_size
# TODO: make this more dynamic .. check for collisions instead of filling every slo... | chrcoe/code-kata | legacy/python/hashtable/__init__.py | Python | mit | 4,107 | 0.000487 |
import argparse
import json
import netaddr
import os
import uuid
import docker
import sys
from docker.errors import APIError
from vrouter_netns import validate_uuid, NetnsManager
class VRouterDocker(object):
"""
Creates and drestoys service instance inside Docker.
It needs to be run as superuser to connec... | facetothefate/contrail-controller | src/vnsw/opencontrail-vrouter-netns/opencontrail_vrouter_netns/vrouter_docker.py | Python | apache-2.0 | 10,235 | 0.000195 |
import socket,select,sys,time
from errors import *
from communicate import SendData, ReceiveData, ReceiveDataUDP
class TCPServer():
def __init__(self):
self.sending_socket = None
def input_func(self,sock,host,port,address):pass
def output_func(self,sock,host,port,address):pass
de... | remremrem/EV-Tribute | world/Net/netbase.py | Python | mit | 6,335 | 0.027466 |
from MergeIndependent import *
| mica-gossip/MiCA | tools/micavis/custom/RoundRobinMerge.py | Python | bsd-3-clause | 31 | 0 |
# noinspection PyInterpreter
import json
import logging
import os
import re
import requests
import redis
import sys
import time
import urllib
import uuid
from pylimit import PyRateLimit
import six.moves.configparser
class VirusTotal():
def __init__(self, *args):
self.logger = logging.getLogger(__name__)
... | lukehinds/anteater | anteater/src/virus_total.py | Python | apache-2.0 | 6,371 | 0.001727 |
from __future__ import absolute_import
import json
from changes.config import db
from changes.constants import Result
from changes.models.jobplan import JobPlan
from changes.utils.http import build_web_uri
from .base import ArtifactHandler, ArtifactParseError
class CollectionArtifactHandler(ArtifactHandler):
""... | dropbox/changes | changes/artifacts/collection_artifact.py | Python | apache-2.0 | 1,917 | 0.004173 |
# from ..ocl import ApiResource
# class Star(ApiResource):
# def __init__(self):
# super(Star, self).__init__()
# self.resource = {}
# self.username = ""
# self.dateStarred = ""
| burakince/ocl_web | ocl_web/libs/ocl/star.py | Python | mpl-2.0 | 216 | 0 |
from djapian.tests.utils import BaseIndexerTest, BaseTestCase, Entry
def query_test(query, count):
class _QueryTest(BaseIndexerTest, BaseTestCase):
def setUp(self):
super(_QueryTest, self).setUp()
self.result = Entry.indexer.search(query)
def test_result_count(self):
... | pombreda/djapian | src/djapian/tests/query.py | Python | bsd-3-clause | 718 | 0.002786 |
r"""protocols is a module that contains a set of VTK Web related
protocols that can be combined together to provide a flexible way to define
very specific web application.
"""
from time import time
import os, sys, logging, types, inspect, traceback, logging, re
from vtkWebCorePython import vtkWebApplication, ... | timkrentz/SunTracker | IMU/VTK-6.2.0/Web/Python/vtk/web/protocols.py | Python | mit | 11,069 | 0.003523 |
r"""
=====================================================================
The Johnson-Lindenstrauss bound for embedding with random projections
=====================================================================
The `Johnson-Lindenstrauss lemma`_ states that any high dimensional
dataset can be randomly projected i... | bnaul/scikit-learn | examples/miscellaneous/plot_johnson_lindenstrauss_bound.py | Python | bsd-3-clause | 7,785 | 0.001413 |
# -*- coding: utf8 -*-
# Copyright (C) 2013 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
import os
import pep8
from linting import linter
class Pep8Error(linter.LintError):
"""PEP-8 linting error class
"""
def __init__(self, filename, loc, o... | alexfalcucc/anaconda | anaconda_lib/linting/anaconda_pep8.py | Python | gpl-3.0 | 4,416 | 0.000226 |
# This file is a fix for this issue with django-compressor
# https://github.com/django-compressor/django-compressor/issues/226
# This is a less filter that explicitly calls CssAbsoluteFilter.
# After adding the relative-urls flag to the lessc command,
# it appears to be unnecessary but I'm leaving it here in case
# w... | nanchenchen/script-analysis | pyanalysis/precompilers.py | Python | mit | 843 | 0.002372 |
"""Support for Homekit motion sensors."""
from __future__ import annotations
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import Service, ServicesTypes
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from h... | rohitranjan1991/home-assistant | homeassistant/components/homekit_controller/binary_sensor.py | Python | mit | 4,745 | 0.000211 |
# -*- coding: utf-8 -*-
#
# 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
#... | owlabs/incubator-airflow | tests/www/test_utils.py | Python | apache-2.0 | 14,133 | 0.001132 |
from app import app
from flask import render_template
@app.route('/')
def index():
return render_template('index.html')
@app.route('/story/')
def story():
return render_template('story.html')
@app.route('/bio/')
def bio():
return render_template('bio.html')
@app.route('/contact/')
def contact():
return render_t... | jacburge/wewillremember | app/views.py | Python | apache-2.0 | 610 | 0.013115 |
'''Tests for the ValidateHash object'''
from __future__ import absolute_import
import unittest
from nose.tools import assert_true, assert_false
from hashit.core.hash_data import HashData
from hashit.core.hash_type import HashType
from hashit.service.validate_hash import ValidateHash
from hashit.utils.data_encap impo... | art-of-dom/hash-it | test/test_validate_hash.py | Python | mit | 4,257 | 0.00047 |
import datetime as dt
from freezegun import freeze_time
from khal.ui import DayWalker, DListBox, StaticDayWalker
from ..utils import LOCALE_BERLIN
from .canvas_render import CanvasTranslator
CONF = {'locale': LOCALE_BERLIN, 'keybindings': {},
'view': {'monthdisplay': 'firstday'},
'default': {'timede... | pdav/khal | tests/ui/tests_walker.py | Python | mit | 2,702 | 0.00111 |
from django.apps import AppConfig
class GalleryAppConfig(AppConfig):
name = 'gallery'
verbose_name = 'Galeria' | patrickporto/soldajustica | soldajustica/gallery/apps.py | Python | mit | 123 | 0.008264 |
'''
Created on Feb 28, 2013
@author: Santiago Diaz M - salchoman@gmail.com
'''
from core.plugs import fuzzdb_plugin
from core.utils.wsresponse_object import wsResponse
from core.data import logger
from core.Singleton import Singleton
import sys
import inspect
import threading
import Queue
import gtk
class PluginMan... | salcho/antares | core/PluginManager.py | Python | mit | 5,590 | 0.005546 |
"""This modules is used to capture the screen
"""
import pyautogui
import time
import Globals
PATH = './Captures/'
def capture_area(area):
"""
Captures area of the screen
Args:
area (Tuple (x,y,width,height)): Area to capture
Returns:
Image : Image of the area captured
"""
... | DavidBarishev/DDtankFarmingBot | Ddtank_farm_bot/Framework/Capture.py | Python | gpl-3.0 | 1,336 | 0.000749 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('kappahistory', '0007_auto_20150303_2154'),
]
operations = [
migrations.AddField(
model_name='drive',
... | kappapolls/kappapolls | kappahistory/migrations/0008_auto_20150303_2155.py | Python | gpl-2.0 | 649 | 0 |
# 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... | Juniper/tempest | tempest/scenario/test_volume_boot_pattern.py | Python | apache-2.0 | 10,161 | 0 |
from sep_search.models.article import Article
from sep_search.models.author import Author
| AFFogarty/SEP-Bot | public/sep_search/models/__init__.py | Python | mit | 90 | 0 |
# Generated by Django 3.0.9 on 2020-09-04 21:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stock', '0006_auto_20200904_2343'),
]
operations = [
migrations.RemoveField(
model_name='paymenttransaction',
name='... | UrLab/incubator | stock/migrations/0007_auto_20200904_2351.py | Python | agpl-3.0 | 587 | 0.001704 |
#!/usr/bin/env python3
import logging
import requests
logger = logging.getLogger(__name__)
class PackageMeta:
def __init__(self, api, package_name) -> None:
self.api = api
self.package_name = package_name
self.details = self.app_details()
if not self.details:
excepti... | ClaudiuGeorgiu/PlaystoreDownloader | playstoredownloader/playstore/meta.py | Python | mit | 1,902 | 0.001052 |
# key point is to find the half node
class Node:
def __init__(self, val):
self.val = val
self.next = None
class LinkList:
def __init__(self):
self.head = None
def push(self, val):
node = Node(val)
if self.head:
node.next = self.head
self.he... | sonymoon/algorithm | src/main/python/geeksforgeeks/list/mmerge-sort-for-linked-list.py | Python | apache-2.0 | 1,384 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
PyChess arena tournament script.
This script executes a tournament between the engines installed on your
system. The script is executed from a terminal with the usual environment.
'''
import os
import sys
######################################################... | pychess/pychess | utilities/arena.py | Python | gpl-3.0 | 6,460 | 0.008363 |
from django.conf.urls.defaults import patterns, url
from urls import urlpatterns as main_patterns
ALL_VERSIONS_RE = '(?P<version>.+)'
urlpatterns = patterns(
'', # base view, flake8 complains if it is on the previous line.
url('^$',
'djangome.views.redirect_home',
{'version': 'latest'}),
... | phalcon/readthedocs.org | readthedocs/core/djangome_urls.py | Python | mit | 821 | 0.014616 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
project = Table('project', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('name', String(length=255)),
)
project_association = Table('project_associatio... | itJunky/web-tasker.py | db_repository/versions/026_migration.py | Python | gpl-2.0 | 1,017 | 0.001967 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
"""
This module provides affiliations of the current user
"""
import logging
import traceback
from myuw.dao import log_err
from myuw.dao.exceptions import IndeterminateCampusException
from myuw.dao.enrollment import (
get_main_... | uw-it-aca/myuw | myuw/dao/affiliation.py | Python | apache-2.0 | 7,365 | 0 |
from __future__ import division, absolute_import, print_function
import os
from distutils.msvc9compiler import MSVCCompiler as _MSVCCompiler
from .system_info import platform_bits
def _merge(old, new):
"""Concatenate two environment paths avoiding repeats.
Here `old` is the environment string before the ba... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/numpy/distutils/msvc9compiler.py | Python | mit | 2,258 | 0.000443 |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 10 22:48:20 2016
@author: k nityan suman
"""
n, k = input().strip().split(' ')
n, k = [int(n), int(k)]
x = [int(x_temp) for x_temp in input().strip().split(' ')]
x.sort()
# print(x)
dist = x[-1] - x[0]
# print(dist
k = 2*k
# maximum number of transisto... | nityansuman/Hack-Code | transistor_and_the_house.py | Python | mit | 354 | 0 |
from __future__ import absolute_import
from django import template
from django.utils.unittest import TestCase
from .templatetags import custom
class CustomFilterTests(TestCase):
def test_filter(self):
t = template.Template("{% load custom %}{{ string|trim:5 }}")
self.assertEqual(
t.r... | LethusTI/supportcenter | vendor/django/tests/regressiontests/templates/custom.py | Python | gpl-3.0 | 24,013 | 0.010453 |
"""
This is a simple script that verifies several ways of accessing numpy arrays
and ensures that their memory is properly cleaned.
"""
import pytest
from .addons import using
import numpy as np
import psi4
pytestmark = pytest.mark.quick
# If it's too small, something odd happens with the memory manager
mat_size =... | ashutoshvt/psi4 | tests/pytests/test_np_views.py | Python | lgpl-3.0 | 2,472 | 0 |
import re, sys, os
from subprocess import *
QT_IMPORT = {re.compile(r"\bfrom qt import\b"):"from PyQt4.Qt import",
re.compile(r"\bfrom qttable import\b"):"#from qttable import",
re.compile(r"\bfrom qtcanvas import\b"):"#from qtcanvas import"}
QT_CLS = {re.compile(r"\bQCanvasText\b"):"QGraphicsSimpleTextItem... | jingriver/stocktracker | pytoolkit/regular_expression/pyqt3to4.py | Python | mit | 4,237 | 0.032334 |
# -*- coding: utf-8 -*-
from bdchecker.api import NewDatabaseTaskChecker
from bdcheckerapp.autograding.zaj5.unit5.utils import Zaj5TaskChecker, UserList
class TaskChecker(NewDatabaseTaskChecker):
display_stdout = True
class TestSuite(Zaj5TaskChecker):
def test_has_procedure(self):
self.... | jbzdak/data-base-checker | bdcheckerapp/autograding/zaj5/unit5/task3.py | Python | gpl-3.0 | 1,459 | 0.004838 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import unittest
from telemetry.story import shared_state
from telemetry import user_story
from telemetry.user_story import user_story_set
from tel... | guorendong/iridium-browser-ubuntu | tools/telemetry/telemetry/user_story/user_story_set_unittest.py | Python | bsd-3-clause | 2,649 | 0.004908 |
import sys
import numpy as np
import os
import pandas as pd
from sklearn import preprocessing
import re
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import TfidfVectorizer
f... | gtesei/fast-furious | competitions/jigsaw-toxic-comment-classification-challenge/eda.py | Python | mit | 11,538 | 0.012307 |
"""This module provides utility classes and functions to load spike sorting
data sets."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import os
import os.path
import re
from collections import ... | klusta-team/kwiklib | kwiklib/dataio/loader.py | Python | bsd-3-clause | 17,513 | 0.00217 |
import re
import settings
from analyzer import Analyzer
class ShowAnalyzer(Analyzer):
patterns_and_values = [
(r'.*season[\s_\-\.](\d{1,2}).*', 60, ('season', None)),
(r'.*season(\d{1,2}).*', 60, ('season', None)),
(r'.*s(\d{1,2})[ex](\d{1,2}).*', 80, ('season', 'episode')), # ____s01e... | joelbitar/rfinder | analyzer/show.py | Python | lgpl-3.0 | 4,016 | 0.005976 |
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__),
os.pardir, os.pardir, os.pardir, 'tools', 'telemetry')... | patrickm/chromium.src | content/test/gpu/run_gpu_test.py | Python | bsd-3-clause | 416 | 0.007212 |
# (c) Fastly, inc 2016
# (c) 2017 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
DOCUMENTATION = """
callback: selective
callback_type: stdout
requirements:... | alxgu/ansible | lib/ansible/plugins/callback/selective.py | Python | gpl-3.0 | 10,438 | 0.002491 |
# Copyright 2018 Flight Lab authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | google/flight-lab | controller/utils/display.py | Python | apache-2.0 | 3,167 | 0.003158 |
""" Tests for imageio's pillow plugin
"""
from pathlib import Path
from imageio.core.request import Request
import os
import io
import pytest
import numpy as np
from PIL import Image, ImageSequence
import imageio as iio
from imageio.core.v3_plugin_api import PluginV3
from imageio.plugins.pillow import PillowPlugin
f... | imageio/imageio | tests/test_pillow.py | Python | bsd-2-clause | 19,210 | 0.000729 |
# Copyright 2017 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | deepmind/dm_control | dm_control/suite/reacher.py | Python | apache-2.0 | 4,233 | 0.004725 |
# ------------------------------------------------------------------------
# Copyright 2015 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... | iotk/iochibity-java | site_scons/iotivityconfig/compiler/configuration.py | Python | epl-1.0 | 6,546 | 0.000458 |
# -*- 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... | iw3hxn/LibrERP | dt_price_security/models/product.py | Python | agpl-3.0 | 3,879 | 0.005414 |
import logging
from pip._internal.build_env import BuildEnvironment
from pip._internal.distributions.base import AbstractDistribution
from pip._internal.exceptions import InstallationError
from pip._internal.utils.subprocess import runner_with_spinner_message
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
... | nataddrho/DigiCue-USB | Python3/src/venv/Lib/site-packages/pip/_internal/distributions/sdist.py | Python | mit | 4,077 | 0 |
# Author: legend
# Mail: legendlee1314@gmail.com
# File: hdfs2mongo_distributed.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup as bs
from bson.json_util import loads
from pymongo import MongoClient as mc
import pymongo
import pydoop.hdfs as hdfs
import zmq
import hashlib
import os
import ... | legendlee1314/ooni | hdfs2mongo_distributed.py | Python | mit | 3,868 | 0.002844 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.