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 python
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import pytest
@pytes... | Avira/pootle | tests/fixtures/cache.py | Python | gpl-3.0 | 562 |
#!/usr/bin/env python
# pep8.py - Check Python source code formatting, according to PEP 8
# Copyright (C) 2006-2009 Johann C. Rocholl <johann@rocholl.net>
# Copyright (C) 2009-2013 Florent Xicluna <florent.xicluna@gmail.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this soft... | brianbruggeman/git-hooks | pep8.py | Python | mit | 70,826 |
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/336012
import SimpleHTTPServer
import BaseHTTPServer
import httplib
import os
class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""http request handler with QUIT stopping the server"""
def do_QUIT(self):
"""send 20... | gotcha/Selenium2Library | test/resources/testserver/testserver.py | Python | apache-2.0 | 3,425 |
(S'd07b7bd90a798b2024e1f84c66405c0a'
p1
(ihappydoclib.parseinfo.moduleinfo
ModuleInfo
p2
(dp3
S'_namespaces'
p4
((dp5
(dp6
S'write_array'
p7
(ihappydoclib.parseinfo.functioninfo
FunctionInfo
p8
(dp9
g4
((dp10
(dp11
tp12
sS'_exception_info'
p13
(dp14
sS'_parameter_names'
p15
(S'f'
S'set'
p16
S'item_sep'
p17
S'nest_prefi... | mads-bertelsen/McCode | meta-pkgs/windows/Support/gnuplot-py-1.8/.happydoc.utils.py | Python | gpl-2.0 | 1,337 |
"""
Comments may be attached to any object. See the comment documentation for
more information.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Author(models.Model):
first_name = models.Char... | DanteOnline/free-art | venv/lib/python3.4/site-packages/tests/testapp/models.py | Python | gpl-3.0 | 1,064 |
# coding:utf-8
'''
Created on 2017/12/20.
@author: chk01
'''
from practice_one.Company.load_material.utils import *
org = 'nose'
def get_point_feature():
print('开始{}导入'.format(org))
dir_path = os.listdir('material/cartoon/nose/model')
m = 12
n = 6
X = np.zeros([m, n, 2]) + 999
Y = np.zeros(... | sunyihuan326/DeltaLab | shuwei_fengge/practice_one/Company/download/nose_check.py | Python | mit | 916 |
"""
MMPI - MPI Interface for Python
Copyright (C) 2005 Michael Steder(steder@gmail.com)
This library 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 ... | steder/maroonmpi | lib/request.py | Python | gpl-2.0 | 8,768 |
#Evaluate semantic space against MEN dataset
import sys
import utils
from scipy import stats
import numpy as np
from math import sqrt
#Note: this is scipy's spearman, without tie adjustment
def spearman(x,y):
return stats.spearmanr(x, y)[0]
def readMEN(annotation_file):
pairs=[]
humans=[]
f=open(annotation_f... | minimalparts/Tutorials | FruitFly/MEN.py | Python | mit | 989 |
#!/usr/bin/python
#
# Copyright (c) SAS Institute, 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 la... | sassoftware/mirrorball | scripts/current_buildgroup.py | Python | apache-2.0 | 1,164 |
from . import test_sale_order_mass_action
| OCA/sale-workflow | sale_order_mass_action/tests/__init__.py | Python | agpl-3.0 | 42 |
import json
import jsonschema
from jsonschema import ValidationError
from redash import query_runner
from redash.models import DataSource
def validate_configuration(query_runner_type, configuration_json):
query_runner_class = query_runner.query_runners.get(query_runner_type, None)
if query_runner_class is No... | imsally/redash | old_migrations/0003_update_data_source_config.py | Python | bsd-2-clause | 2,861 |
from thywill_server.component import Component
from thywill_server.settings import THYWILL_CONFIG
class PushComponent(Component):
'''
The parent class for push component definitions.
'''
singleton = None
@staticmethod
def factory():
'''Get the push component object.'''
if not ... | exratione/thywill-python | thywill_server/src/thywill_server/push/push_component.py | Python | mit | 1,998 |
# -*- coding: utf-8 -*-
#
# Monk is an unobtrusive data modeling, manipulation and validation library.
# Copyright © 2011—2015 Andrey Mikhaylenko
#
# This file is part of Monk.
#
# Monk is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License ... | neithere/monk | tests/mongo_tests.py | Python | gpl-3.0 | 9,121 |
# selection sort algorithm
# complexity is O(len(L)^2)
def iterSelectSort(L):
for i in range(len(L) - 1):
minIndex = i
minVal = L[i]
j = i + 1
while j < len(L):
if L[j] < minVal:
minVal = L[j]
minIndex = j
j += 1
temp =... | medifle/python_6.00.1x | defIterSelectSort.py | Python | mit | 392 |
from agagd_core.models import Member
from agagd_core.tables.search import SearchResultsTable
from django.db.models import F, Q
from django.http import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.urls import reverse
from django.views.generic import DetailView
from django_tables... | usgo/agagd | agagd/agagd_core/views/search.py | Python | mit | 1,698 |
import discord
import os
from discord.ext import commands
from collections import defaultdict
from .utils.dataIO import dataIO
from .utils import checks
default = {
"sticky_roles": [],
"to_reapply" : {}
}
class StickyRoles:
"""Reapplies specific roles on join"""
def __init__(self, bot):
sel... | Injabie3/Red-DiscordBot | cogs/stickyroles.py | Python | gpl-3.0 | 4,930 |
# **********************************************************************
#
# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# ***********************************************************... | joshmoore/zeroc-ice | py/test/Ice/servantLocator/TestI.py | Python | gpl-2.0 | 4,959 |
import pytest
from tests.common import DummyPostData
from wtforms import validators
from wtforms.fields import FormField
from wtforms.fields import StringField
from wtforms.form import Form
class AttrDict:
def __init__(self, *args, **kw):
self.__dict__.update(*args, **kw)
class ClassWithProperty(AttrDi... | wtforms/wtforms | tests/fields/test_form.py | Python | bsd-3-clause | 3,172 |
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2014-2022 Mikhail Rachinskiy
from collections.abc import Iterable
from bpy.types import Object
from .. import lib
def offset_simple(self, obs: Iterable[Object]) -> None:
offset = 0
i = 1
for ob in obs:
if ad_offset(self, ob, offset) is F... | mrachinskiy/commotion | op_offset/offset_ad.py | Python | gpl-3.0 | 2,297 |
import os
from src.readers.experimentxmlreader import ExperimentXMLReader
from src.readers.qtreexmlreader import QTreeXMLReader
from src.writer import Writer
RESOURCES_DIR = "/Users/alcemirsantos/Documents/Workspace/prophet-reader/resources"
ANSWERS_DIR = "/Users/alcemirsantos/Dropbox/PhD/activities/experiments/16-FO... | alcemirsantos/prophet-reader | src/main.py | Python | gpl-3.0 | 1,607 |
import logging
from datetime import datetime, timedelta
from healthysnake.levels import HARD
class Dependency:
"""An individual dependency of the system."""
STATE_HEALTHY = 'healthy'
STATE_UNHEALTHY = 'unhealthy'
DEFAULT_INTERVAL = 10
def __init__(self, name, check_func,
inter... | dammitjim/healthysnake | healthysnake/dependency.py | Python | mit | 2,881 |
from rest_framework.renderers import BrowsableAPIRenderer
class BrowsableAPIRendererWithoutForms(BrowsableAPIRenderer):
"""Renders the browsable api, but excludes the forms."""
def get_context(self, *args, **kwargs):
ctx = super().get_context(*args, **kwargs)
ctx["display_edit_forms"] = False... | django-json-api/rest_framework_ember | example/utils.py | Python | bsd-2-clause | 717 |
from tempfile import TemporaryFile
import pytest
from imgpy import Img
@pytest.mark.parametrize('image', ({
'sub': 'anima/bordered.gif',
'angle': 90
}, {
'sub': 'anima/clear.gif',
'angle': 90
}, {
'sub': 'fixed/bordered.jpg',
'angle': 90
}, {
'sub': 'fixed/clear.jpg',
'angle': 90
}, ... | embali/imgpy | tests/test_rotate.py | Python | mit | 649 |
import errno
import socket
from itertools import chain, imap
from redis.exceptions import ConnectionError, ResponseError, InvalidResponse
class PythonParser(object):
def __init__(self):
self._fp = None
def on_connect(self, connection):
"Called when the socket connects"
self._fp = conne... | edisonlz/fruit | web_project/base/site-packages/redis/connection.py | Python | apache-2.0 | 10,439 |
# vim: set encoding=utf-8
# Copyright (c) 2016 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/licenses/LICENSE-2.0
#
# Unless require... | grehx/spark-tk | regression-tests/sparktkregtests/testcases/graph/graph_lbp_test.py | Python | apache-2.0 | 8,856 |
import threading
import requests
import csv
import ujson
import queue
def load_data():
fn = "aa.csv"
res = []
i = 0
count = 100000
tel_set = set()
with open(fn, "r", encoding='utf8') as fh:
cr = csv.reader(fh)
for line in cr:
tel = line[0].strip()
tel_set... | Svolcano/python_exercise | new/modian.py | Python | mit | 1,623 |
#!/usr/bin/env python
#chr13:30215500-30216000 output/rgn_1 1 26.84
#chr13:37798000-37798500 output/rgn_10 2 19.87
import argparse
ap = argparse.ArgumentParser()
ap.add_argument("depth", help="depth table, 4 fields, region dir nContigs targetDepth")
ap.add_argument("--ncontigs", help="number of contig... | yunlongliukm/chm1_scripts | HardStop/FilterDepth.py | Python | mit | 395 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django import forms
from django.forms.models import modelform_... | suutari/shoop | shuup_tests/utils/test_form_group.py | Python | agpl-3.0 | 1,487 |
# -*- coding: utf-8 -*-
# Copyright © 2014-2017 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
#
# 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 ... | tyll/bodhi | bodhi/server/views/metrics.py | Python | gpl-2.0 | 3,279 |
from setuptools import setup, find_packages
from os.path import dirname, join
import phone_iso3166
def readfile(filename):
with open(join(dirname(__file__), filename), 'r') as f:
return f.read()
setup(
name="phone-iso3166",
description="Phonenumber to ISO 3166-1 mapping",
install_requires=[
... | mehulsbhatt/phone-iso3166 | setup.py | Python | mit | 980 |
"""pyzmq does not ship tornado's futures,
this just raises informative NotImplementedErrors to avoid having to change too much code.
"""
class NotImplementedFuture(object):
def __init__(self, *args, **kwargs):
raise NotImplementedError("pyzmq does not ship tornado's Futures, "
"install tornado ... | swn1/pyzmq | zmq/eventloop/minitornado/concurrent.py | Python | bsd-3-clause | 459 |
#!/usr/bin/env python
"""
pitchanalysis.py
--
Christopher Kuech
cjkuech@gmail.com
--
Requires:
Python 2.7
Instructions:
python pitchanalysis.py [wav-file-name]
"""
import matplotlib
from math import log
matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.fig... | chriskuech/wavelab | pitchanalysis.py | Python | mit | 5,174 |
# coding:utf-8
financial_dict = {
# 1.每股指标
'001基本每股收益': 'EPS',
'002扣除非经常性损益每股收益': 'deductEPS',
'003每股未分配利润': 'undistributedProfitPerShare',
'004每股净资产': 'netAssetsPerShare',
'005每股资本公积金': 'capitalReservePerShare',
'006净资产收益率': 'ROE',
'007每股经营现金流量': 'operatingCashFlowPerShare',
# 2. ... | yutiansut/QUANTAXIS | QUANTAXIS/QAData/financial_mean.py | Python | mit | 36,309 |
#
# namcap rules - sfurl
# Copyright (C) 2004-2009 Ben Mazer <ben@benmazer.net>
#
# 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)... | anatol/namcap | Namcap/rules/sfurl.py | Python | gpl-2.0 | 1,348 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | SHH_INV_models/SHH_INV_models_final_output_0.2_-0.1_10000/SHH_INV_models38317.py | Python | gpl-3.0 | 17,570 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2022 F4PGA 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
#
# Unl... | SymbiFlow/prjuray | fuzzers/014-cle-spec/top.py | Python | isc | 1,073 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import (unicode_literals, division, absolute_import,
print_function)
import subprocess, re
from calibre.constants import iswindows, isosx
def get_address_of_d... | hazrpg/calibre | src/calibre/utils/ip_routing.py | Python | gpl-3.0 | 3,044 |
# coding: utf-8
#
# Copyright (c) 2008, Aldo Cortesi <aldo@corte.si>
# Copyright (c) 2011, Andrew Grigorev <andrew@ei-grad.ru>
#
# All rights reserved.
#
# 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 th... | kiniou/qtile | libqtile/confreader.py | Python | mit | 3,436 |
#!/usr/bin/python
######################################################################
# Autor: Andrés Herrera Poyatos
# Universidad de Granada, January, 2015
# Sorting Algorithm: QuickSelect
#######################################################################
# This program read an integer array from a file a e... | andreshp/Algorithms | SelectionAlgorithms/Python/QuickSelect/Classical/QuickSelect.py | Python | gpl-2.0 | 4,821 |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
# Copyright 2012 Google Inc. All Rights Reserved.
"""Test client standard actions."""
import gzip
import hashlib
import os
import time
from grr.client.client_actions import standard
from grr.lib import config_lib
from grr.lib import flags
from grr.lib imp... | spnow/grr | client/client_actions/standard_test.py | Python | apache-2.0 | 9,903 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^', include('ebets.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| pisskidney/dota | dota/urls.py | Python | mit | 222 |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import json
import sys
# Include custom libs
sys.path.append( '../../../include/python' )
import serverutils.config as config
from statistics import mean, median, stdev
import numpy as np
# Default property values
props = {'evalFile1': '../results-postprocessing/data/evalu... | Thylossus/tud-movie-character-insights | Server/Tools/evaluation/evaluation-time-correctness/evaluationTime.py | Python | apache-2.0 | 6,081 |
# -*- coding: utf-8 -*-
class Mining(object):
def get_queryset(self):
if not getattr(self, "model", None):
raise NotImplementedError("You must provide a 'model' method for "
"the '%r' Open Mining." % self)
| mining/django-report | report/backends/mining.py | Python | mit | 268 |
#!/usr/bin/env python
CLASSIFIERS = """\
Development Status :: 3 - Alpha
Intended Audience :: Science/Research
License :: OSI Approved
Programming Language :: Python
Topic :: Scientific/Engineering
Topic :: Software Development
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Operating System :: Unix... | pearu/sympycore | setup.py | Python | bsd-3-clause | 7,372 |
# Copyright (c) 2013 Che-Liang Chiou
import os
import re
from SCons.Script import Dir
class Label(object):
VALID_NAME = re.compile(r'^[A-Za-z0-9_.\-/]+$')
@classmethod
def make_label(cls, label_str):
package_str = None
target_str = None
if not isinstance(label_str, str):
... | clchiou/scons_package | label.py | Python | mit | 4,231 |
# -*- coding: utf-8 -*-
"""
Generic parser for mapping a line to selected field discarding comments (#).
Handy for parsing various blocklist sets.
"""
import sys
import dateutil
from ipaddress import ip_network
from intelmq.lib import utils
from intelmq.lib.bot import Bot
from intelmq.lib.message import Event
cl... | pkug/intelmq | intelmq/bots/parsers/generic/parser_netset.py | Python | agpl-3.0 | 1,172 |
# -*- coding: utf-8 -*-
"""Parser for the Mac OS X Document Versions files."""
from plaso.containers import time_events
from plaso.lib import eventdata
from plaso.parsers import sqlite
from plaso.parsers.sqlite_plugins import interface
__author__ = 'Joaquin Moreno Garijo (Joaquin.MorenoGarijo.2013@live.rhul.ac.uk)'
... | dc3-plaso/plaso | plaso/parsers/sqlite_plugins/mac_document_versions.py | Python | apache-2.0 | 3,581 |
from resources.datatables import PlayerFlags
import sys
def setup():
return
def run(core, actor, target, commandString):
ghost = actor.getSlottedObject('ghost')
ghost.toggleFlag(PlayerFlags.FACTIONRANK)
return
| agry/NGECore2 | scripts/commands/toggledisplayingfactionrank.py | Python | lgpl-3.0 | 232 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 10 15:39:31 2015
This file provides the routines to preprocess and prepare foodcom data in order
to have a quality set of datasets, following some simple rules:
- users have at least 4 event ratings
- items/recipes have at least 4 event ratings
- the output files will be ... | ruifpmaia/foodcontextawarefactmach | rfmConsoleApplication/rfmConsoleApplication/Tools/foodcom_prepare.py | Python | gpl-2.0 | 21,967 |
#
## VOLDEMORT (VDM) VistA Comparer
#
# (c) 2012 Caregraf, Ray Group Intl
# For license information, see LICENSE.TXT
#
"""
Module for retrieving, caching and analysing a VistA's builds returned by FMQL
"""
import os
import re
import urllib
import urllib2
import json
import sys
from datetime import timedelta, datetim... | VAchris/VOLDEMORT | vdm/vistaBuilds.py | Python | apache-2.0 | 15,337 |
from i3pystatus import IntervalModule
class CpuFreq(IntervalModule):
"""
class uses by default `/proc/cpuinfo` to determine the current cpu frequency
.. rubric:: Available formatters
* `{avg}` - mean from all cores in MHz `4.3f`
* `{avgg}` - mean from all cores in GHz `1.2f`
* `{coreX}` - fr... | ncoop/i3pystatus | i3pystatus/cpu_freq.py | Python | mit | 1,779 |
# Below is the interface for Iterator, which is already defined for you.
#
# class Iterator(object):
# def __init__(self, nums):
# """
# Initializes an iterator object to the beginning of a list.
# :type nums: List[int]
# """
#
# def hasNext(self):
# """
# Returns... | Jacy-Wang/MyLeetCode | PeekingIterator284.py | Python | gpl-2.0 | 1,718 |
# Generated by Django 2.0.8 on 2019-03-29 19:58
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
class Migration(migrations.Migration):
dependencies = [
('gestao', '0009_historicaldiligenciasimples'),
... | culturagovbr/sistema-nacional-cultura | planotrabalho/migrations/0028_historicalarquivocomponente2.py | Python | agpl-3.0 | 2,312 |
"""
WSGI config for arcane project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | ArcaneStreaming/Arcane-Server | arcane/wsgi.py | Python | gpl-3.0 | 390 |
"""
Tests of the SubsectionGrade classes.
"""
from ..models import PersistentSubsectionGrade
from ..subsection_grade import CreateSubsectionGrade, ReadSubsectionGrade
from .base import GradeTestBase
from .utils import mock_get_score
class SubsectionGradeTest(GradeTestBase):
def test_create_and_read(self):
... | edx-solutions/edx-platform | lms/djangoapps/grades/tests/test_subsection_grade.py | Python | agpl-3.0 | 2,100 |
#!flask/bin/python
from app import create_app
app = create_app()
if __name__ == "__main__":
app.run()
| NikhilKalige/atom-website | run.py | Python | bsd-2-clause | 108 |
"""
Simple utilities.
"""
### IMPORTS
from werkzeug.contrib.cache import SimpleCache
from egas import app, db
from . import models
#__all__ = (
# 'simple_repr',
#)
### CONSTANTS & DEFINES
CACHE = SimpleCache()
CACHE_TIMEOUT = 5 * 60 # 5 minutes
### CODE ###
def simple_repr (obj, *fields):
"""
Quick-an... | agapow/egas | egas/utils.py | Python | mit | 2,353 |
from django.http import HttpResponseBadRequest, HttpResponse
from .models import Device
class DeviceVerificationMiddleware(object):
def __init__(self, get_response=None):
self.get_response = get_response
def __call__(self, request):
request.device = None
if "HTTP_X_DEVICE_VERIFICATIO... | LazyHaus/API | api/middleware.py | Python | gpl-3.0 | 899 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2015 Mirantis, 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... | eayunstack/fuel-ostf | fuel_health/tests/smoke/test_vcenter.py | Python | apache-2.0 | 20,161 |
"""
问题描述:给定一个字符串str1,只能往str1的后面添加字符变成str2,要求str2
整体都是回文串且最短。
举例:
str1 = ABC12321,则返回ABC12321CBA
"""
import sys
class ShortestEnd:
@classmethod
def get_shortest_end_by_manacher(cls, str1):
if not str1:
return ''
my_str = cls.get_manacher_str(str1)
center = -1
righ... | ResolveWang/algrithm_qa | other/manacher_shortest.py | Python | mit | 1,402 |
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Phase Noise Generator
# Author: mettus
# Generated: Thu Aug 1 11:59:39 2013
##################################################
from gnuradio import analog
from gnuradio import blocks
from gnuradio import fil... | dl1ksv/gnuradio | gr-channels/python/channels/phase_noise_gen.py | Python | gpl-3.0 | 2,882 |
#-*-coding:utf-8-*-
"""
@package fsmonitor.tests.test_base
@brief tests for dropbox.base
@author Sebastian Thiel
@copyright [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl.html)
"""
__all__ = []
import os
from time import time
from fsmonitor.base import *
from fsmonitor.tree import *
from fsmon... | Byron/bit | src/python/fsmonitor/tests/test_base.py | Python | lgpl-3.0 | 6,032 |
from django.db import models
from cinemania.utils import slugify
__all__ = ['BaseModel']
class BaseModel(models.Model):
"""Base model"""
# Title field
title = models.CharField(unique=True, max_length=64)
# Slug field
slug = models.SlugField(primary_key=True, max_length=64)
class Meta:
... | bashu/cinemania | cinemania/models/base.py | Python | gpl-3.0 | 744 |
#!/usr/bin/python
'''
See DOCUMENTATION constant.
'''
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
module: tendrl_user
short_description: Changes 'usm_username' user password to _password_from_module_argu... | usmqe/usmqe-setup | library/tendrl_user.py | Python | apache-2.0 | 3,557 |
#!/usr/bin/env python
# Copyright (c) 2017-2021 F5 Networks, 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 appl... | f5devcentral/f5-cccl | f5_cccl/resource/ltm/test/test_api_pool_member.py | Python | apache-2.0 | 8,616 |
# -*- coding: utf-8 -*-
#
# dh-virtualenv documentation build configuration file, created by
# sphinx-quickstart on Wed Feb 20 17:29:43 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... | spotify/dh-virtualenv | doc/conf.py | Python | gpl-2.0 | 8,829 |
# -*- coding: utf-8 -*-
"""
@author: Ana Andres-Arroyo
Matplotlib settings for Surface Pro 4
"""
import matplotlib
# matplotlib.rcParams.update({'font.size': 30})
matplotlib.rcParams.update({'lines.linewidth': 5})
matplotlib.rcParams.update({'axes.grid': True})
matplotlib.rcParams.update({'axes.linewidth': 2})
matp... | anaandresarroyo/Python-GarminDataAnalyser | MatplotlibSettings.py | Python | mit | 893 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | vrv/tensorflow | tensorflow/contrib/learn/python/learn/estimators/head.py | Python | apache-2.0 | 78,330 |
#!/usr/bin/env python
#
# Copyright 2013 Simone Campagna
#
# 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 a... | simone-campagna/LiteBS | lib/python/LiteBS/litebs_dependency_handler.py | Python | apache-2.0 | 7,541 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
class Migration(migrations.Migration):
dependencies = [
('delivery', '0049_auto_20151219_1605'),
]
operations = [
migrations.AlterField(
model_name='deliv... | AlexStarov/Shop | applications/delivery/migrations/0050_auto_20160505_2144.py | Python | apache-2.0 | 925 |
#!/usr/bin/env python
import os, time, requests, argparse, datetime
def main():
parser = argparse.ArgumentParser(description='Download all PrairieLearn course data as JSON via the API')
parser.add_argument('-t', '--token', required=True, help='the API token from PrairieLearn')
parser.add_argument('-i', '-... | rbessick5/PrairieLearn | tools/api_download.py | Python | agpl-3.0 | 3,432 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from haystack import indexes
from machina.core.db.models import get_model
Post = get_model('forum_conversation', 'Post')
class PostIndex(indexes.SearchIndex, indexes.Indexable):
"""
Defines the data stored in the Post indexes.
"""
te... | franga2000/django-machina | machina/apps/forum_search/search_indexes.py | Python | bsd-3-clause | 1,614 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2009 Ars Aperta, Itaapy, Pierlis, Talend.
#
# Authors: Hervé Cauwelier <herve@itaapy.com>
# David Versmisse <david.versmisse@itaapy.com>
#
# This file is part of Lpod (see: http://lpod-project.org).
# Lpod is free software; you can redistribute it... | uliss/quneiform | tests/py/lpod/scripts/lpod-show.py | Python | gpl-3.0 | 5,959 |
# This file taken from Python, licensed under the Python License Agreement
from __future__ import print_function
"""
Tests common to list and UserList.UserList
"""
import sys
import os
from blist.test import unittest
from blist.test import test_support
from blist.test import seq_tests
from decimal import Decimal
d... | pfmoore/blist | blist/test/list_tests.py | Python | bsd-3-clause | 19,502 |
# -*- coding: utf-8 -*-
'''
andaluciapeople.com
Copyright (C) 2008-2009 Manuel Martín Salvador <draxus@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... | DraXus/andaluciapeople | sitios/sitemaps.py | Python | agpl-3.0 | 1,680 |
import os
from adapters import infoVk
import sqlite3
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
app = Flask(__name__)
app.config.from_object('config.DevelopConfig')
app.config.update(dict(
DATABASE=os.path.join(app.root_path, 'bigeyebot.db'),
))
def conne... | Wertusser/EyeProject | app.py | Python | apache-2.0 | 1,376 |
#!/usr/bin/python
"""
All filetypes that do not have a specified worker are being picked
up by this Worker. It will collect the general information and hashes
from it.
"""
#Parent
from malzoo.common.abstract import Worker
#Imports
import magic
#Malzoo imports
from time import time
from malzoo.core.tools.general_info... | nheijmans/MalZoo | malzoo/core/workers/otherworker.py | Python | gpl-2.0 | 1,518 |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# drawElements Quality Program utilities
# --------------------------------------
#
# Copyright 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use t... | endlessm/chromium-browser | third_party/angle/third_party/VK-GL-CTS/src/scripts/opengl/gen_func_init.py | Python | bsd-3-clause | 1,414 |
from click.testing import CliRunner
from tiledrasterio.scripts.cli import cli
def test_cli_count():
runner = CliRunner()
result = runner.invoke(cli, ['3'])
assert result.exit_code == 0
assert result.output == "False\nFalse\nFalse\n"
| AsgerPetersen/tiledrasterio | tests/test_cli.py | Python | mit | 252 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pyslvs_ui/info/about.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from qtpy import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Di... | KmolYuan/Pyslvs-PyQt5 | pyslvs_ui/info/about_ui.py | Python | agpl-3.0 | 6,689 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0004_auto_20150716_2026'),
]
operations = [
migrations.CreateModel(
name='MonsterPosition',
f... | g82411/s_square | api/migrations/0005_auto_20150725_0026.py | Python | apache-2.0 | 1,321 |
#!env/python3
# coding: utf-8
import os
import sys
import datetime
import subprocess
import argparse
import reprlib
import time
import logging
from config import *
from common import *
from scripts import *
logging.basicConfig(filename=CONFIG["LOG_FILE"],level=logging.INFO)
# Import all bench
BENCHES = {}
BEN... | REGOVAR/Sandbox | benchs/db/run.py | Python | agpl-3.0 | 1,635 |
"""
Based on the tflearn example located here:
https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_cifar10.py
"""
from __future__ import division, print_function, absolute_import
# Import tflearn and some helpers
import tflearn
from tflearn.data_utils import shuffle
from tflearn.layers.core import i... | rdjdejong/LerenEnBeslissen-2017 | convNN.py | Python | mit | 2,866 |
# Name: AttributePanel.py
# Purpose: View components for editing attributes
# Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
# Created: 17.06.2007
# RCS-ID: $Id: AttributePanel.py 73215 2012-12-19 18:05:05Z RD $
import string
import wx
import wx.lib.buttons as buttons
from globals impor... | garrettcap/Bulletproof-Backup | wx/tools/XRCed/AttributePanel.py | Python | gpl-2.0 | 17,379 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from shutil import move
from time import sleep
from platform import dist
from re import search
from os import geteuid,mkdir,system,path,getcwd,chdir,remove,popen
from sys import argv
if search("/usr/share/",argv[0]):
chdir("/usr/share/PEH-wifi-attack/")
from Modu... | hackerbolt-freelancer/PEH-wifi-attack | Core/Main.py | Python | mit | 21,924 |
# -*- encoding: utf-8 -*-
"""
Tests for django.core.servers.
"""
from __future__ import unicode_literals
import os
import socket
from django.core.exceptions import ImproperlyConfigured
from django.test import LiveServerTestCase
from django.test.utils import override_settings
from django.utils.http import urlencode
fr... | atruberg/django-custom | tests/servers/tests.py | Python | bsd-3-clause | 5,773 |
import datetime
from django.core.management.base import NoArgsCommand
from django.conf import settings as django_settings
from askbot import models
from askbot import const
from askbot.conf import settings as askbot_settings
from django.utils.translation import ugettext as _
from django.utils.translation import ungette... | maxwward/SCOPEBak | askbot/management/commands/send_accept_problem_reminders.py | Python | gpl-3.0 | 3,650 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# seriesly - XBMC Plugin
# Conector para nowdownload
# http://blog.tvalacarta.info/plugin-xbmc/seriesly/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core import scra... | conejoninja/xbmc-seriesly | servers/nowdownload.py | Python | gpl-3.0 | 2,851 |
#!/usr/bin/env python
# @package update_storage_schemas.py
# Correct/Update storage schemas\n
# @code
# # Usage example for update_storage_schemas.py
# sudo ./update_storage_schemas.py --path /opt/graphite/whisper --cfg /opt/graphite/conf/schemas
# @endcode
import sys
import os
import logging
import subprocess
imp... | piotr1212/whisper | contrib/update-storage-times.py | Python | apache-2.0 | 7,256 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('library', '0004_auto_20160825_1001'),
]
operations = [
migrations.AlterModelOptions(
name='car',
opt... | PeteTheAutomator/ACServerManager | library/migrations/0005_auto_20160828_1046.py | Python | mit | 822 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | ueshin/apache-spark | python/pyspark/sql/pandas/utils.py | Python | apache-2.0 | 2,779 |
from __future__ import print_function
import numpy as np
from keras_contrib.utils import test_utils
from keras import optimizers
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.utils import to_categorical
def get_test_data():
np.random.seed(1337)
(x_train, y_train), ... | keras-team/keras-contrib | keras_contrib/tests/optimizers.py | Python | mit | 1,627 |
import math
import statistics
import challenge21 as mt
from util import xor, chunk
def mtcipherop(data, key):
assert key < 2**16
mt.seed(key)
out = bytearray()
for chk in chunk(data, 4):
keystream = mt.extract().to_bytes(4, 'little')
out += xor(chk, keystream[:len(chk)])
return... | cngkaygusuz/matasano-challenges | challenge24.py | Python | mit | 847 |
# coding: utf-8
# Copyright 2013 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 by ap... | atljohnsen/adlcoursebuilder | tests/functional/test_classes.py | Python | apache-2.0 | 157,784 |
# Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
from __future__ import absolute_import
import ROOT
from .. import QROOT, asrootpy
from ..base import Object
from .utils import canvases_with
__all__ = [
'Pave',
'PaveStats',
]
ANCHORS = (
'upper left',... | cms-btv-pog/rootpy | rootpy/plotting/box.py | Python | gpl-3.0 | 6,943 |
#!/usr/bin/python
# frederico@marques.cx
# tubenot.py - Blocks YouTube via OpenDNS. Works with Mac OS X 10.9.5 (Mavericks)
# run as root
from datetime import datetime
import sys
import subprocess
import os
curl = '/usr/bin/curl'
networksetup = '/usr/sbin/networksetup'
# To get a list of network services run "network... | vonfreud/tubenot | tubenot.py | Python | apache-2.0 | 2,107 |
# -*- encoding: utf-8 -*-
'''
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
'''
# Definition for a binary tree node.
# class TreeNode(object):
# ... | weixsong/algorithm | leetcode/110.py | Python | mit | 1,004 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
class Migration(migrations.Migration):
dependencies = [
('delivery', '0040_auto_20151101_1833'),
]
operations = [
migrations.AlterModelOptions(
name='mail... | AlexStarov/Shop | applications/delivery/migrations/0041_auto_20151113_1741.py | Python | apache-2.0 | 4,641 |
#! /usr/bin/python
# -*- coding: utf8 -*-
from __future__ import unicode_literals
import LaTeXparser
import LaTeXparser.PytexTools
import commons
import plugins_agreg
myRequest = LaTeXparser.PytexTools.Request("mesure")
myRequest.ok_hash=commons.ok_hash
myRequest.add_plugin(plugins_agreg.set_isAgreg,"before_pytex")... | LaurentClaessens/frtex | src/test/java/latex/mazhe_tex_test/lst_exemple.py | Python | gpl-3.0 | 853 |
#!/usr/bin/env python
"""A library for check-specific tests."""
import collections
import os
import StringIO
import yaml
from grr.lib import config_lib
from grr.lib import registry
from grr.lib import test_lib
from grr.lib import type_info
from grr.lib.checks import checks
from grr.lib.checks import filters
from grr... | darrenbilby/grr | lib/checks/checks_test_lib.py | Python | apache-2.0 | 19,268 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.