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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 *-*
import getopt
import sys
import spo_rev
def main(argv):
try:
opts, args = getopt.getopt(argv, 'hl:u:e:c:', ['help', 'uri=', 'log_type=', 'error=', 'folder='])
except getopt.GetoptError:
usage()
sys.exit()
# Valores predeterminados
log_type = 1
er... | r3v1/Spotify-tracks-dl | src/main.py | Python | gpl-3.0 | 1,550 |
import os
import sys
from .core import *
from metatools.apps.runtime import initialize, poll_event_loop, run_event_loop
def main_bundle():
logfile = open('/tmp/%s.log' % __name__, 'a')
logfile.write('==========\n')
class Tee(object):
def __init__(self, fhs):
self.fhs = fhs
... | westernx/uitools | uitools/notifications/_main.py | Python | bsd-3-clause | 2,007 |
# standard library
from importlib import import_module
import os
import shutil
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
# utils
from inflection import camelize
from inflection import pluralize
from inflection import singularize
from inflection i... | magnet-cl/django-project-template-py3 | base/management/commands/startapp.py | Python | mit | 3,627 |
# -*- coding: utf-8 -*-
"""
ptime.format
~~~~~~~~~~~~
:copyright: (c) 2013 by Marat Ibadinov.
:license: MIT, see LICENSE for more details.
"""
import re
class FormatError(Exception):
pass
class Format(object):
TEMPLATES = {
# day #
'd': (r'\d{2}', 'day')... | Ibadinov/ptime | ptime/format.py | Python | mit | 4,245 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | zackmdavis/swift | test/unit/account/test_server.py | Python | apache-2.0 | 94,681 |
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from modeltranslation.translator import translator, TranslationOptions
from .models import Document
class DocumentTranslationOptions(TranslationOptions):
fields = ('title', 'text')
translator.register(Document, DocumentTranslationOptions)... | foobacca/django-multilingual-search | tests/testproject/translation.py | Python | mit | 321 |
import sys
import numpy
from collections import defaultdict
contigs = []
genes = {}
introns = {}
confs = {}
strands = {}
with open(sys.argv[1], "r") as f:
previous_end = 0
previous_strand = -1
previous_contig = ""
for line in f:
if line.startswith("#"):
previous_end = 0
previous_strand = 0
if not line.st... | alexcritschristoph/CircHMP | classifier/calculate_training_metrics.py | Python | gpl-2.0 | 1,691 |
"""Module containing index utilities"""
import struct
import tempfile
import os
from functools import wraps
from git.compat import is_win
__all__ = ('TemporaryFileSwap', 'post_clear_cache', 'default_index', 'git_working_dir')
#{ Aliases
pack = struct.pack
unpack = struct.unpack
#} END aliases
class TemporaryFile... | expobrain/GitPython | git/index/util.py | Python | bsd-3-clause | 2,887 |
#!/usr/bin/env python
"""Test for the flow state class."""
from grr.lib import rdfvalue
from grr.lib import test_lib
from grr.lib.rdfvalues import flows
from grr.lib.rdfvalues import test_base
class FlowStateTest(test_base.RDFValueTestCase):
rdfvalue_class = rdfvalue.FlowState
def GenerateSample(self, number... | spnow/grr | lib/rdfvalues/flows_test.py | Python | apache-2.0 | 2,307 |
"""Graphical time series visualizer and analyzer."""
__version__ = '2021.08.08'
__all__ = [
'algorithms',
'dialogs',
'exporter',
'legend',
'mainui',
'puplot',
'tsplot',
'utils',
'types',
'ui',
'transformations',
]
| jaj42/dyngraph | graphysio/__init__.py | Python | isc | 260 |
from unittest import TestCase
from diycrate.cache_utils import redis_key
class CacheUtilTests(TestCase):
def test_redis_key(self):
self.assertTrue(redis_key("hello").startswith("diy_crate.version."))
| jheld/diycrate | tests/test.py | Python | mit | 215 |
from __main__ import vtk, qt, ctk, slicer
import string
import numpy
import math
import operator
import collections
from functools import reduce
class MorphologyStatistics:
def __init__(self, labelNodeSpacing, matrixSA, matrixSACoordinates, matrixSAValues, allKeys):
self.morphologyStatistics = collections... | acil-bwh/SlicerCIP | Scripted/CIP_LesionModel/FeatureExtractionLib/MorphologyStatistics.py | Python | bsd-3-clause | 7,867 |
from ...types import serializable
from ...util import none_or
from ..errors import MalformedXML
from .redirect import Redirect
from .revision import Revision
class Page(serializable.Type):
"""
Page meta data and a :class:`~mw.xml_dump.Revision` iterator. Instances of
this class can be called as iterators... | makoshark/Mediawiki-Utilities | mw/xml_dump/iteration/page.py | Python | mit | 3,501 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pickle
import itertools as it
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.cross_validation import train_test_split, KFold
from sklearn.metrics import confusion_matrix
from score import calc_sco... | RomainSabathe/kaggle_airbnb2015 | Code/lab.py | Python | mit | 10,237 |
from PyQt4 import QtGui
from utils import *
import pyqtgraph as pqg
import numpy as np
from colorButton import ColorButton
import traceitem
class ImageItem():
def __init__(self, imageTab):
self.imageTab = imageTab
self.sliceTable = None
self.name = None
self.sliceParams = {}
... | bencorbett90/Graph | graph/imageitem.py | Python | gpl-2.0 | 22,662 |
"""Implicit module which returns token-expiry time from Flask-security."""
from flask_security import views
from werkzeug.datastructures import MultiDict
from flask import jsonify, after_this_request
from flask_security.utils import login_user
def _render_json(app,
form,
include_us... | nitred/no_imagination | server/flask_app/app_utils/token_login.py | Python | mit | 1,717 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
"""
Utilities for streaming from several file-like data storages: S3 / HDFS / standard
filesystem / compressed files..., us... | duyet-website/api.duyet.net | lib/smart_open/smart_open_lib.py | Python | mit | 36,873 |
"""
Support for Harmony Hub devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/remote.harmony/
"""
import logging
import asyncio
from os import path
import time
import voluptuous as vol
import homeassistant.components.remote as remote
import homea... | ewandor/home-assistant | homeassistant/components/remote/harmony.py | Python | apache-2.0 | 7,993 |
# -*- coding: utf-8 -*-
#
# test_mpitests.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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, ... | stinebuu/nest-simulator | pynest/nest/tests/test_mpitests.py | Python | gpl-2.0 | 2,193 |
# -*- coding: utf-8 -*-
"""
Installs and configures Ceilometer
"""
import logging
import os
import uuid
from packstack.installer import utils
from packstack.installer import validators
from packstack.installer import processors
from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginutils impor... | fr34k8/packstack | packstack/plugins/ceilometer_800.py | Python | apache-2.0 | 5,396 |
"""Access control role."""
from balrog import exceptions
class Role(object):
"""Role, a set of permissions that identity can have access to."""
def __init__(self, name, permissions):
"""Create a role.
:param name: Unique role name within one policy.
:param permissions: Permissions ... | paylogic/balrog | balrog/role.py | Python | mit | 1,849 |
from decimal import Decimal as D
from datetime import datetime
from django.db import models
from django.db.models.signals import post_delete, post_save
from south.modelsinspector import add_introspection_rules
from cc.ripple import PRECISION, SCALE
from cc.general.util import cache_on_object
OVERALL_BALANCE_SQL = "... | rfugger/villagescc | cc/account/models.py | Python | agpl-3.0 | 6,949 |
from django import forms
from django_measurement.forms import MeasurementField
from tests.custom_measure_base import DegreePerTime, Temperature, Time
from tests.models import MeasurementTestModel
class MeasurementTestForm(forms.ModelForm):
class Meta:
model = MeasurementTestModel
exclude = []
c... | coddingtonbear/django-measurement | tests/forms.py | Python | mit | 556 |
"""
sphinx.builders.latex
~~~~~~~~~~~~~~~~~~~~~
LaTeX builder.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import warnings
from os import path
from typing import Any, Dict, Iterable, List, Tuple, Union
from docutils.front... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/sphinx/builders/latex/__init__.py | Python | apache-2.0 | 24,543 |
from holmium.core import (
Page, Element, Locators, Elements, ElementMap, Section, Sections
)
from holmium.core.cucumber import init_steps
init_steps()
class TestSection(Section):
el = Element(Locators.NAME, "el")
els = Elements(Locators.NAME, "els")
elmap = ElementMap(Locators.NAME, "elmap")
class ... | alisaifee/holmium.core | tests/support/cucumber/steps.py | Python | mit | 823 |
import bisect
import json
import progress
import zoning
def calculate_stream_size(stream):
old_pos = stream.tell()
stream.seek(0, 2)
size = f.tell()
stream.seek(old_pos, 0)
return size
class NullFeatures(object):
def __init__(self, map1_len, map2_len):
self._mapping = map1_len * map2_l... | ESultanik/ZoningMaps | intersect_maps.py | Python | gpl-3.0 | 10,096 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-11-13 22:02:21
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-11-13 22:02:57
from django.conf import settings
from django.template.loader import render_to_string
def analytics(request):
return { 'analytics_code':... | cmu-db/db-webcrawler | library/context_processors.py | Python | apache-2.0 | 426 |
# Safe Eyes is a utility to remind you to take break frequently
# to protect your eyes from eye strain.
# Copyright (C) 2017 Gobinath
# 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 ve... | bayuah/SafeEyes | safeeyes/plugins/notification/plugin.py | Python | gpl-3.0 | 2,488 |
import io
from struct import Struct
from unittest import TestCase
from mcflint import nbt
def create_parser(data):
return nbt.NBTParser(io.BytesIO(data))
class TestParser(TestCase):
def test_readers(self):
parser = create_parser(b'')
self.assertEqual(len(parser.readers),
... | fizzy81/mcflint | tests/testnbt.py | Python | mit | 18,245 |
from ctypes import *
import os
import sys
import unittest
import test.support
from ctypes.util import find_library
libc_name = None
def setUpModule():
global libc_name
if os.name == "nt":
libc_name = find_library("c")
elif sys.platform == "cygwin":
libc_name = "cygwin1.dll"
else:
... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.6.0/Lib/ctypes/test/test_loading.py | Python | mit | 4,202 |
import sys
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-i", "--InputTaxaFile",
action="store", dest="Taxa_File", help="File containing taxa seen in the tree (Long names)")
parser.add_option("-o", "--OutputTaxaFile",
action="store", dest="Output_Taxa_File", help="File to save ne... | belandbioinfo/GroundControl | Scripts/change_taxa_names.py | Python | gpl-2.0 | 3,065 |
import os
MR_BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.." ))
MR_CMAPPER_PATH = os.path.join(MR_BASE_PATH, "cmapper" )
MR_MRCAP_PATH = os.path.join(MR_BASE_PATH, "mrcap" )
os.sys.path += [ MR_BASE_PATH, MR_CMAPPER_PATH, MR_MRCAP_PATH ]
| openconnectome/m2g | MR-OCP/MROCPdjango/pipeline/utils/__init__.py | Python | apache-2.0 | 271 |
#!/user/bin/python
'''
This script uses SimpleCV to grab an image from the camera and numpy to find an infrared LED and report its position relative to the camera view centre and whether it is inside the target area.
Attempted stabilisation of the output by tracking a circular object instead and altering exposure of t... | dotCID/Graduation | Robot code/Sensors/simpleCV_3.py | Python | gpl-2.0 | 4,363 |
"""
RPyC connection factories: ease the creation of a connection for the common
cases)
"""
import socket
import threading
try:
from thread import interrupt_main
except ImportError:
try:
from _thread import interrupt_main
except ImportError:
# assume jython (#83)
from java.lang impo... | sovaa/backdoorme | rpyc/utils/factory.py | Python | mit | 11,382 |
#!/usr/bin/env python
from netmiko import ConnectHandler
from getpass import getpass
password = '88newclass'
pynet1 = {
'device_type': 'cisco_ios',
'ip': '184.105.247.70',
'username': 'pyclass',
'password': password,
'port': 22
}
pynet2 = {
'device_type': 'cisco_ios',
'ip': '184.105.247.71',
'username': '... | gerards/pynet_network_automation_course | week4/q5_netmiko.py | Python | apache-2.0 | 737 |
"""
Implement python 3.8+ bytecode analysis
"""
from pprint import pformat
import logging
from collections import namedtuple, defaultdict, deque
from functools import total_ordering
from numba.core.utils import UniqueDict, PYVERSION
from numba.core.controlflow import NEW_BLOCKERS, CFGraph
from numba.core.ir import Lo... | sklam/numba | numba/core/byteflow.py | Python | bsd-2-clause | 42,923 |
# 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 writing, software
# distributed under t... | dhermes/bezier | scripts/report_lcov.py | Python | apache-2.0 | 1,983 |
#! /usr/bin/env python
# encoding: utf-8
# DC 2008
# Thomas Nagy 2010 (ita)
import re
from waflib import Utils
from waflib.Tools import fc, fc_config, fc_scan
from waflib.Configure import conf
@conf
def find_ifort(conf):
fc = conf.find_program('ifort', var='FC')
fc = conf.cmd_to_list(fc)
conf.get_ifort_version(fc)... | Gnomescroll/Gnomescroll | server/waflib/Tools/ifort.py | Python | gpl-3.0 | 1,244 |
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
from Components.ActionMap import ActionMap, NumberActionMap
from Components.Sources.List import List
from Components.Sources.StaticText import StaticText
from Components.config import config, configfile,... | popazerty/openblackhole-SH4 | lib/python/Screens/OScamInfo.py | Python | gpl-2.0 | 40,341 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2015 Glencoe Software, Inc. All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
# 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... | simleo/openmicroscopy | components/tools/OmeroPy/test/unit/test_jvmcfg.py | Python | gpl-2.0 | 7,583 |
#!/usr/bin/python
# Author: Anthony Ruhier
class ArtistNotFoundException(Exception):
pass
| Anthony25/mpd_muspy | mpd_muspy/exceptions.py | Python | bsd-2-clause | 96 |
# -*- coding: utf-8 -*-
import unittest
import re
from StringIO import StringIO
from django.core.management import call_command
from django.db import models
from django.test import TestCase
from freezegun import freeze_time
from mock import Mock
from .forms import OrderDetailsForm
from .middleware import CartMiddlewa... | eliasson/boutique | boutique/checkout/tests.py | Python | gpl-2.0 | 6,380 |
import re
text = u'Français złoty Österreich'
pattern = r'\w+'
ascii_pattern = re.compile(pattern, re.ASCII)
unicode_pattern = re.compile(pattern)
print('Text :', text)
print('Pattern :', pattern)
print('ASCII :', list(ascii_pattern.findall(text)))
print('Unicode :', list(unicode_pattern.findall(text)))
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_text/re_flags_ascii.py | Python | apache-2.0 | 315 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
import os
import platform
import sys
import py_utils
def GetOSAndArchForCurrentDesktopPlatform():
os_name = GetOSN... | catapult-project/catapult | common/py_utils/py_utils/dependency_util.py | Python | bsd-3-clause | 1,383 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **Ftp Client for Retrieving ftp data.**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as publi... | opengeogroep/inasafe | realtime/download_netcdf.py | Python | gpl-3.0 | 4,113 |
import righteous
from ConfigParser import SafeConfigParser
from ..compat import unittest
class RighteousIntegrationTestCase(unittest.TestCase):
def setUp(self):
config = SafeConfigParser()
config.read('righteous.config')
if not config.has_section('auth'):
raise Exception('Plea... | michaeljoseph/righteous | tests/integration/base.py | Python | unlicense | 954 |
#
# IIT Kharagpur - Hall Management System
# System to manage Halls of residences, Warden grant requests, student complaints
# hall worker attendances and salary payments
#
# MIT License
#
"""
@ authors: Madhav Datt, Avikalp Srivastava
"""
import ctypes
import mysql.connector
import time
from mysql.connector import e... | madhav-datt/kgp-hms | src/database/db_func.py | Python | mit | 9,569 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
import os
from django.core.management.base import BaseCommand
from django.core.management import call_command
from o... | yeleman/snisi | snisi_core/management/commands/i18n.py | Python | mit | 1,910 |
class Solution(object):
def findMaxForm(self, strs, m, n):
"""
:type strs: List[str]
:type m: int
:type n: int
:rtype: int
"""
L = len(strs)
count1 = [0] * L
count0 = [0] * L
for i, s in enumerate(strs):
count0[i] = s.count('0')
count1[i] = s.count('1')
memo = [
[
[0 if i == 0 else ... | xiaonanln/myleetcode-python | src/474. Ones and Zeroes.py | Python | apache-2.0 | 790 |
#===islucyplugin===
# -*- coding: utf-8 -*-
# Lucy's Plugin
# presence_plugin.py
# Initial Copyright © 2002-2005 Mike Mintz <mikemintz@gmail.com>
# Modifications Copyright © 2007 Als <Als@exploit.in>
# Modifications Copyright © 2007 dimichxp <dimichxp@gmail.com>
# This program is free software; you can redistr... | XtremeTeam/Lucy-bot | brain/plugins/presence.py | Python | gpl-2.0 | 3,227 |
'''
Created on 24 Feb 2015
@author: oche
'''
from __future__ import unicode_literals
from __future__ import division
import argparse
import os
import sys
import time
import re
import logging
import json
import numpy
from plotter import makeSubPlot
from os.path import expanduser
from util import validURLMatch, validYo... | oche-jay/vEQ-benchmark | vEQ_benchmark.py | Python | gpl-2.0 | 13,919 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of a weboob module.
#
# This weboob module 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 Lice... | laurentb/weboob | modules/supertoinette/test.py | Python | lgpl-3.0 | 1,186 |
from django.core.management.base import BaseCommand
from django_town.oauth2.models import Client
from django_town.core.settings import OAUTH2_SETTINGS
class Command(BaseCommand):
def handle(self, *args, **options):
Client.objects.all().update(available_scope=OAUTH2_SETTINGS.default_scope)
print Cl... | uptown/django-town | django_town/oauth2/management/commands/update_default_scope.py | Python | mit | 452 |
from distutils.core import setup
# Convert README.md to long description
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
long_description = long_description.replace("\r", "") # YOU NEED THIS LINE
except (ImportError, OSError, IOError):
print("Pandoc not found. Long_descrip... | JustinLovinger/optimal | setup.py | Python | mit | 1,310 |
# Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | aatchison/mycroft-core | test/unittests/audio/services/working/__init__.py | Python | apache-2.0 | 1,071 |
# -*- coding: utf-8 -*-
#
# 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
... | Svjard/presto-admin | prestoadmin/prestoclient.py | Python | apache-2.0 | 6,210 |
from syscore.objects import missing_data
from dataclasses import dataclass
import datetime as datetime
from copy import copy
import pandas as pd
from sysinit.futures.build_multiple_prices_from_raw_data import (
create_multiple_price_stack_from_raw_data,
)
from sysobjects.dict_of_named_futures_per_contract_prices i... | robcarver17/pysystemtrade | sysobjects/multiple_prices.py | Python | gpl-3.0 | 9,287 |
# 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.
"""Helper functions for the layout test analyzer."""
from datetime import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text i... | ropik/chromium | media/tools/layout_tests/layouttest_analyzer_helpers.py | Python | bsd-3-clause | 22,667 |
# -*-coding: utf-8 -*-
import colander
from . import (
SelectInteger,
ResourceSchema,
BaseSearchForm,
)
from ..models.service import Service
from ..lib.qb.invoices_items import InvoicesItemsQueryBuilder
class _InvoiceItemSchema(ResourceSchema):
service_id = colander.SchemaNode(
SelectInteger... | mazvv/travelcrm | travelcrm/forms/invoices_items.py | Python | gpl-3.0 | 723 |
#!/usr/bin/env python
"""Celery Py.
Python wrappers for FarmBot Celery Script JSON nodes.
"""
import os
import json
from functools import wraps
import requests
def farmware_api_url():
"""Return the correct Farmware API URL according to FarmBot OS version."""
major_version = int(os.getenv('FARMBOT_OS_VERSION'... | FBTUG/DevZone | ai/demoCamera/plant_detection/CeleryPy.py | Python | mit | 10,249 |
#!/usr/bin/python
#
# Copyright 2015 Google 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 b... | coxmediagroup/googleads-python-lib | examples/dfp/v201505/user_team_association_service/update_user_team_associations.py | Python | apache-2.0 | 3,194 |
class EmptyAVL( Exception ):
pass
class AlreadyExists(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class AVL:
def __init__(self):
self.number = 0
self.root = None
def __setitem__(self, key, item):
self.add( AVLNode(key, item) )
def hight(se... | athena-project/Artemis | src/AVL.py | Python | gpl-2.0 | 5,933 |
#coding:utf-8
__author__ = 'Administrator'
import threading
import socket,re
routers=[]
lock=threading.Lock()
def search_routers():
local_ips=socket.gethostbyname_ex(socket.gethostname())[2]
all_threads=[]
for ip in local_ips:
for i in xrange(1,255):
array=ip.split(".")
arr... | simplelist/python_test01 | ke_qq_com/scanPort.py | Python | lgpl-3.0 | 1,061 |
import sys,math,subprocess,numpy,pickle,os
import multiprocessing,multiprocessing.pool
import matplotlib,matplotlib.pyplot
def coverageComputer(tube):
'''
this function calls samtools to perform coverage calculation, reads the obtained files, computes the median and returns a single array of values according ... | adelomana/cassandra | sequenceAnalysis/coverage/geneCoverageCalculator.py | Python | gpl-3.0 | 7,762 |
# -*- coding: utf-8 -*-
# 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... | mahak/packstack | packstack/plugins/puppet_950.py | Python | apache-2.0 | 11,863 |
#!/usr/bin/env python3
import sys
try:
import __builtin__
except ImportError:
import builtins as __builtin__
import os
# python puts the program's directory path in sys.path[0]. In other words, the user ordinarily has no way
# to override python's choice of a module from its own dir. We want to have that a... | openbmc/openbmc-test-automation | bin/validate_plug_ins.py | Python | apache-2.0 | 3,734 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib.request
import chardet
import sys
import codecs
from html.parser import HTMLParser
lentaUrl = 'http://lenta.ru/'
starTag = 'b-yellow-box__header bordered-title'
endTag = 'b-sidebar-sticky'
newsTag = 'a'
classTag = 'class'
separator = '-----------------------... | maxter2323/Python-Small-Examples | lenta.py | Python | mit | 2,026 |
#!/usr/bin/env python
# _*_ coding:utf-8 _*-_
############################
# File Name: demo.py
# Author: lza
# Created Time: 2016-08-31 11:36:08
############################
import difflib
import sys
try:
file1 = sys.argv[1]
file2 = sys.argv[2]
except Exception as e:
print "Error:"+ str(e)
print "Usage... | zhengjue/mytornado | study/2/difflib/demo2.py | Python | gpl-3.0 | 925 |
from dateutil import parser
from pynwm.hydroshare import hs_list
def test_no_date():
'''Should return empty string.'''
no_dates = [None, '']
expected = ''
for date in no_dates:
returned = hs_list._date_to_start_date_arg(date)
assert expected == returned
def test_date_obj():
'''... | twhiteaker/pynwm | src/pynwm/test/test_pynwm/test_hydroshare/test_hs_list_date_to_start_date_arg.py | Python | mit | 829 |
import sys
import os
import re
import string
import imp
from tkinter import *
import tkinter.simpledialog as tkSimpleDialog
import tkinter.messagebox as tkMessageBox
import traceback
import webbrowser
from idlelib.MultiCall import MultiCallCreator
from idlelib import idlever
from idlelib import WindowList
from idlelib... | LaoZhongGu/kbengine | kbe/src/lib/python/Lib/idlelib/EditorWindow.py | Python | lgpl-3.0 | 65,343 |
# types.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Compatibility namespace for sqlalchemy.sql.types.
"""
__all__ = [
"TypeEngine",
... | graingert/sqlalchemy | lib/sqlalchemy/types.py | Python | mit | 3,322 |
from ansible.plugins.callback import CallbackBase
class PlaybookCallback(CallbackBase):
"""Playbook callback"""
def __init__(self):
super(PlaybookCallback, self).__init__()
# store all results
self.results = []
def v2_runner_on_ok(self, result):
"""Save ok result"""
... | agharibi/linchpin | linchpin/api/callbacks.py | Python | gpl-3.0 | 480 |
from mock import MagicMock
import mock
from django.test import override_settings
from tests.utilities.utils import SafeTestCase
from tests.utilities.ldap import get_ldap_user_defaults
from accounts.models import (
User,
AccountRequest,
Intent
)
from projects.models import Project
from projects.receivers im... | ResearchComputing/RCAMP | rcamp/tests/test_projects_receivers.py | Python | mit | 4,732 |
from . import product_config
from . import product_attribute
from . import product
| pledra/odoo-product-configurator | product_configurator/models/__init__.py | Python | agpl-3.0 | 83 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RDeoptim(RPackage):
"""Implements the differential evolution algorithm for global optimiz... | rspavel/spack | var/spack/repos/builtin/packages/r-deoptim/package.py | Python | lgpl-2.1 | 800 |
"""
Tests for Discussion API serializers
"""
import itertools
from urlparse import urlparse
import ddt
import httpretty
import mock
from nose.plugins.attrib import attr
from django.test.client import RequestFactory
from discussion_api.serializers import CommentSerializer, ThreadSerializer, get_context
from discussio... | longmen21/edx-platform | lms/djangoapps/discussion_api/tests/test_serializers.py | Python | agpl-3.0 | 34,969 |
# Copyright (C) 2013 Oskar Maier
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | lfrdm/medpy | medpy/itkvtk/utilities/itku.py | Python | gpl-3.0 | 13,196 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - group access via various backends.
The composite_groups is a backend that does not have direct storage,
but composes other backends to a new one, so group definitions are
retrieved from several backends. This allows to mix different
backends.
@copyright: 2009 Dmitr... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/datastruct/backends/composite_groups.py | Python | mit | 2,200 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("AdaBoostClassifier" , "BreastCancer" , "db2")
| antoinecarme/sklearn2sql_heroku | tests/classification/BreastCancer/ws_BreastCancer_AdaBoostClassifier_db2_code_gen.py | Python | bsd-3-clause | 143 |
# -*- coding: utf-8 -*-
"""Objects representing MediaWiki families."""
#
# (C) Pywikibot team, 2004-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id$'
#
import sys
import logging
import re
import collections
import imp
import string
import warnings... | trishnaguha/pywikibot-core | pywikibot/family.py | Python | mit | 64,378 |
# -*- coding: utf-8 -*-
"""Setup/installation tests for this package."""
from ade25.assetmanager.testing import IntegrationTestCase
from plone import api
class TestInstall(IntegrationTestCase):
"""Test installation of ade25.assetmanager into Plone."""
def setUp(self):
"""Custom shared utility setup ... | ade25/ade25.assetmanager | ade25/assetmanager/tests/test_setup.py | Python | mit | 1,209 |
from stagecraft.apps.datasets.models import DataGroup, DataSet, DataType
from django.test import TestCase
from stagecraft.libs.mass_update import DataSetMassUpdate
from nose.tools import assert_equal
class TestDataSetMassUpdate(TestCase):
@classmethod
def setUpClass(cls):
cls.data_group1 = DataGroup.... | alphagov/stagecraft | stagecraft/libs/mass_update/test_data_set_mass_update.py | Python | mit | 3,422 |
#!/usr/bin/env python
import glob
import os
import shlex
import sys
script_dir = os.path.dirname(__file__)
node_root = os.path.normpath(os.path.join(script_dir, os.pardir))
sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
import gyp
# Directory within which we want all generated files (including... | dreamllq/node | tools/gyp_node.py | Python | apache-2.0 | 1,983 |
# Copyright 2021 The Google Earth Engine Community 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... | google/earthengine-community | samples/python/apidocs/ee_dictionary_aside.py | Python | apache-2.0 | 1,056 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convenient utility functions for exercises in Chapter 5 of Kane 1985."""
from __future__ import division
from sympy import Dummy, Matrix
from sympy import diff, expand, expand_trig, integrate, solve, symbols
from sympy import trigsimp
from sympy.physics.mechanics import... | skidzo/pydy | examples/Kane1985/Chapter5/util.py | Python | bsd-3-clause | 17,109 |
# Authors:
# Petr Viktorin <pviktori@redhat.com>
#
# Copyright (C) 2014 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ... | pspacek/freeipa | ipatests/pytest_plugins/declarative.py | Python | gpl-3.0 | 1,823 |
#! /usr/bin/env python
#
# IM - Infrastructure Manager
# Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
#
# 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 3 of t... | indigo-dc/im | test/unit/Tosca.py | Python | gpl-3.0 | 9,301 |
"""
|▛▀▜|▙▄▟|▗▄▖|▝▀▘|
⌮⌬
○◉□▣◔◑◕●♾⚝☺☹✨✩❄❅❆✾⚛✗✓✔✘
"""
# import sys
from .termapp import TermApp
class Turtle:
dx = [1, 0, -1, 0]
dy = [0, -1, 0, 1]
def __init__(self, x, y, d):
self.jump(x, y, d)
self.stack = []
def turn(self, r):
self.d = (self.d + r) % 4
def move(self... | NLeSC/noodles | noodles/display/lines.py | Python | apache-2.0 | 3,855 |
import sys
# Set default encoding to UTF-8
reload(sys)
# noinspection PyUnresolvedReferences
sys.setdefaultencoding('utf-8')
import base64
import time
import json
import httplib
import traceback
import click
from flask import Flask, request, render_template, url_for, redirect, g
from flask.ext.cache import Cache
from... | tanglu-org/tgl-realms | realms/__init__.py | Python | gpl-2.0 | 9,484 |
# -*- coding: utf-8 -*-
import attr
from navmazing import NavigateToAttribute
from widgetastic.widget import View, NoSuchElementException, Text
from widgetastic_manageiq import (
Accordion,
BreadCrumb,
ManageIQTree,
PaginationPane,
SummaryTable,
Table
)
from widgetastic_patternfly import (
... | jkandasa/integration_tests | cfme/storage/manager.py | Python | gpl-2.0 | 6,720 |
from higgsdataset import HiggsDataset
from pylearn2.termination_criteria import EpochCounter
from pylearn2.testing.skip import skip_if_no_data
from pylearn2.config import yaml_parse
with open('mlp.test.yaml', 'r') as f:
train = f.read()
hyper_params = {'train_stop': 50,
'valid_start':51,
... | Corei13/descartes | code/unit.py | Python | mit | 558 |
#!/usr/bin/env python
import sys, os
rep=os.path.dirname(os.path.abspath(__file__))
installDir=os.path.join(rep,'..')
sys.path.insert(0,installDir)
from PyQt4 import QtGui,QtCore,QtSql
from Base.dataBase import Base
def completeDatabase(fichier,table,enregistrement):
maBase=Base(fichier)
maBase.initialis... | FedoraScientific/salome-smesh | src/Tools/Verima/ajoutEnreg.py | Python | lgpl-2.1 | 1,532 |
from django.conf.urls import include, url
from django.contrib.auth import views as auth_views
from django.contrib.auth.forms import AuthenticationForm
from django.views.generic import RedirectView, TemplateView
from .views import CreateAccount, SelectGroup
urlpatterns = [
url(r'^$',
RedirectView.as_view(
... | evonaut/bolzplatz | bolzplatz/users/urls.py | Python | gpl-2.0 | 1,057 |
def smile():
return ":)"
def frown():
return ":("
| muneeb131/test | awesome/__init__.py | Python | gpl-3.0 | 59 |
from sympy import Integer
from sympy.core.compatibility import ordered_iter
from threading import RLock
# it is sufficient to import "pyglet" here once
try:
from pyglet.gl import *
except:
raise ImportError("pyglet is required for plotting.\n visit http://www.pyglet.org/")
from plot_object import PlotObject
... | minrk/sympy | sympy/plotting/plot.py | Python | bsd-3-clause | 12,383 |
# coding=utf-8
# Progetto: Pushetta API
# Indici per il motore di ricerca
from haystack import indexes
from core.models import Channel
'''
class ChannelIndex(indexes.ModelSearchIndex, indexes.Indexable):
class Meta:
model = Channel
def index_queryset(self, using=None):
"""Used when the ent... | guglielmino/pushetta-api-django | pushetta/core/search_indexes.py | Python | gpl-3.0 | 1,175 |
# coding=utf-8
# Copyright 2020 Hugging Face
#
# 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... | huggingface/transformers | src/transformers/utils/notebook.py | Python | apache-2.0 | 14,562 |
# -*- coding: utf-8 -*-
# Copyright (c) 2006 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the QScintilla Calltips configuration page.
"""
from __future__ import unicode_literals
from PyQt5.Qsci import QsciScintilla
from .ConfigurationPageBase import ConfigurationPageBase
from .Ui_Ed... | davy39/eric | Preferences/ConfigurationPages/EditorCalltipsQScintillaPage.py | Python | gpl-3.0 | 2,134 |
"""An OpRegularizer that applies L1 regularization on batch-norm gammas."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from morph_net.framework import generic_regularizers
from morph_net.framework import tpu_util
import tensorflow.compat.v1 as tf
cla... | google-research/morph-net | morph_net/op_regularizers/gamma_l1_regularizer.py | Python | apache-2.0 | 1,168 |
from django.conf.urls import patterns, include, url
from mainview import mainview
urlpatterns = patterns(
'',
url(r'^(?:index|index.html)?$', mainview.index),
url(r'^list/(\d+)$', mainview.list),
url(r'^show/(\d+)$',mainview.show),
url(r'.*',mainview.notfound),
) | marktrue/DjangoProTest | DjangoProTest/mainview/urls.py | Python | gpl-2.0 | 284 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.