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 |
|---|---|---|---|---|---|
"""
QUESTION:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
TAGS:
Divide and Conquer Linked List Heap
ANSWER:
Using Heap to control the current candidate of each linked lisk. Every time pop the next node to the result list, time
complexity is O(logk), the the overa... | tktrungna/leetcode | Python/merge-k-sorted-lists.py | Python | mit | 1,231 |
# Copyright (C) 2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | stewartsmith/bzr | bzrlib/url_policy_open.py | Python | gpl-2.0 | 10,733 |
# -*- coding: utf-8 -*-
#
import os
import sys
from recommonmark.parser import CommonMarkParser
sys.path.insert(0, os.path.abspath('..'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readthedocs.settings.sqlite")
from django.conf import settings
import django
django.setup()
sys.path.append(os.path.abspath('_e... | espdev/readthedocs.org | docs/conf.py | Python | mit | 1,855 |
""" msgfmt tool """
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use,... | engineer0x47/SCONS | engine/SCons/Tool/msgfmt.py | Python | mit | 4,385 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2015, Florian Apolloner <florian@apolloner.eu>
#
# This file is part of Ansible
#
# Ansible 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 ... | xpac1985/ansible | test/units/plugins/action/test_action.py | Python | gpl-3.0 | 25,459 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
## emu-net-device.h: ns3::EmuNetDevice [class]
module.add_class('EmuNetDevice', parent=root_module['ns3::NetDevice'])
## Register a nested module for t... | AliZafar120/NetworkStimulatorSPl3 | bindings/python/ns3_module_emu.py | Python | gpl-2.0 | 11,466 |
# -*- coding: utf-8 -*-
import os
import pygame
from thorpy.elements.browserlight import BrowserLight
from thorpy.elements._explorerutils._pathelement import PathElement
from thorpy.elements.element import Element
from thorpy.elements.inserter import Inserter
from thorpy.elements.ddlf import DropDownListFast
from tho... | YannThorimbert/ThorPy-1.4.2 | thorpy/elements/browser.py | Python | mit | 5,547 |
import ast
import json
import re
import urllib
import urlparse
from django.contrib.auth.models import User
from django.core.cache import get_cache
from django.db.models import get_models, get_app
from django.contrib import admin
from django.contrib.admin.sites import AlreadyRegistered
from dateutil import parser
from l... | varunasingh/ustadmobile-tincanlrs | lrs/util/__init__.py | Python | apache-2.0 | 2,736 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui Core.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restric... | karesansui/karesansui | karesansui/db/_2pysilhouette.py | Python | mit | 4,991 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from mock import patch
from sentry.models import (
OrganizationMemberType, Organization, OrganizationStatus
)
from sentry.testutils import APITestCase
class OrganizationDetailsTest(APITestCase):
def test_simple(self):
... | BayanGroup/sentry | tests/sentry/api/endpoints/test_organization_details.py | Python | bsd-3-clause | 3,299 |
import os.path
import urllib.parse
import requests
import rfc6266
import settings
import utilities
from markdown import Extension
from markdown.inlinepatterns import ImagePattern, IMAGE_LINK_RE
class ImageDownloadPattern(ImagePattern):
def handleMatch(self, match):
el = super(ImageDownloadPattern, self)... | Tigge/trello-to-web | markdown_imaged.py | Python | mit | 1,141 |
from jroc.pipelines.Pipeline import Pipeline
from BasicPipeline import BasicPipeline
| domenicosolazzo/jroc | jroc/pipelines/basic/__init__.py | Python | gpl-3.0 | 85 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | nop33/indico | indico/legacy/services/implementation/search.py | Python | gpl-3.0 | 3,854 |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... | jferreir/mbed | workspace_tools/paths.py | Python | apache-2.0 | 3,374 |
import csp
rgb = ['R', 'G', 'B']
d2 = { 'A' : rgb, 'B' : rgb, 'C' : ['R'], 'D' : rgb,}
v2 = d2.keys()
n2 = {'A' : ['B', 'C', 'D'],
'B' : ['A', 'C', 'D'],
'C' : ['A', 'B'],
'D' : ['A', 'B'],}
def constraints(A, a, B, b):
if A == B: # e.g. NSW == NSW
return True
if a == b: ... | WmHHooper/aima-python | submissions/aardvark/myCSPs.py | Python | mit | 1,655 |
"""Simple differential equation."""
from __future__ import print_function
from pylab import figure, show
from pacal.depvars.models import Model
from pacal.depvars.nddistr import NDProductDistr, Factor1DDistr
from numpy import *
from pacal import *
from pylab import plot, semilogx, xlabel, ylabel, axis, loglog, fi... | jszymon/pacal | tests/examples/diffeq.py | Python | gpl-3.0 | 2,141 |
class PixelArray:
"""Implements a array of pixels"""
def __init__(self, number_of_cols, number_of_rows, fill_strategy_recursive=False):
"""
Initializer a PixelArray object
:param number_of_cols: Number of columns
:param number_of_rows: Number of rows
:param fill_strategy_... | paulo-romano/pixelarray | pixelarray.py | Python | gpl-3.0 | 12,206 |
print id("foo").__class__ == int
print id(2) == id(2)
print id(2) <> id(3)
| buchuki/pyjaco | tests/builtin/id.py | Python | mit | 75 |
import cv2
import math
import numpy as np
import time
class Vision(object):
def __init__(self, source, hslRange, coordinates, cameraMatrix):
self.hslRange = hslRange
self.focalLength = 980
self.realCoordinates = np.array(coordinates, dtype=np.float)
self.cameraMatrix = np.array(cameraMatrix['matrix'... | 3299/visioninabox | helpers/calculations.py | Python | mit | 3,346 |
"""Config Reply message tests."""
from pyof.v0x04.controller2switch.get_config_reply import GetConfigReply
from tests.unit.test_struct import TestStruct
class TestGetConfigReply(TestStruct):
"""Config Reply message tests."""
@classmethod
def setUpClass(cls):
"""Configure raw file and its object i... | kytos/python-openflow | tests/unit/v0x04/test_controller2switch/test_get_config_reply.py | Python | mit | 543 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ==============
# Vulners search API usage example
# ==============
import vulners
vulners_api = vulners.Vulners(api_key="YOUR_API_KEY_HERE")
wordpress_exploits = vulners_api.searchExploit("wordpress 4.7.0") | vulnersCom/api | samples/exploits.py | Python | gpl-3.0 | 261 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class Partner(models.Model):
_inherit = 'res.partner'
team_id = fields.Many2one('crm.team', string='Sales Channel', oldname='section_id')
opportunity_ids = fields.One2... | Aravinthu/odoo | addons/crm/models/res_partner.py | Python | agpl-3.0 | 1,672 |
#!/data/project/nullzerobot/python/bin/python
# -*- coding: utf-8 -*-
messages = {}
messages['th'] = {
'categorymover-title': u'บริการย้ายหมวดหมู่',
'categorymover-table-id': u'รหัส',
'categorymover-row-edit': u'แก้ไข',
'categorymover-row-approve': u'รับรอง',
'categorymover-row-reject': u'ปฎิเสธ'... | nullzero/wpcgi | wpcgi/tools/categorymover/i18n.py | Python | mit | 1,581 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2017 Red Hat, 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 applicab... | redhat-cip/dci-ansible | module_utils/dci_common.py | Python | apache-2.0 | 6,236 |
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use("seaborn-muted")
import seaborn as sns
import argparse
import glob
parser = argparse.ArgumentParser(description="generate figures for class frequency distribution")
parser.add_argument("--train",type=str,help="path to train data")
parser.add_argument("... | williamdjones/protein_binding | paper/gen_train_test_kinase_dist_figures.py | Python | mit | 1,080 |
"""Cement core hooks module."""
import operator
from ..core import backend, exc
Log = backend.minimal_logger(__name__)
def define(name):
"""
Define a hook namespace that plugins can register hooks in.
Required arguments:
name
The name of the hook, stored as hooks['name']
... | derks/cement | cement/core/hook.py | Python | bsd-3-clause | 3,400 |
"""
Various data structures used in query construction.
Factored out from django.db.models.query to avoid making the main module very
large and/or so that they can be used by other modules without getting into
circular import difficulties.
"""
import copy
import functools
import inspect
from collections import namedtu... | edmorley/django | django/db/models/query_utils.py | Python | bsd-3-clause | 12,027 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache... | mycFelix/heron | heron/instance/tests/python/utils/topology_context_impl_unittest.py | Python | apache-2.0 | 2,275 |
from abc import ABCMeta, abstractmethod
class Environment(metaclass=ABCMeta):
@property
@abstractmethod
def actions(self):
"""Possible actions that a robot can conduct in this environment.
Actions must be somthing that can be compared using == in Python,
for example, one shouldn'... | cyber-meow/Robotic_state_representation_learning | inter/interfaces.py | Python | mit | 1,695 |
# Mercurial extension to provide the 'hg bookmark' command
#
# Copyright 2008 David Soria Parra <dsp@php.net>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''track a line of development with movable markers
Bookmarks are local... | consulo/consulo-mercurial | src/test/resources/bin/hgext/bookmarks.py | Python | apache-2.0 | 11,771 |
### BEGIN LICENSE
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it... | yusiwen/uberwriter | uberwriter/UberwriterTextEditor.py | Python | gpl-3.0 | 15,127 |
# coding: utf-8
from __future__ import unicode_literals
import itertools
import json
from .naver import NaverBaseIE
from ..compat import (
compat_HTTPError,
compat_str,
)
from ..utils import (
ExtractorError,
int_or_none,
merge_dicts,
str_or_none,
strip_or_none,
try_get,
urlencode_... | rbrito/pkg-youtube-dl | youtube_dl/extractor/vlive.py | Python | unlicense | 11,883 |
import numpy as np
import matplotlib.pyplot as plt
import os
path = "/Users/petermarinov/msci project/all code/ecg rotor no rotor/rotor tau/"
filenames = []
for f in os.listdir(path):
if not f.startswith('.'):
filenames.append(f)
filenames = np.sort(filenames)
total_time = 10000.
data = np.zeros((200,2... | pm2111/Heart-Defibrillation-Project | last few python scripts/apd_series_taus.py | Python | mit | 1,701 |
# encoding: utf-8
from distutils.core import setup
from setuptools import find_packages
import assets_angular
setup(
name='assets_angular',
version=assets_angular.VERSION,
author='José Sánchez Moreno',
author_email='jose@o2w.es',
packages=find_packages(),
license='MIT',
description=u'Djan... | josesanch/assets_angular | setup.py | Python | mit | 858 |
#!/usr/bin/env python
#-*-*- encoding: utf-8 -*-*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individual... | weblabdeusto/weblabdeusto | server/src/weblab/admin/bot/data.py | Python | bsd-2-clause | 11,257 |
import cPickle
class GameState:
# g = GameState(11,22,3,4,5) init
# g.pickle('test.gamestate') save
# x = GameState().unpickle('test.gamestate') load
def __init__(self,rulesfile=None,turns=None,connection=None,
cache=None,verbosity=None, pickle_location=None):
if pickle_location is None:
self.rulesfile ... | thousandparsec/daneel-ai | picklegamestate.py | Python | gpl-2.0 | 689 |
"""
Contains specific details for Yandex speller
"""
import collections
import logging
from typing import Iterable, Dict, List
from urllib.parse import urlencode
import requests
from .errors import BadArgumentError
from .speller import Speller
class YandexSpeller(Speller):
"""
Yandex speller implementation... | oriontvv/pyaspeller | src/pyaspeller/yandex_speller.py | Python | apache-2.0 | 8,186 |
# encoding: utf-8
"""Use the HTMLParser library to parse HTML files that aren't too bad."""
# Use of this source code is governed by the MIT license.
__license__ = "MIT"
__all__ = [
'HTMLParserTreeBuilder',
]
from HTMLParser import HTMLParser
try:
from HTMLParser import HTMLParseError
except ImportError... | deanishe/alfred-duden | src/lib/bs4/builder/_htmlparser.py | Python | mit | 13,171 |
#!/usr/bin/env python
# encoding: utf-8
"""
https://github.com/SawdustSoftware/simpleflake
Usage:
from simpleflake import simpleflake
print(simpleflake())
This is a patched version with hexa support.
See https://github.com/jabbalaci/simpleflake
"""
from __future__ import (absolute_import, division,
... | jabbalaci/PrimCom | lib/simpleflake.py | Python | gpl-2.0 | 2,623 |
# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# contributed by Joerg Baumann
from contextlib import closing
from itertools import islice
from os import cpu_count
from sys import argv, stdout
def pixels(y, n, abs):
range7 = bytearray(range(7))
pixel_bits = bytearray(128 >... | ikinz/Benchmark-exjobb | Test/Test-Mandelbrot/python/TestMandelbrot.py | Python | mit | 1,809 |
from ui_order import Ui_Order
from PyQt4 import QtGui, QtCore
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from diffpy.pyfullprof.refine import Constraint
from run import Run
from paramlist import ParamList
import paramgroup
from auto import autorun
import os
import com
try:
_fromUtf8 = QtCore.QString.fromU... | xpclove/autofp | ui_order_set.py | Python | gpl-3.0 | 4,120 |
r"""
Prototype for object model backend for the libNeuroML project
"""
import numpy as np
import neuroml
class ArrayMorphology(neuroml.Morphology):
"""Core of the array-based object model backend.
Provides the core arrays - vertices,connectivity etc.
node_types.
The connectivity array is a list of ... | NeuralEnsemble/libNeuroML | neuroml/arraymorph.py | Python | bsd-3-clause | 9,631 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py | Python | mit | 15,441 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Brocade Communications System, 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
#
# ... | wallnerryan/quantum_migrate | quantum/plugins/brocade/db/models.py | Python | apache-2.0 | 4,646 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0009_auto_20160216_1117'),
]
operations = [
migrations.RemoveField(
model_name='fatalityrate',
... | rukayaj/eia | core/migrations/0010_auto_20160216_1245.py | Python | gpl-2.0 | 599 |
#!/usr/bin/env python3
import cgi
import cgitb
import os
import sys
sys.stderr = sys.stdout
import configparser
cgitb.enable()
cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ.get('MEGACFG', '~/.megacfg')))
paths = cfg.get("System", "pythonInclude").split(":")
for path in paths:
sys.path.... | tiagoantao/mega-analysis | web/study.py | Python | agpl-3.0 | 4,327 |
"""SciTechStrategies Research Level Model
Usage:
rlev_model.py <infile> [--encoding=<encoding>]
Options:
-h --help Show this screen
--encoding=<encoding> The encoding of the input text. Default is ISO-8859-2
"""
import codecs
import cPickle as pickle
import os
import gzip
from docopt import doco... | SciTechStrategies/rlev-model | rlev_model.py | Python | mit | 4,156 |
# Copyright 2018 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | kubeflow/pipelines | sdk/python/kfp/__init__.py | Python | apache-2.0 | 968 |
# some text in the file
| gerboland/play | file.py | Python | gpl-3.0 | 24 |
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.test.compat import gc_collect
from sqlalchemy.test import TestBase, AssertsExecutionResults, profiling, testing
from test.orm import _fixtures
# in this test we are specifically looking for time spent in the attributes.InstanceState.__cleanup() met... | obeattie/sqlalchemy | test/perf/sessions.py | Python | mit | 2,847 |
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QApplication
from Orange.data import Table
from Orange.widgets import settings, gui
from Orange.widgets.utils.owlearnerwidget import OWBaseLearner
from orangecontrib.recommendation import SVDPlusPlusLearner
from orangecontrib.recommendation.utils import format_data
... | salvacarrion/orange3-recommendation | orangecontrib/recommendation/widgets/owsvdplusplus.py | Python | bsd-2-clause | 10,379 |
def extractLemontreetranslationsWordpressCom(item):
'''
Parser for 'lemontreetranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('qt second female lead', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractLemontreetranslationsWordpressCom.py | Python | bsd-3-clause | 1,080 |
import pandas as pd
class Csv(object):
"""The core CSV input / output class.
Args:
path (str): The path of the input / output csv.
Returns:
A pandas dataframe representing the csv data.
"""
def __init__(self, path, header=None):
self._path = path
self._header = he... | smacpher/python-ml | pyml/data.py | Python | mit | 1,098 |
# vim: set expandtab sw=4 softtabstop=4 fileencoding=utf8 :
#
# Copyright 2014-2015 Johan Ström
#
# This python package 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... | stromnet/pyowmaster | pyowmaster/event/events.py | Python | gpl-3.0 | 4,220 |
"""
Django settings for xin_mysite project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build p... | jayzane/sources-of-Xin.com | price/xin_mysite/xin_mysite/settings.py | Python | apache-2.0 | 2,769 |
import os
from flask import (Flask, request, Response, g, flash,
render_template, url_for, redirect, send_from_directory,
send_file, make_response, abort, session)
from papylus import app
from authomatic.adapters import WerkzeugAdapter
from authomatic import Authomatic
# routing for AP... | kmagai/papylus | papylus/controllers.py | Python | mit | 5,340 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import re
import os
import sys
name = 'django-authy-admin'
package = 'authy_admin'
description = "A drop in replacement for django's default admin site that provides two-factor authentication via authy's REST API."
url = 'http://github.com/jh... | jhmaddox/django-authy-admin | setup.py | Python | mit | 2,086 |
# -*- coding: utf-8 -*-
import re
import select
import socket
import ssl
import time
import traceback
import pycurl
from threading import Thread
from module.Api import PackageDoesNotExists, FileDoesNotExists
from module.plugins.internal.Notifier import Notifier
from module.internal.misc import formatSize
class IR... | Guidobelix/pyload | module/plugins/hooks/IRC.py | Python | gpl-3.0 | 14,730 |
import base64
import os
import re
import subprocess
from itertools import takewhile
from django.utils.encoding import force_unicode
try:
from staticfiles import finders
except ImportError:
from django.contrib.staticfiles import finders # noqa
from pipeline.conf import settings
from pipeline.utils import to_... | vbabiy/django-pipeline | pipeline/compressors/__init__.py | Python | mit | 9,151 |
import sys
import re
import boto
import os
from boto import ec2
from datetime import date
sys.path.append("alfajor")
from aws_base import AWS_BASE
class SnapShotDeleter(AWS_BASE):
def init(self):
self.set_conn(boto.ec2.connect_to_region(**self.get_connection_settings()))
def get_days(self, str):
creation_... | base2Services/alfajor | alfajor/snapshot_deleter.py | Python | mit | 4,322 |
'''
implements american m209 cipher
Author: James Lyons
Created: 2012-04-28
'''
from pycipher.base import Cipher
class M209(Cipher):
''' The M209 cipher. The key consists of several parameters.
:param wheel_starts: The rotor start positions, consists of 6 characters e.g. "AAAAAA". Note that not all chara... | jameslyons/pycipher | pycipher/m209.py | Python | mit | 6,125 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... | JamesLinEngineer/RKMC | addons/plugin.video.salts/scrapers/fmovie_scraper.py | Python | gpl-2.0 | 3,681 |
# ASN.1 "universal" data types
import operator, sys, math
from pyasn1.type import base, tag, constraint, namedtype, namedval, tagmap
from pyasn1.codec.ber import eoo
from pyasn1.compat import octets
from pyasn1 import error
# "Simple" ASN.1 types (yet incomplete)
class Integer(base.AbstractSimpleAsn1Item):
tagSet... | geofft/pyasn1 | pyasn1/type/univ.py | Python | bsd-2-clause | 44,604 |
class brokerServer(object):
"""
Broker server classes are called by the brokers server application (eg IB Gateway)
We inherit from this and then write hooks from the servers native methods into the methods in this base class
"""
def __init__(self):
pass
def action_to_take_when_time_... | cmorgan/pysystemtrade | sysbrokers/baseServer.py | Python | gpl-3.0 | 386 |
def is_supported(feature_name):
return feature_name in is_supported.exts
def support_all(feature_names):
for feature_name in feature_names:
if not is_supported(feature_name):
return False
return True
def support_one(feature_names):
for feature_name in feature_names:
if is_supported(feature_name):
return... | zhangf911/KlayGE | KlayGE/Tools/media/GLCompatibility/GLCompatibility.py | Python | gpl-2.0 | 23,960 |
#!/usr/bin/env python
from __future__ import print_function
import sys
from tempfile import TemporaryFile
from zipfile import ZipFile
import boto3
from botocore.exceptions import ClientError
assume_role_policy_document = """{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow"... | shawnsi/amicleanup | upload.py | Python | mit | 2,399 |
################################################################################
# Copyright (C) 2015 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
"""
Black-box variational inference
"""
import numpy as np
import sc... | SalemAmeen/bayespy | bayespy/demos/black_box.py | Python | mit | 3,429 |
#!/usr/bin/env python
# Copyright (c) 2012 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND T... | jimpelton/mingle-logcabin | scripts/initlog.py | Python | isc | 2,928 |
from hortee.settings import *
DEBUG=True
TEMPLATE_DEBUG=DEBUG
| bne/hortee | hortee/development.py | Python | apache-2.0 | 63 |
import unittest
from datetime import datetime
from pyramid.registry import Registry
from lxml import etree
from mock import patch
from booksoai import pipeline
class TestSetupPipe(unittest.TestCase):
def test_setup_add_root_xml_element(self):
data = {}
pipe = pipeline.SetupPipe()
resp_x... | scieloorg/books-oai | booksoai/tests/test_pipeline.py | Python | bsd-2-clause | 18,878 |
class Solution(object):
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
x = nums[0]
l = len(nums)
for i in list(range(1, l)):
x ^= nums[i]
l += 1
for i in list(range(0, l)):
x ^= i
return x
| hawkphantomnet/leetcode | MissingNumber/Solution.py | Python | mit | 271 |
import mysql.connector
from model.group import Group
from model.contact import Contact
class DbFixture:
#все контакты
sel_all_cont = "select distinct a.id, a.firstname, a.middlename, a.lastname, a.nickname, a.address, " \
"a.email, a.email2, a.email3, a.home, a.mobile, a.work, a.phone2 " \
... | vspitsyn/python_taining | fixture/db.py | Python | apache-2.0 | 4,625 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: groundstation/objects/root_object.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import descriptor_pb2
# @@protoc_... | richo/groundstation | groundstation/objects/root_object_pb2.py | Python | mit | 2,832 |
import json
import requests
import copy
from requests.exceptions import ConnectionError
from distutils.version import LooseVersion
requests.packages.urllib3.disable_warnings()
HEADERS = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'User-Agent': 'fxosREST'
}
class FXOSApiException... | kaisero/fxosREST | fxos.py | Python | gpl-3.0 | 14,707 |
# -*- coding: 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 'Block.body'
db.alter_column(u'pages_block', 'body', self.gf('redactor.fields.RedactorFiel... | jpic/pescator | pages/migrations/0004_auto__chg_field_block_body.py | Python | bsd-2-clause | 4,451 |
import urllib
import simplejson
class Stripe:
"""
Usage:
key='<api key>'
d = Stripe(key).charge(
amount=100,
currency='usd',
card_number='4242424242424242',
card_exp_month='5',
card_exp_year='2012',
card_cvc_chec... | jefftc/changlab | web2py/gluon/contrib/stripe.py | Python | mit | 2,552 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_tonalanalysistools_ScaleDegree__initialize_by_number_01():
degree = tonalanalysistools.ScaleDegree(2)
assert degree.accidental == pitchtools.Accidental('')
assert degree.number == 2
def test_tonalanalysistools_ScaleDegree__initialize_by_number_02()... | mscuthbert/abjad | abjad/tools/tonalanalysistools/test/test_tonalanalysistools_ScaleDegree__initialize_by_number.py | Python | gpl-3.0 | 535 |
from setuptools import setup
import ed25519
setup(
name="ed25519.py",
version=ed25519.__version__,
py_modules=["ed25519"],
zip_safe=False,
)
| pyca/ed25519 | setup.py | Python | cc0-1.0 | 160 |
def helper(got,expect):
if got == expect: print True
else: print False,expect,got
print "\nstr.split()"
helper(''.split(),[])
helper(''.split(None),[])
helper(''.split(None,1),[])
helper(''.split('a'),[''])
helper(''.split('a',1),[''])
helper('hello'.split(),['hello'])
helper('hello'.split(None),['hello'])
h... | ArcherSys/ArcherSys | skulpt/test/run/t442.py | Python | mit | 3,705 |
# coding=utf-8
"""Unittest for Earthquake Report."""
import os
import io
import shutil
import unittest
from jinja2.environment import Template
from qgis.core import QgsCoordinateReferenceSystem
from safe.definitions.constants import ANALYSIS_SUCCESS, INASAFE_TEST
from safe.definitions.reports.components import (
... | AIFDR/inasafe | safe/report/test/test_impact_report_earthquake.py | Python | gpl-3.0 | 10,484 |
import threading
import urllib
class MultiUrl(threading.Thread):
def __init__(self, url):
threading.Thread.__init__(self)
self.url = url
def run(self):
urllib.urlopen(self.url).read()
background = MultiUrl('http://slashdot.org')
background.start()
print 'main continues'
background.join... | beqa2323/learntosolveit | languages/python/software_engineering_simple_threading1.py | Python | bsd-3-clause | 345 |
#!/usr/bin/env py.test
"Unit tests for the mesh library"
# Copyright (C) 2006 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 o... | FEniCS/dolfin | test/unit/python/mesh/test_sub_mesh.py | Python | lgpl-3.0 | 3,919 |
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contract 89233218CNA000001 #
... | CSD-Public/stonix | src/stonix_resources/rules/DisableGUILogon.py | Python | gpl-2.0 | 22,537 |
from __future__ import absolute_import
import sys
__future_module__ = True
if sys.version_info[0] < 3:
from thread import *
else:
raise ImportError('This package should not be accessible on Python 3. '
'Either you are trying to run from the python-future src folder '
... | thonkify/thonkify | src/lib/_thread/__init__.py | Python | mit | 377 |
from __future__ import print_function
__copyright__ = """
Copyright 2021 Samapriya Roy
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/LICENS... | samapriya/gee_asset_manager_addon | geeadd/batch_mover.py | Python | apache-2.0 | 9,852 |
# Copyright 2013 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 agreed to in... | takeshineshiro/keystone | keystone/contrib/endpoint_filter/migrate_repo/versions/001_add_endpoint_filtering_table.py | Python | apache-2.0 | 1,228 |
import hail as hl
import argparse
raw_data_root = 'gs://hail-datasets-raw-data/CADD'
hail_data_root = 'gs://hail-datasets-hail-data'
parser = argparse.ArgumentParser()
parser.add_argument('-v', required=True, help='CADD version.')
parser.add_argument('-b', required=True, choices=['GRCh37', 'GRCh38'], help='Ensembl r... | danking/hail | datasets/load/load.CADD.py | Python | mit | 1,512 |
from __future__ import absolute_import
from .. import log; log = log[__name__]
from .treetypes import (
ObjectCol,
BoolCol, BoolArrayCol,
CharCol, CharArrayCol,
UCharCol, UCharArrayCol,
ShortCol, ShortArrayCol,
UShortCol, UShortArrayCol,
IntCol, IntArrayCol,
UIntCol, UIntArrayCol,
... | ndawe/rootpy | rootpy/tree/__init__.py | Python | bsd-3-clause | 1,139 |
# 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
# distribu... | romanchyla/pylucene-trunk | jcc/jcc/cpp.py | Python | apache-2.0 | 46,521 |
# -*- coding: utf-8 -*-
#
# Cherokee-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2001-2011 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free S... | nuxleus/cherokee-webserver | admin/market/PageIndex.py | Python | gpl-2.0 | 5,751 |
# This file is part of OpenHatch.
# Copyright (C) 2009 OpenHatch, Inc.
#
# 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 later v... | jledbetter/openhatch | mysite/profile/migrations/0016_asheesh_make_project_and_project_name_unique_in_projectexp.py | Python | agpl-3.0 | 6,100 |
###################################
## SPADE formant analysis script ##
###################################
## Processes and extracts 'static' (single point) formant values, along with linguistic
## and acoustic information from corpora collected as part of the SPeech Across Dialects
## of English (SPADE) project.
##... | MontrealCorpusTools/SPADE | formant.py | Python | mit | 4,664 |
from __future__ import absolute_import, unicode_literals
import hmac
import json
import requests
import uuid
from datetime import timedelta
from django.db.models import Q
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, Group
from django.db imp... | reyrodrigues/EU-SMS | temba/api/models.py | Python | agpl-3.0 | 23,231 |
from apiwrapper.endpoints.endpoint import Endpoint
from apiwrapper.endpoints.user import User
class DraftShareInviteBank(Endpoint):
__endpoint_share_draft = "draft-share-invite-bank"
__endpoint_share_draft_qr = "qr-code-content"
@classmethod
def _get_base_endpoint(cls, user_id, draft_id=None):
... | OGKevin/ComBunqWebApp | apiwrapper/endpoints/draft_share_invite_bank.py | Python | mit | 1,079 |
# This file is part of the Perspectives Notary Server
#
# Copyright (C) 2011 Dan Wendlandt
#
# 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, version 3 of the License.
#
# This progra... | danwent/Perspectives-Server | notary_util/notary_common.py | Python | gpl-3.0 | 902 |
from parsley.decorators import parsleyfy
class ParsleyAdminMixin(object):
def get_form(self, *args, **kwargs):
form = super(ParsleyAdminMixin, self).get_form(*args, **kwargs)
return parsleyfy(form)
class Media:
js = (
"parsley/js/parsley-standalone.min.js",
"p... | Tivix/Django-parsley | parsley/mixins.py | Python | bsd-3-clause | 366 |
# Concept profile generation and analysis for Gene-Disease paper
# Copyright (C) 2015 Biosemantics Group, Leiden University Medical Center
# Leiden, The Netherlands
#
# 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 ... | BiosemanticsDotOrg/GeneDiseasePlosBio | python-script/script/test/co-occurenace-stats.py | Python | agpl-3.0 | 2,222 |
'''
Copyleft Nov 13, 2015 Arya Iranmehr, PhD Student, Bafna's Lab, UC San Diego, Email: airanmehr@gmail.com
'''
from Scripts.Miscellaneous import logit,Z,sig_,floatX , T, np, pd, theano, time,sig,Nu
from Utils import Estimate
class MultiLocusHAFOptimizingAllVarsVariableTime:
"""
by convention
1) symboli... | airanmehr/bio | Scripts/Miscellaneous/RNN/MultiLocusHAFOptimizingAllVarsVariableTime.py | Python | mit | 11,871 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/streamanalytics/azure-mgmt-streamanalytics/azure/mgmt/streamanalytics/operations/_functions_operations.py | Python | mit | 40,271 |
import demistomock as demisto
from CommonServerPython import *
import subprocess
import re
def main():
try:
dest = demisto.args()['address']
ping_out = subprocess.check_output(
['ping', '-c', '3', '-q', dest], stderr=subprocess.STDOUT, universal_newlines=True
)
s = re.s... | demisto/content | Packs/CommonScripts/Scripts/Ping/Ping.py | Python | mit | 1,264 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.