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 |
|---|---|---|---|---|---|
import random
import re
import sys
import time
import louie as L
from pastycake.config import Config
from pastycake.keywords import KeywordStorage
def _fetch_one(generator, path, keywords, storage, store_match):
status, data = generator.get_paste(path)
#if 5xx or 4xx
if status['status'][0] in ('4', '5'... | 9b/pastycake | pastycake/gather.py | Python | bsd-3-clause | 2,664 |
def extractSakuraidreaderWordpressCom(item):
'''
Parser for 'sakuraidreader.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('ring ring', 'ring ring', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractSakuraidreaderWordpressCom.py | Python | bsd-3-clause | 1,006 |
import telegram
from bottoken import token
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from dllusage import askdll
description = \
"""Это бот для игры в шахматы с друзьями через телеграм.
Как играть:
пока никак
Текущая функциональность:
Проверка корректности введённой строки, обозначающе... | nkbolg/p2p-chess-telebot | botmain.py | Python | mit | 1,353 |
import os
from .context import tohu
from tohu.v4.primitive_generators import *
from tohu.v4.derived_generators import *
from tohu.v4.dispatch_generators import *
__all__ = ['EXEMPLAR_GENERATORS', 'EXEMPLAR_PRIMITIVE_GENERATORS', 'EXEMPLAR_DERIVED_GENERATORS']
def add(x, y):
return x + y
here = os.path.abspath(o... | maxalbert/tohu | tests/v4/conftest.py | Python | mit | 1,373 |
# -*- coding: utf-8 -*-
#
# csa_topology_example.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 Li... | kristoforcarlson/nest-simulator-fork | pynest/examples/csa_topology_example.py | Python | gpl-2.0 | 2,628 |
import string
import transaction
def read_pat(patstr):
info = string.split(patstr)
countstr = info.pop()
count = int(countstr.strip("()")) # rip parenthesis
items = map(lambda x: int(x), info)
items.sort() # in any event
return (items, count)
def write_pat(fout, ... | examachine/bitdrill | scripts/pattern.py | Python | agpl-3.0 | 1,255 |
#***************************************************************************
#* Copyright (C) 2005 -- 2011 by Marek Sawerwain *
#* <M.Sawerwain@gmail.com> *
#* *
#* Part of... | qMSUZ/QCS | examples_python/qudit_bell_state_discrimination_final.py | Python | gpl-3.0 | 2,500 |
#!/usr/bin/env python
"""
OFB Mode of operation
Running this file as __main__ will result in a self-test of the algorithm.
Algorithm per NIST SP 800-38A http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
Copyright (c) 2010, Adam Newman http://www.caller9.com/
Licensed under the MIT license http://www.o... | vedran6/brainvault | aespython/ofb_mode.py | Python | mit | 2,065 |
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NIN... | Salmista-94/Ninja_3.0_PyQt5 | ninja_ide/intellisensei/completion/completer_widget.py | Python | gpl-3.0 | 12,097 |
"""
WSGI config for summercamp_timeline 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("... | ramaseshan/fsftn-summercamp | summercamp_timeline/summercamp_timeline/wsgi.py | Python | mit | 415 |
import sys
import os
import logging
logger = logging.getLogger('akagi')
logger.setLevel(logging.INFO)
sh = logging.StreamHandler(sys.stdout)
sh.setLevel(logging.INFO)
log_file_path = os.path.join('/', 'tmp', 'akagi.log')
fh = logging.FileHandler(log_file_path)
fh.setLevel(logging.DEBUG) # log all
logger.addHandl... | ayemos/osho | akagi/log.py | Python | mit | 404 |
import datetime
import cgi
from bson.objectid import ObjectId
from helper_functions import *
class Post:
def __init__(self, default_config):
self.collection = default_config['POSTS_COLLECTION']
self.response = {'error': None, 'data': None}
self.debug_mode = default_config['DEBUG']
de... | kailin4u/flask-blog | post.py | Python | mit | 6,830 |
df = pd.DataFrame({'lab':['A', 'B', 'C'], 'val':[10, 30, 20]})
ax = df.plot.bar(x='lab', y='val', rot=0)
| datapythonista/datapythonista.github.io | docs/new-pandas-doc/generated/pandas-DataFrame-plot-bar-1.py | Python | apache-2.0 | 105 |
# Copyright 2014-2017 by Akira Yoshiyama <akirayoshiyama@gmail.com>.
# 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... | yosshy/osclient2 | osclient2/nova/v2/service.py | Python | apache-2.0 | 4,096 |
import yaml
from compose.config import types
from compose.const import COMPOSE_SPEC as VERSION
from compose.const import COMPOSEFILE_V1 as V1
def serialize_config_type(dumper, data):
representer = dumper.represent_str
return representer(data.repr())
def serialize_dict_type(dumper, data):
return dumper.... | vdemeester/compose | compose/config/serialize.py | Python | apache-2.0 | 5,093 |
"""Find files and directories which IPython uses.
"""
import os.path
import shutil
import tempfile
from warnings import warn
import IPython
from IPython.utils.importstring import import_item
from IPython.utils.path import (
get_home_dir, get_xdg_dir, get_xdg_cache_dir, compress_user, _writable_dir,
ensure_dir_... | sserrot/champion_relationships | venv/Lib/site-packages/IPython/paths.py | Python | mit | 4,434 |
from __future__ import unicode_literals
from django.apps import AppConfig
class FoodConfig(AppConfig):
name = 'Food'
| neewy/InStoKiloGram | Food/apps.py | Python | apache-2.0 | 124 |
from Products.Archetypes.public import DisplayList
from bika.wine import bikaMessageFactory as _
from bika.wine.permissions import *
PROJECTNAME = "bika.wine"
| bikalabs/bika.wine | bika/wine/config.py | Python | agpl-3.0 | 161 |
import re
from django.conf import settings
from nose.tools import eq_
from pyquery import PyQuery as pq
import kitsune.sumo.tests.test_parser
from kitsune.gallery.models import Video
from kitsune.gallery.tests import image, video
from kitsune.sumo.tests import TestCase
from kitsune.wiki.models import Document
from k... | orvi2014/kitsune | kitsune/wiki/tests/test_parser.py | Python | bsd-3-clause | 39,480 |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
from pyramid.view import view_config
from substanced.util import get_oid
from dace.objectofcollaboration.principal.role import DACE_ROLES
from dace.objectofcollabora... | ecreall/lagendacommun | lac/views/user_management/edit_group.py | Python | agpl-3.0 | 1,642 |
# Copyright (c) 2014 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 by applicable law or agreed to in writing, so... | mgrygoriev/CloudFerry | cloudferrylib/os/actions/transport_ephemeral.py | Python | apache-2.0 | 7,851 |
import json
from flask import request
from ..models import mongo
from . import api
@api.route('/search/', methods=['GET'])
def search_servers():
query = {}
for arg in request.args.keys():
query[arg] = request.args[arg]
servers, content = mongo.db.servers.find(query), []
for server in servers... | stormers/greylist | api/v1/search.py | Python | gpl-3.0 | 401 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# freeseer - vga/presentation capture software
#
# Copyright (C) 2014 Free and Open Source Software Learning Centre
# http://fosslc.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | Freeseer/freeseer | src/freeseer/tests/frontend/qtcommon/test_dpi_adapt_qtgui.py | Python | gpl-3.0 | 7,125 |
import threading
import time
import algorithm
class Airplane(object):
'''
Airplane class.
Предназначен для хранения промежуточной информации и организации вычислений координат.
Метод calculateCoordinates спроектирован для работы в отдельном потоке.
По сути, является перемычкой между GUI и Algorithm... | gskii/AirPy | airplane.py | Python | unlicense | 4,176 |
# -*- coding: utf-8 -*-
#
# ns-3 documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 14 09:00:39 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... | shravya-ks/ECN-ns3 | src/mesh/doc/source/conf.py | Python | gpl-2.0 | 7,452 |
# -*- coding: utf-8 -*-
#
# nested_dict documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 5 18:33:34 2015.
#
# 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.
#... | itkovian/nested-dict | docs/source/conf.py | Python | mit | 10,183 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Bundle to check the loading order when instantiating with iPOPO
:author: Thomas Calmant
"""
# Pelix
from pelix.constants import BundleActivator
from pelix.framework import BundleContext, BundleEvent
# iPOPO
from pelix.ipopo.decorators import ComponentFactory,... | ahmadshahwan/ipopo | tests/ipopo/ipopo_boot_order_bundle.py | Python | apache-2.0 | 1,560 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0005_add_user_language_and_competence'),
]
operations = [
migrations.AddField(
model_name='user',
... | opennode/nodeconductor | waldur_core/core/migrations/0006_user_is_support.py | Python | mit | 514 |
"""DAC module D5b interface
SPI Rack interface code for the D5b module. An 8 channel 18-bit DAC module
with integrated ARM Cortex M4 microcontroller.
Example:
Example use: ::
D5b = spirack.D5b_module(SPI_Rack1, 1, True)
"""
import logging
from enum import Enum
from time import sleep
import numpy as np
... | peendebak/SPI-rack | spirack/D5b_module.py | Python | mit | 23,353 |
#
# Copyright (C) 2007 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
from distutils import dist
from Synopsis.dist.command.config import config
from Synopsis.dist.command.build_doc import build_doc
from Synopsis.dist.command... | stefanseefeld/synopsis | Synopsis/dist/distribution.py | Python | lgpl-2.1 | 1,423 |
from plotly_system_stats.utils import WeakCallbacks
from plotly_system_stats.stat_collection.collection.scheduler import Scheduler
class Collector(object):
def __init__(self, **kwargs):
self.sources = {}
self.value_change_callbacks = WeakCallbacks()
self.scheduler = kwargs.get('scheduler')
... | nocarryr/plotly-system-stats | plotly_system_stats/stat_collection/collection/collector.py | Python | gpl-2.0 | 1,215 |
# ergae --- Earth Reader on Google App Engine
# Copyright (C) 2014 Hong Minhee
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any... | earthreader/ergae | ergae/app.py | Python | agpl-3.0 | 1,516 |
import datetime
import netaddr
from oslo.utils import timeutils
from quark.db import api as db_api
from quark.plugin_modules import ip_policies
from quark.tests.functional.mysql.base import MySqlBaseFunctionalTest
class IPReallocateMixin(object):
REUSE_AFTER = 300
def insert_network(self):
tenant_i... | insequent/quark | quark/tests/functional/mysql/test_db_ip_reallocate.py | Python | apache-2.0 | 12,279 |
#!/usr/bin/python
import json
import requests
import os
import argparse
import types
RACKHD_URL = 'http://localhost:8080'
class RackhdInventory(object):
def __init__(self, nodeids):
self._inventory = {}
for nodeid in nodeids:
self._load_inventory_data(nodeid)
inventory = {}
... | abtreece/ansible | contrib/inventory/rackhd.py | Python | mit | 2,357 |
from __future__ import absolute_import
from chains.service import Service
from chains.common import log
from datetime import datetime, timedelta
import re, hashlib, time, sys, json
import urllib2
py = sys.version_info
py3k = py >= (3, 0, 0)
if py3k:
from urllib.parse import urlencode
from urllib.request impo... | ChainsAutomation/chains | lib/chains/services/ruter/__init__.py | Python | gpl-2.0 | 4,219 |
import os
import shutil
import sys
from setuptools import find_packages, setup
__VERSION__ = "1.5.0"
def read_md(f):
try:
from pypandoc import convert
return convert(f, "rst")
except ImportError:
return open(f, "r").read()
def check_installed(*packages):
exit = False
# if n... | sanoma/django-arctic | setup.py | Python | mit | 2,817 |
import logging
import os
import shlex
import warnings
from threading import Timer, current_thread
from .utils import PLUGINS_SUBDIR, recurse_check_structure
from .storage import StoreMixin, StoreNotOpenError
from . import holder
class BotPluginBase(StoreMixin):
"""
This class handle the basic needs of bot ... | moses-rolston/err | errbot/botplugin.py | Python | gpl-3.0 | 15,313 |
"""Implementation of the WebSocket protocol.
`WebSockets <http://dev.w3.org/html5/websockets/>`_ allow for bidirectional
communication between the browser and server.
.. warning::
The WebSocket protocol was recently finalized as `RFC 6455
<http://tools.ietf.org/html/rfc6455>`_ and is not yet supported in
al... | Drvanon/Game | venv/lib/python3.3/site-packages/tornado/websocket.py | Python | apache-2.0 | 31,651 |
"""
Use reentrant functions. Do not use not reentrant functions.(ctime, strtok, toupper)
== Violation ==
void A() {
k = ctime(); <== Violation. ctime() is not the reenterant function.
j = strok(blar blar); <== Violation. strok() is not the reenterant function.
}
== Good ==
void A() {... | kunaltyagi/nsiqcppstyle | rules/RULE_9_2_D_use_reentrant_function.py | Python | gpl-2.0 | 3,067 |
#
# 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... | witgo/spark | python/pyspark/ml/tests/test_evaluation.py | Python | apache-2.0 | 2,811 |
from django.template import RequestContext
from django.shortcuts import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.decorators import user_passes_tes... | RZN-FFEvo/corpauth | services/views.py | Python | gpl-2.0 | 14,090 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:6218")
else:
access = Ser... | agecoin/agecoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,836 |
# Copyright (c) 2013, 2014, 2015, 2016 Philip Hane
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of c... | drzoidberg33/plexpy | lib/ipwhois/__init__.py | Python | gpl-3.0 | 1,458 |
#----------------------------------------------------------------------------
# Name: dbg.py
# RCS-ID: $Id$
# Author: Will Sadkin
# Email: wsadkin@nameconnector.com
# Created: 07/11/2002
# Copyright: (c) 2002 by Will Sadkin, 2002
# License: wxWindows license
#--------------------... | DaniilLeksin/gc | wx/tools/dbg.py | Python | apache-2.0 | 8,729 |
import os
import sys
from modules.features.VisualVocabulary import VisualVocabulary
def usage():
print "This script will generate a visual vocabulary."
def main(argv):
# Define the default values for the options
pathHome = os.path.expanduser('~')
pathWork = os.path.join( pathHome, 'Desktop/Proye... | aamcgdsa21/GDSA | Descriptor/tools/3_vocabulary.py | Python | mit | 1,275 |
# yellowbrick.model_selection
# Visualizers that wrap the model selection libraries of Scikit-Learn
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Fri Mar 30 10:36:12 2018 -0400
#
# ID: __init__.py [c5355ee] benjamin@bengfort.com $
"""
Visualizers that wrap the model selection libraries of Scikit-Le... | DistrictDataLabs/yellowbrick | yellowbrick/model_selection/__init__.py | Python | apache-2.0 | 818 |
import pandas as pd
import os
# handle the order_info sheet
def order_sheet_pre():
#set filename and input data
print("load data from:")
for x in range(START,END,SEP):
syspath = "../../season_1/"+IS_TRAINING+"/order_data/"
if(x<10):
name = "order_data_2016-01-0"+str(x)+_TEST
... | Heipiao/didi_competition | load_data_DiDi.py | Python | mit | 5,257 |
#
# entity_extracter/__init__.py - demo agent service adapter...
#
# Copyright (c) 2017 SingularityNET
#
# Distributed under the MIT software license, see LICENSE file.
#
import logging
from sn_agent.job.job_descriptor import JobDescriptor
from sn_agent.service_adapter import ServiceAdapterABC
logger = logging.getLo... | inflector/singnet | agent/examples/multi_agent_adapter/entity_extracter/__init__.py | Python | mit | 823 |
# Copyright (c) 2010, Columbia Center For New Media Teaching And Learning (CCNMTL)
# Copyright (c) 2012-2017, havard@gulldahl.no
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistribut... | havardgulldahl/xmeml | setup.py | Python | bsd-3-clause | 2,342 |
# This import verifies that the dependencies are available.
import pymysql # noqa: F401
from sqlalchemy.dialects.mysql import base
from datahub.ingestion.source.sql.sql_common import (
BasicSQLAlchemyConfig,
SQLAlchemySource,
make_sqlalchemy_type,
register_custom_type,
)
GEOMETRY = make_sqlalchemy_ty... | linkedin/WhereHows | metadata-ingestion/src/datahub/ingestion/source/sql/mysql.py | Python | apache-2.0 | 1,200 |
ABIs = [
ABI("2", "armeabi-v7a", "arm-linux-androideabi-4.9", cmake_vars=dict(ANDROID_ABI='armeabi-v7a with NEON')),
ABI("1", "armeabi", "arm-linux-androideabi-4.9", cmake_vars=dict(WITH_TBB='OFF')),
ABI("3", "arm64-v8a", "aarch64-linux-android-4.9"),
ABI("5", "x86_64", "x86_64-4.9"),
ABI... | fspindle/visp | platforms/android/ndk-16.config.py | Python | gpl-2.0 | 355 |
import theano
import theano.tensor as T
import numpy as np
from theano.printing import Print
from theano_toolkit import utils as U
from theano_toolkit.parameters import Parameters
from theano.tensor.extra_ops import repeat
import controller
import head
import scipy
def cosine_sim(k, M):
k_lengths = T.sqrt(T.sum(k... | darongliu/Lstm_Turing_LM | lstm-neural-turing-machines-lm/experiment_version/lstm+attention+pretrain+weight/model.py | Python | mit | 3,229 |
#!/usr/bin/env python3
import unittest
import socket
from framework import VppTestCase, VppTestRunner
from vpp_ip import DpoProto
from vpp_ip_route import VppIpRoute, VppRoutePath, VppMplsRoute, \
VppIpTable, VppMplsTable, VppMplsLabel
from vpp_mpls_tunnel_interface import VppMPLSTunnelInterface
from scapy.packe... | FDio/vpp | test/test_srmpls.py | Python | apache-2.0 | 9,758 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# ---------------------------------------------------------------------------
# ___ __ ___ ___ ____ ____ __
# | \ | \ | | / | | | \ Automatic
# |__/ |__/ | | | |__ |__ | | Conference
# | ... | brigittebigi/proceed | proceed/src/wxgui/frames/about.py | Python | gpl-3.0 | 3,341 |
###############################################################################
# ##
# Copyright 2013 by its authors ##
# See COPYING, AUTHORS ##
... | OSSOS/MOP | src/ossos/core/ossos/pipeline/step3.py | Python | gpl-3.0 | 8,611 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2012-2012 Camptocamp Austria (<http://www.camptocamp.at>)
#
# This program is free softw... | odoousers2014/LibrERP | purchase_no_gap/purchase.py | Python | agpl-3.0 | 1,633 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Shinichi Nakagawa'
class RetroSheetUtil(object):
# at batとevent codeの対応表
# http://www.retrosheet.org/datause.txt
HITS_EVENT = {
20: ('S',),
21: ('DGR', 'D'),
22: ('T',),
23: ('HR',),
}
STRIKE_OUTS = {
... | Shinichi-Nakagawa/hatteberg | retrosheet_app/retrosheet_util.py | Python | mit | 7,216 |
#!/usr/bin/env python
##=============================================================================
#
# Copyright (C) 2003, 2004 Alessandro Duca <alessandro.duca@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as publis... | rnavarro/Py-Post | vendors/yenc-0.3.1/examples/ydecode_Decoder.py | Python | mit | 2,936 |
config = {
"log_name": "talos",
#"base_work_dir": "",
"installer_url": "http://ftp.mozilla.org/pub/mozilla.org/mobile/nightly/latest-mozilla-central-android/en-US/fennec-16.0a1.en-US.android-arm.apk",
"repository": "http://hg.mozilla.org/mozilla-central",
# "pypi_url": "http://people.mozilla.com/~jw... | ctalbert/mozharness | configs/users/callek/tegra1-foopy.py | Python | mpl-2.0 | 2,111 |
#!/usr/bin/env python
import os
import time
import yaml
import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup
current = os.path.split(os.path.realpath(__file__))[0]
yaml_file = "{0}/mkdocs.yml".format(current)
mkdocs = yaml.load(open(yaml_file))['pages']
host='http://127.0.0.1:8000'
page_filte... | Nocturnana/jpush-docs | test_links.py | Python | mit | 2,872 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | larryhynes/qutebrowser | scripts/pylint_checkers/settrace.py | Python | gpl-3.0 | 1,651 |
#!/usr/local/bin/python3.4
# encoding: utf-8
'''
@author: Itay Moav
@copyright: 2014 organization_name. All rights reserved.
@license: license
@contact: user_email
@deffield updated: Updated
'''
import sys
import os
import traceback
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/.... | itay-moav/rahl_commander | bin/autocomp.py | Python | mit | 761 |
import glob
import numpy as np
from keras.models import Model
from keras.preprocessing import image
from keras.applications.resnet50 import ResNet50, preprocess_input
import tensorflow as tf
import h5py
config_proto = tf.ConfigProto()
config_proto.gpu_options.allow_growth=True
sess = tf.Session(config=config_proto)
bas... | b29308188/cs598vqa | src/extract_features.py | Python | mit | 1,266 |
from .bioid import BioId
from .helen import HELEN
from .ibug import ibug
from .menpo import Menpo
| doc-E-brown/FacialLandmarkingReview | experiments/Sec3_FeatureExtraction/__init__.py | Python | gpl-3.0 | 98 |
"""
Generating and counting primes.
"""
from __future__ import print_function, division
import random
from bisect import bisect
# Using arrays for sieving instead of lists greatly reduces
# memory consumption
from array import array as _array
from .primetest import isprime
from sympy.core.compatibility import as_int... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/ntheory/generate.py | Python | mit | 17,480 |
"""
Manage cursor location and blip body editing.
"""
MODULE_NS = "pyofwave.info/2012/dtd/document.dtd"
from lxml.builder import ElementMaker
from pyofwave.core.action import ActionBase
from pyofwave.core.action import action_register
E = ElementMaker(namespace=MODULE_NS)
@action_register
class Retain(ActionBase):
... | pyofwave/PyOfWave | pyofwave_server/pyofwave/action/document.py | Python | mpl-2.0 | 1,394 |
import re
[S, k] = [input().strip(), input().strip()]
print(sep='\n', *(
[(s.start(), s.start() + len(k) - 1) for s in re.finditer(r'(?=({}))'.format(k), S)] or [(-1, -1)]
))
| alexander-matsievsky/HackerRank | All_Domains/Python/Regex_and_Parsing/re-start-re-end.py | Python | mit | 180 |
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0:
return 0
count = 0
j= 0
for i in xrange(1,len(nums)):
if nums[j] == nums[i]:
count += 1
... | comicxmz001/LeetCode | Python/80_RemoveDuplicatesfromSortedArrayII.py | Python | mit | 977 |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-cli | qingcloud/cli/iaas_client/actions/alarm_policy/add_alarm_policy_actions.py | Python | apache-2.0 | 2,067 |
# Copyright (c) 2020 University of Chicago.
#
# 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 t... | ChameleonCloud/blazar | blazar/enforcement/filters/external_service_filter.py | Python | apache-2.0 | 4,719 |
from Ledart.Tools.Graphics.RGBColorTools import ColorRGBOps
from Ledart.Tools.Graphics.ConvertColors import HSVtoRGB
from Ledart.Tools.Graphics import Graphics, BLACK, BLUE
from Ledart.Tools.Controllers import translate
from Ledart.Tools.Palet import PaletGenerate
from Ledart.Tools.Timing import Timer
from Ledart impor... | TkkrLab/py-ledart | Ledart/Patterns/Plasma.py | Python | gpl-2.0 | 6,438 |
"""
This file implements the ``cea`` command line interface script. Basically, it uses the first argument passed to
it to look up a module to import in ``scripts.yml``, imports that and then calls the ``main`` function on that module.
The rest of the command line arguments are passed to the ``cea.config.Configuration`... | architecture-building-systems/CEAforArcGIS | cea/interfaces/cli/cli.py | Python | mit | 4,360 |
from typing import Any, Union
from flasgger import swag_from
from flask import Response
from flask_restful import Resource, marshal
from openatlas.api.v02.resources.parser import default
from openatlas.api.v02.resources.resolve_endpoints import download
from openatlas.api.v02.templates.type_tree import TypeTreeTempla... | craws/OpenAtlas | openatlas/api/v02/endpoints/node/type_tree.py | Python | gpl-2.0 | 1,520 |
# -*- 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
from django.utils.text import slugify
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ProjectType.slug'
d... | MjAbuz/foundation | foundation/organisation/migrations/0028_auto__add_field_projecttype_slug__add_field_project_featured.py | Python | mit | 17,071 |
#!/usr/bin/env python
# Copyright (c) 2016-2022, Adam Karpierz
# Licensed under the BSD license
# https://opensource.org/licenses/BSD-3-Clause
# Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
# The Regents of the University of California. All rights reserved.
#
# Redistribution and u... | karpierz/libpcap | tests/filtertest.py | Python | bsd-3-clause | 6,939 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, EasyDialogs
from PIL import Image as Image
# instead of relying on sys.argv, ask the user via a simple dialog:
rotater = ('Rotate right', 'Rotate image by 90 degrees clockwise')
rotatel = ('Rotate left', 'Rotate image by 90 degrees anti-clockwise')
scale = ... | relic7/prodimages | python/TkinterImageResize.py | Python | mit | 2,333 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | ZhuangER/storm-social-analysis | storm-kafka/src/jvm/yu/storm/resources/storm.py | Python | mit | 5,912 |
from typing import Type, TypeVar
class MyClass:
class_attr = 42
def __init__(self, attr):
self.inst_attr = attr
T = TypeVar('T', bound=MyClass)
def func(x: Type[T]):
x.<caret>
| siosio/intellij-community | python/testData/completion/typeVarClassObjectBoundAttributes.py | Python | apache-2.0 | 203 |
"""Various Pretty formatters"""
import os
import collections
import json
import textwrap
import functools
import re
# import compage.nodeutil as nodeutil
__all__ = [
'FormattedDict',
'FormattedDefaultDict',
'wrap',
'format_iterable',
'format_header',
'format_output',
'camel_case_to_snake... | alok1974/compage | src/compage/formatter.py | Python | mit | 3,933 |
from ark.cli import *
class EventHandler(object):
"""
Remember to add entry with corresponding integer key to _event_callbacks if you add another event!
"""
E_CONNECT = 1
E_DISCONNECT = 2
E_CHAT = 3
E_NEW_ARK_VERSION = 4
E_NEW_PLAYER = 5
E_CHAT_FROM_SERVER = 6
E_RCON_... | f4ble/Arkon | ark/event_handler.py | Python | apache-2.0 | 2,041 |
import logging
from django.conf import settings
from rest_framework import serializers
from collectionjson.fields import ItemLinkField
from core.utils import get_file_resource_link
from core.swiftmanager import SwiftManager
from .models import Service, ServiceFile
from .models import REGISTERED_SERVICES
logger = ... | FNNDSC/ChRIS_ultron_backEnd | chris_backend/servicefiles/serializers.py | Python | mit | 4,290 |
import numbers
import numpy as np
from scipy.stats.distributions import randint
from scipy.stats.distributions import rv_discrete
from scipy.stats.distributions import uniform
from sklearn.utils import check_random_state
from sklearn.utils.fixes import sp_version
from .transformers import CategoricalEncoder
from .tr... | ccauet/scikit-optimize | skopt/space/space.py | Python | bsd-3-clause | 21,426 |
"""
Copyright 2013 Steven Diamond
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... | SteveDiamond/cvxpy | cvxpy/atoms/elementwise/sqrt.py | Python | gpl-3.0 | 738 |
#!/usr/bin/env python
# Copyright 2017 The Kubernetes 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 appli... | foxish/test-infra | jobs/config_sort.py | Python | apache-2.0 | 4,199 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'NetworkInterface.mac'
db.alter_column('db_networkinterface', 'mac', self.gf('django.... | grnet/synnefo | snf-cyclades-app/synnefo/db/migrations/old/0047_auto__chg_field_networkinterface_mac__add_unique_networkinterface_mac_.py | Python | gpl-3.0 | 12,999 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | tlby/mxnet | python/mxnet/recordio.py | Python | apache-2.0 | 14,831 |
from django.conf.urls import url
from accounts import views
urlpatterns = [
# pattern maps to view handling `GET` and `POST` requests to
# /account
url(r'^$',
views.UserProfileView.as_view(),
name='account'),
# pattern maps to view handling `GET` and `POST` requests to
# /account... | andela/troupon | troupon/accounts/urls.py | Python | mit | 1,861 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsRasterLayerRenderer
.. note:: 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.... | ghtmtt/QGIS | tests/src/python/test_qgsrasterlayerrenderer.py | Python | gpl-2.0 | 3,442 |
#!/usr/bin/env python
import sys
if (len(sys.argv) < 2):
print "usage: PrintSameChrom.py input.bed"
sys.exit(1)
a = open(sys.argv[1])
prevVals = None
prevLine = ""
for line in a:
vals = line.split()
if (prevVals is not None and prevVals[0] == vals[0] and prevVals[3] == vals[3]):
if (int(va... | yunlongliukm/chm1_scripts | Inversions/PrintSameChrom.py | Python | mit | 550 |
import superdesk
from flask.ext.script import Manager
class SuperdeskManager():
"""Superdesk scripts manager."""
def __init__(self, app, commands):
self.manager = Manager(app)
self.commands = commands
def run(self):
"""Run manager with predefined set of commands."""
self... | akintolga/superdesk-core | superdesk/factory/manager.py | Python | agpl-3.0 | 540 |
# -*- coding: utf-8 -*-
import logging
import socket
import time
import threading
import types
from ws4py import WS_KEY, WS_VERSION
from ws4py.exc import HandshakeError, StreamClosed
from ws4py.streaming import Stream
from ws4py.messaging import Message, PongControlMessage
from ws4py.compat import basestring, unicode
... | 17dakmue/WebSocket-for-Python | ws4py/websocket.py | Python | bsd-3-clause | 13,793 |
import os
import os.path
import osiris
class Page(osiris.IMainPage):
def __init__(self, session):
osiris.IMainPage.__init__(self, session)
def getPageName(self):
return "extensions.4A7F130B4A5C42CC5D928D157641596A89543C65.images"
def onInit(self):
osiris.IMainPage.onInit(self)
self.pathway.add(self... | OsirisSPS/osiris-sps | client/data/extensions/4A7F130B4A5C42CC5D928D157641596A89543C65/scripts/images.py | Python | gpl-3.0 | 1,653 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'helpmaindialog.ui'
#
# Created by: PyQt4 UI code generator 4.11.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf... | calebtrahan/KujiIn_Python | backup/guitemplates/helpmaindialog.py | Python | mit | 4,238 |
body = str("""
<td class="ntdefault">
The course chronicles German technological inventions, industrial development and the resulting social changes from the Industrial Revolution through Globalization. Taught in German. Prerequisites: GRMN 2002 or equivalent plus at least one 3000-level course.
<br>
3.000 Credit... | classrank/Grouch | grouch/test/GRMN4694.py | Python | mit | 1,360 |
"""
Copyright (c) 2017 Genome Research Ltd.
Authors:
* Christopher Harrison <ch12@sanger.ac.uk>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your op... | wtsi-hgi/CoGS-Webapp | test/test_dummy.py | Python | agpl-3.0 | 1,003 |
import requests
from bs4 import BeautifulSoup
import tempfile
from imgur import Imgur
import logging
import sys
class Writer():
def get_writing(self, string_to_write):
payload = {
'text':string_to_write,
'bias':0.15,
'samples':1
}
try:
r... | detectica/slurm | slurm/writer.py | Python | mit | 1,325 |
"""Add the DB table SMTPServer in version 2.10
Revision ID: 2ac117d0a6f5
Revises: 20969b4cbf06
Create Date: 2015-12-27 10:17:23.861696
"""
# revision identifiers, used by Alembic.
revision = '2ac117d0a6f5'
down_revision = '20969b4cbf06'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.exc import (Oper... | privacyidea/privacyidea | migrations/versions/2ac117d0a6f5_.py | Python | agpl-3.0 | 1,451 |
"""
This is a subscriber meant for the 'weather' messages example.
It uses a custom code loop to get and process messages.
"""
from __future__ import print_function
import sys
import threading
import time
import Pyro4
from messagebus.messagebus import Subscriber
from Pyro4.util import excepthook
sys.excepthook = excep... | irmen/Pyro4 | examples/messagebus/subscriber_manual_consume.py | Python | mit | 2,432 |
from dependencies.dependency import ClassSecurityInfo
from lims import bikaMessageFactory as _
from lims.utils import t
from lims.browser.bika_listing import BikaListingView
from dependencies.dependency import registerWidget
from dependencies.dependency import TypesWidget
from dependencies.dependency import getToolByNa... | yasir1brahim/OLiMS | lims/browser/widgets/srtemplateartemplateswidget.py | Python | agpl-3.0 | 3,259 |
# Copyright (c) 2010-2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the... | mibanescu/pulp | server/pulp/server/db/migrate/utils.py | Python | gpl-2.0 | 4,273 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.