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
# Author : Qin Gao
# Date : Dec 31, 2007
# Purpose: Combine multiple alignment files into a single one, the files are
# prodcuced by MGIZA, which has sentence IDs, and every file is
# ordered inside
import sys
import re
if len(sys.argv)<2:
sys.stderr.write("Provide me the f... | kpu/joshua | scripts/training/MGIZA/scripts/merge_alignment.py | Python | lgpl-2.1 | 1,790 |
import hashlib
import json
import urllib2
from django.core.cache import cache
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
# default settings
MAILTEST_USE_HTTPS = \
getattr(settings, 'MAILTEST_USE_HTTPS', True)
MAILTEST... | naremit/django-mailtestfield | mailtest/validators.py | Python | bsd-3-clause | 2,418 |
# Generated by Django 2.2.13 on 2020-06-16 20:27
from django.db import migrations
ADD_NOT_APPLICABLE_INTENDED_WATER_USE_CODE = """
INSERT INTO intended_water_use_code
(
create_user,
create_date,
update_user,
update_date,
display_order,
... | bcgov/gwells | app/backend/wells/migrations/0115_update_well_class_indended_water_use_20200616_2027.py | Python | apache-2.0 | 2,631 |
#!/usr/bin/env python
"""
tree_sim: Simulate a phylogeny for a specified set of taxa
Usage:
tree_sim [options] list <genome_list>
tree_sim [options] comm <comm_file>
tree_sim -h | --help
tree_sim --version
Options:
<genome_list> A file listing: taxonName<tab>genomeSeqFileName
<comm_file> ... | nick-youngblut/SIPSim | SIPSim/Commands/Tree_sim.py | Python | mit | 3,159 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-06-09 20:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comercial', '0013_pendenciafaturamento'),
]
operations = [
migrations.AddF... | anselmobd/fo2 | src/comercial/migrations/0014_metafaturamento_ativa.py | Python | mit | 464 |
ROOTPATH = None
main = {
'path': None
}
graphics = {
'width' : 800,
'height': 600,
'resizable': 0
}
kivy = {
'exit_on_escape': 0,
'window_icon' : 'assets/logo.png',
'log_dir' : '/home/kzvlfz/ubuntu/stigma-game-demo/logging',
'log_name' : 'stigma_%y-%m-%d_%_.txt'
}
| Kzulfazriawan/stigma-game-demo | config/base.py | Python | mit | 313 |
import collections
import difflib
import aiohttp
from pyquery import PyQuery as pq
BASE_URL = "http://www.anime-planet.com"
session = aiohttp.ClientSession()
def sanitiseSearchText(searchText):
return searchText.replace('(TV)', 'TV')
async def getAnimeURL(searchText):
try:
searchText = sanitiseSe... | MaT1g3R/Roboragi | roboragi_old/AnimePlanet.py | Python | mit | 5,147 |
# Copyright The IETF Trust 2007, All Rights Reserved
# Portion Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... | mcr/ietfdb | ietf/utils/test_runner.py | Python | bsd-3-clause | 5,291 |
# The StringAccessor class defined below is an adaptation of the
# pandas string methods source code (see pd.core.strings)
# For reference, here is a copy of the pandas copyright notice:
# (c) 2011-2012, Lambda Foundry, Inc. and PyData Development Team
# All rights reserved.
# Copyright (c) 2008-2011 AQR Capital Man... | pydata/xarray | xarray/core/accessor_str.py | Python | apache-2.0 | 86,329 |
class Player():
def __init__(self,name):
self.cards=[]
self.score=0
self.money=100
self.name=name
def get_score(self):
return self.score
def drop_cards(self):
self.cards=[]
self.score=0 | libeadier/simple_black_jack | player.py | Python | gpl-3.0 | 263 |
import re
import actions
class Command(object):
def __init__(self):
pass
@classmethod
def parse_command(cls, line):
""" Factory method to create a command from a line. """
words = line.split(" ")
if not len(words):
return None
command_name = words[0].lo... | s1341/pyg13 | commands.py | Python | apache-2.0 | 2,623 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import timedelta
try:
import unittest.mock as mock
except ImportError:
import mock
from django.utils import timezone
from django.core.management import call_command
from django.test import TestCase
from django.utils.six import Stri... | thornomad/django-hitcount | tests/test_hitcount_cleanup.py | Python | mit | 1,564 |
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 2013-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/klepto/LICENSE
#FIXME: klepto's caches igno... | RaoUmer/klepto | klepto/_inspect.py | Python | bsd-3-clause | 19,865 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...format import Format
class TestInitialisation(unittest.Te... | jmcnamara/XlsxWriter | xlsxwriter/test/format/test_initialisation.py | Python | bsd-2-clause | 805 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page_test
from telemetry.timeline import tracing_category_filter
from telemetry.web_perf import timeline_based_measurement
class... | Pluto-tv/chromium-crosswalk | tools/perf/measurements/smoothness.py | Python | bsd-3-clause | 3,112 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import re
from .mudevents import Handler
from .world import DIRECTIONS
directionsRegexp = "|".join([d.title() for d i... | nstockton/tintin-mume | mapperproxy/mapper/cleanmap.py | Python | gpl-2.0 | 1,084 |
#! /usr/bin/python2
#
# Copyright 2010-2011 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 applica... | ellert/globus-toolkit | myproxy/oauth/source/wsgi.py | Python | apache-2.0 | 4,948 |
#!/usr/bin/env python
#
# Copyright 2006,2007,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your ... | tyc85/nwsdr-3.6.3-dsc | gr-uhd/examples/python/usrp_wfm_rcv_sca.py | Python | gpl-3.0 | 16,478 |
import unittest
from llvm.core import Type, Module, Builder, Constant
from .support import TestCase, tests
class TestStruct(TestCase):
def test_struct_identical(self):
ta = Type.struct([Type.int(32), Type.float()], name='ta')
tb = Type.struct([Type.int(32), Type.float()])
self.assertTrue(ta... | llvmpy/llvmpy | llvm/tests/test_struct.py | Python | bsd-3-clause | 962 |
#!/usr/bin/env python3
"""
Created on 10 Nov 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
examples:
{"msg": null, "err": {"code": "UNKNOWN_CMD", "value": "hello"}}
{"msg": {"op": "scs-rpi-006", "spec": "scs-rpi-006"}, "err": null}
"""
import json
from scs_core.data.json import JSONify
from scs_c... | south-coast-science/scs_core | tests/osio/osio_topic_test.py | Python | mit | 1,465 |
'''
ListAdapter
=================
.. versionadded:: 1.5
.. warning::
This code is still experimental, and its API is subject to change in a
future version.
A :class:`ListAdapter` is an adapter around a python list and adds support
for selection operations. If you wish to have a bare-bones list adapter,
with... | bliz937/kivy | kivy/adapters/listadapter.py | Python | mit | 17,967 |
import html
import inflect
import titlecase
from flask import url_for
from shared.pd_exception import DoesNotExistException
from .. import APP, importing
from ..data import match
from ..view import View
@APP.route('/match/<int:match_id>/')
def show_match(match_id: int) -> str:
view = Match(match.get_match(matc... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | logsite/views/match_view.py | Python | gpl-3.0 | 2,353 |
import os
import inspect
class Plugin:
def __init__(self, name, dataset_plugins=None, attribute_plugins=None,
file_plugins=None, group_plugins=None, raw_plugins=None,
write_before=None, write_after=None,
read_before=None, read_after=None):
self.name = nam... | CINPLA/exdir | exdir/plugin_interface/plugin_interface.py | Python | mit | 8,769 |
# -*- coding: utf-8 -*-
"""
strings2pot
-----------
This utility helps you to get localization strings
from your Apple or Android applications.
:copyright: (c) 2016 Qurami srl.
:license: MIT, see LICENSE for more details.
"""
import re
import sys
import codecs
from os import path
from setupto... | qurami/strings2pot | setup.py | Python | mit | 1,716 |
# DON'T MODIFY THIS FILE. Version and git commit will be written by build pipeline
__version__="N/A"
__build__="N/A"
__githash__= "N/A"
__buildurl__=None
__date__= "2017-04-26T09:11:18Z"
| 1001genomes/AraGWAS | aragwas_server/gwasdb/__init__.py | Python | mit | 187 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | QISKit/qiskit-sdk-py | qiskit/visualization/pulse_visualization.py | Python | apache-2.0 | 3,410 |
import BaseHTTPServer, SimpleHTTPServer
import subprocess, shlex
import ssl
import time
import os
from optparse import OptionParser
port = 4443
execfile('./variables.py')
parser = OptionParser()
parser.add_option('-p', "--port", dest='port', help='Run HTTPS server on PORT', metavar='PORT')
(options, args) = parser.... | SelfKit/SelfKit | web/server.py | Python | gpl-3.0 | 2,036 |
"""
Select random lines from a gzipped file and write them to another file
"""
from __future__ import print_function
import sys
import argparse
import gzip
import random
from progressbar import ProgressBar, Bar, Percentage
def naive_count_lines(infile):
""" Count lines in a gzip JSON LD file """
n = 0
... | lrei/twitter_sentiment_gen | select_random.py | Python | mit | 2,775 |
# 7:17
import os
if os.path.isfile('.env'):
for line in open('.env'):
line = line.strip().split('=')
if len(line) == 2:
os.environ[line[0]] = line[1]
from app import create_app, db
from app import User, Role
from flask.ext.script import Shell, Manager
from flask.ext.migrate import Mig... | mfwarren/FreeCoding | 2014/12/fc_28/manage5.py | Python | mit | 849 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from .base import BaseComplexElasticsearchType
from .basic import *
class FlagElasticsearchType(BaseComplexElasticsearchType):
"""
This is an Elasticsearch type for representing a flag.
"""
def to_dict(self):
return {
... | lavalamp-/ws-backend-community | wselasticsearch/models/types/flags.py | Python | gpl-3.0 | 590 |
import multiprocessing as mp
import sqlite3
# IDEA:
# - baza partycjonowana po czasie oparta o sqlite
# - partycja obslugiwana w osobnym, rownoleglym procesie
# - map -> zapytania sql wewnatrz partycji
# - combine -> za pomoca sqla lub pythona
# - reduce -> za pomoca pythona
def worker(id,pipe):
db = sqlite3.connect... | mobarski/sandbox | tpdb/v1.py | Python | mit | 2,006 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def zigzagLevelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
... | Mlieou/leetcode_python | leetcode/python/ex_103.py | Python | mit | 813 |
import os
import pyglet
class ControlPanelError(Exception): pass
class ControlPanelSkinError(Exception): pass
class ControlPanel(object):
def __init__(self, skin_name):
self.skin_name = skin_name
self.cached_skins = {}
self.switch_skin(self.skin_name)
def _cache_skin(self, skin_n... | sunfall/delta_trace | src/control_panel.py | Python | gpl-3.0 | 1,330 |
from __future__ import absolute_import, unicode_literals
from django.utils.functional import cached_property
from django.utils.html import format_html
from wagtail.wagtailcore.blocks import ChooserBlock
class DocumentChooserBlock(ChooserBlock):
@cached_property
def target_model(self):
from wagtail.w... | kurtrwall/wagtail | wagtail/wagtaildocs/blocks.py | Python | bsd-3-clause | 777 |
"""
Copyright (C) <2010> Autin L. TSRI
This file git_upy/houdini/__init__.py is part of upy.
upy 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
... | corredD/upy | houdini/__init__.py | Python | gpl-3.0 | 813 |
#!/usr/bin/python
import sys
import RequiemEasy
idmef = RequiemEasy.IDMEF()
idmef.Set("alert.classification.text", "Bar")
client = RequiemEasy.ClientEasy("MyTest")
client << idmef
| requiem-forasiem/librequiem | bindings/tests/send_alert.py | Python | gpl-2.0 | 184 |
"""
This folder contains both a triplet loss tensorflow layer and a dense nearest-neighbor feature matching network.
They aren't particuarly related but they both ended up living here.
""" | daweim0/Just-some-image-features | lib/triplet_flow_loss/__init__.py | Python | mit | 188 |
from maps.models import Task, Basemap, Heatmap
from celery.task import task
from database import ManagedSession
from mocs_database import create_query_for_model
from pipeline import calculate_heatmap_values, map_representation, strip_dimensions, call_graphviz, extract_terms
from status import set_status
from utils impo... | dpfried/mocs | lib/web_interface.py | Python | mit | 8,515 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 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
# au... | elbaschid/geldmaschine | docs/conf.py | Python | mit | 8,422 |
import random
def get_digit():
return random.randint(1, 9)
from zope.component.factory import Factory
factory = Factory(get_digit, 'random_digit', 'Gives a random digit')
from zope.component import getGlobalSiteManager
from zope.component.interfaces import IFactory
gsm = getGlobalSiteManager()
gsm.registerUt... | duboviy/zca | factory/main.py | Python | mit | 588 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-10 13:10
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('members', '0002_auto_20160523_1525'),
]
operations = [
migrations.AlterField... | jfterpstra/bluebottle | bluebottle/members/migrations/0003_alter_last_login.py | Python | bsd-3-clause | 493 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_utils
------------
Tests for `cookiecutter.utils` module.
"""
import os
import shutil
import sys
import unittest
from cookiecutter import utils
class TestUtils(unittest.TestCase):
def test_make_sure_path_exists(self):
self.as... | ericholscher/cookiecutter | tests/test_utils.py | Python | bsd-3-clause | 1,977 |
#
# 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... | tejasapatil/spark | python/pyspark/ml/param/_shared_params_code_gen.py | Python | apache-2.0 | 11,018 |
# BEGIN_COPYRIGHT
# END_COPYRIGHT
# pylint: disable=W0105, C0103
""" ..
This example shows how to handle genetic marker data.
**NOTE:** the example assumes that the KB already contains all objects
created by the example on importing individuals.
Suppose you have run a series of genotyping assays where the DNA
samp... | crs4/omero.biobank | examples/create_markers_sets.py | Python | gpl-2.0 | 4,865 |
__author__ = 'jens'
from elasticsearch import Elasticsearch
from metaSearch.settings import HAYSTACK_CONNECTIONS
#import numpy as np
import math as np
from operator import itemgetter
DEFAULT_GEO_LOC = (51.0834196, 10.4234469, 'Germany') # Center of Germany
MODEL_TYPE = 'modelresult'
AREA_LOCATION = 'location'
CONTAC... | patreu22/Meta-search | metaSearch/mainApp/elastic_util.py | Python | gpl-2.0 | 2,281 |
__author__ = 'alisonbento'
import basedao
import src.entities.hsgroup as hsgroup
class GroupDAO(basedao.BaseDAO):
def __init__(self, connection):
basedao.BaseDAO.__init__(self, connection, 'hs_groups', 'group_id')
def convert_row_to_object(self, entity_row):
group = hsgroup.HomeShellGroup()... | alisonbnt/home-shell | src/dao/groupdao.py | Python | apache-2.0 | 569 |
#!/usr/bin/env python
from __future__ import print_function
import pyslurm
def display(steps):
time_fields = ['time_limit']
date_fields = ['start_time']
for job, job_step in sorted(steps.items()):
print("Job: {0}".format(job))
for step, step_dict in job_step.items():
print... | edf-hpc/python-pyslurm | examples/jobsteps_layout.py | Python | gpl-2.0 | 914 |
import csv
import json
from datetime import datetime, timedelta
import requests
import re
from django.conf import settings
from django.contrib.auth import login, logout
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect, HttpResponseNotFoun... | LSIR/gsn | gsn-webui/gsn/views.py | Python | gpl-3.0 | 10,791 |
#!/usr/bin/env python
"""
Copyright (c) 2014-2016 Miroslav Stampar (@stamparm)
See the file 'LICENSE' for copying permission
"""
import re
from core.common import retrieve_content
__url__ = "http://vxvault.siri-urz.net/URL_List.php"
__check__ = "VX Vault"
__info__ = "malware"
__reference__ = "siri-urz.net"
def fet... | JustF0rWork/malware | trails/feeds/vxvault.py | Python | mit | 725 |
# -*- coding: utf-8 -*-
#
# SPC documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 16 15:43:09 2017.
#
# 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 c... | whbrewer/spc | docs/conf.py | Python | mit | 10,037 |
# Copyright (C) 2015 KillerInstinct
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in... | lixiangning888/whole_project | modules/signatures_orignal/packer_armadillo_mutex.py | Python | lgpl-3.0 | 1,289 |
import sys
import os
from Components.ActionMap import ActionMap
from Components.Pixmap import Pixmap
from Components.ConfigList import ConfigListScreen
from Components.Label import Label
from datetime import datetime
from time import strftime
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
f... | Open-Plus/opgui | lib/python/Plugins/Extensions/Openpanel/resetpas.py | Python | gpl-2.0 | 6,780 |
from nose.tools import assert_raises
from funzo.models.mdp import MDPState
from funzo.models.mdp import MDPAction
from funzo.models.mdp import RewardFunction
from funzo.models.mdp import LinearRewardFunction
from funzo.models.mdp import TabularRewardFunction
from funzo.models.mdp import MDPTransition
from funzo.mode... | makokal/funzo | funzo/models/tests/test_mdp.py | Python | mit | 819 |
#
# rtlsdr_scan
#
# http://eartoearoak.com/software/rtlsdr-scanner
#
# Copyright 2012 - 2014 Al Brown
#
# A frequency scanning GUI for the OsmoSDR rtl-sdr library at
# http://sdr.osmocom.org/trac/wiki/rtl-sdr
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | thatchristoph/RTLSDR-Scanner | src/utils_mpl.py | Python | gpl-3.0 | 2,514 |
from io import RawIOBase
class CBORStream:
def __init__(self, stream: RawIOBase):
self.stream = stream
self.peeked = b''
def peek(self, n: int = 1):
if len(self.peeked) >= n:
return self.peeked[:n]
self.peeked += self._read(n - len(self.peeked))
return self... | megajanlott/cbor-decoder | cbor/CBORStream.py | Python | mit | 684 |
import credentials
import praw
import sqlite3
import re
import time
import get_media_id
import rehost
import escape
import sys
import logging
import comments
from instagram.client import InstagramAPI
from instagram.bind import InstagramAPIError
logging.basicConfig(filename="logfile.log", format='%(asctime)s %(levelnam... | yaabdalla/instagrambot | src/instagram_bot.py | Python | mit | 5,988 |
from __future__ import print_function
import os
import sys
sys.setrecursionlimit(10000)
import time
import json
import argparse
#from densenet169 import densenet169_model
import densenet
import numpy as np
import pandas as pd
import cv2
from tqdm import tqdm
import scipy
from sklearn.metrics import fbeta_score
from... | root-master/DenseNet-Kaggle-Planet | DenseNet_planet.py | Python | apache-2.0 | 8,232 |
from flask import Flask, url_for, request, Response
import json
import logging
from random import randint
class RestService:
#class RestService:
app = Flask(__name__)
deployer = None
discovery = None
@app.route('/')
def api_root():
return 'Read <a href="https://github.com/lyndon160/Siren... | lyndon160/Siren-Provisioner | RestService.py | Python | apache-2.0 | 10,471 |
# -*- coding: utf-8 -*-
import sys, os
from sphinx.highlighting import lexers
from pygments.lexers.web import PhpLexer
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sensio.sphinx.configurati... | loic425/Sylius | docs/conf.py | Python | mit | 982 |
# coding: utf-8
"""
MailMojo API
v1 of the MailMojo API # noqa: E501
OpenAPI spec version: 1.1.0
Contact: hjelp@mailmojo.no
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import mailmojo_sdk
from mailmojo_sdk.api.se... | eliksir/mailmojo-python-sdk | test/test_segment_api.py | Python | apache-2.0 | 829 |
import abc
class Preprocessor:
@abc.abstractmethod
def __call__(self, sample):
"""
:param sample: Sample
:return: Sample
"""
raise NotImplementedError
| nromashchenko/amquery | amquery/core/preprocessing/_preprocessor.py | Python | mit | 201 |
from pyspark import SparkConf, SparkContext
from pyspark.mllib.feature import HashingTF
from pyspark.mllib.feature import IDF
# Boilerplate Spark stuff:
conf = SparkConf().setMaster("local").setAppName("SparkTFIDF")
sc = SparkContext(conf = conf)
# Load documents (one per line).
rawData = sc.textFile("e:/sundog-consu... | therealAJ/python-sandbox | data-science/learning/ud1/DataScience/TF-IDF.py | Python | gpl-3.0 | 1,915 |
import threading
"""
아래는 threading.Thread 클래스를 상속 받는 클래스에 원하는 내용을 정의 하여
사용한다.
run()은 오버라이딩 해준다.
"""
class Worker(threading.Thread):
def __init__(self, args, name=""):
#현재 클래스에 init를 만들면 상위 클래스의 init를 호출해야 한다.
threading.Thread.__init__(self)
self.args = args
#threading.Thread 클래스... | JaeGyu/PythonEx_1 | ThreadEx2.py | Python | mit | 761 |
"""
Better Figures & Images
------------------------
This plugin:
- Adds a style="width: ???px; height: auto;" to each image in the content
- Also adds the width of the contained image to any parent div.figures.
- If RESPONSIVE_IMAGES == True, also adds style="max-width: 100%;"
- Corrects alt text: if alt == imag... | endafarrell/endafarrell.github.io-src | plugins/better_figures_and_images/better_figures_and_images.py | Python | gpl-3.0 | 5,829 |
"""Stub for the zeroconf library.
As zeroconf does not provide a stub or mock, this implementation will serve as
stub here. It can fake immediate answers for any service.
"""
from zeroconf import ServiceInfo
class ServiceBrowserStub:
"""Stub for ServiceBrowser."""
def __init__(self, zeroconf, service_type, ... | postlund/pyatv | tests/zeroconf_stub.py | Python | mit | 1,543 |
# Copyright 2016 Splunk, 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,... | PaloAltoNetworks-BD/SplunkforPaloAltoNetworks | Splunk_TA_paloalto/bin/splunk_ta_paloalto/aob_py3/solnlib/conf_manager.py | Python | isc | 14,825 |
"""
Calculating a custom statistic
==============================
This example shows how to define and use a custom
:class:`iris.analysis.Aggregator`, that provides a new statistical operator for
use with cube aggregation functions such as :meth:`~iris.cube.Cube.collapsed`,
:meth:`~iris.cube.Cube.aggregated_by` or
:me... | pp-mo/iris | docs/iris/example_code/General/custom_aggregation.py | Python | lgpl-3.0 | 3,173 |
#!/usr/bin/python
# coding: utf-8
from datetime import datetime
import deform
import colander
import jinja2
from deform import ValidationFailure
from deform.widget import CheckedPasswordWidget
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPForbidden
from pyramid.httpexceptions import HTTP... | toway/towaymeetups | mba/views/admin/infomation.py | Python | gpl-3.0 | 3,175 |
# -*- coding: utf-8 -*-
#
# main.py
# A main controller for corecms,
# dispatching request to appropriate controller
# based on content type
#
# Copyright 2010 Atsushi Shibata
#
"""
The collection of fields definitions for coregeo
$Id: main.py 650 2010-08-16 07:45:11Z ats $
"""
__author__ = 'Atsushi Shibata ... | Letractively/aha-gae | applications/aha.application.coreblog3/application/controller/main.py | Python | bsd-3-clause | 7,747 |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Bitcoin test... | Sjors/bitcoin | test/functional/test_framework/messages.py | Python | mit | 51,387 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import socket
import unittest
import warnings
from unittest import skipUnless
from django.conf import settings
from django.contrib.gis.geoip import HAS_GEOIP
from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry
from django.tes... | yephper/django | tests/gis_tests/test_geoip.py | Python | bsd-3-clause | 7,017 |
import mechanize
import urllib
import json
import sys
import pycurl
import time
from StringIO import StringIO
class SimpleDynDnsServer():
def __init__(self,known_server,known_server_key,server_alias):
self.known_server=known_server
self.known_server_key=known_server_key
self.server_alias... | devalfrz/simple-dyndns | simpledyndns.py | Python | bsd-2-clause | 5,044 |
# Copyright 2014 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 applicable law or a... | luzheqi1987/nova-annotation | nova/tests/unit/objects/test_fixed_ip.py | Python | apache-2.0 | 15,194 |
'''
Float Layout
============
The :class:`FloatLayout` class honors only the :attr:`Widget.pos_hint` and
:attr:`Widget.size_hint` attributes.
.. only:: html
.. image:: images/floatlayout.gif
:align: right
.. only:: latex
.. image:: images/floatlayout.png
:align: right
For example, say you ... | JulienMcJay/eclock | windows/kivy/kivy/uix/floatlayout.py | Python | gpl-2.0 | 3,767 |
# -*- coding: utf-8 -*-
from django.test import TestCase
from oscar.apps.basket.models import Basket
from oscar.apps.partner import strategy
from oscar.test.factories import (
BasketFactory, BasketLineAttributeFactory, OptionFactory, ProductFactory)
class TestANewBasket(TestCase):
def setUp(self):
s... | anentropic/django-oscar | tests/unit/basket/model_tests.py | Python | bsd-3-clause | 2,578 |
import sublime
import sublime_plugin
import os
import subprocess
import threading
class AddFileToGit(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
filepath = view.file_name()
dirname = os.path.dirname(filepath)
print('git add', filepath)
# th = GnomeTe... | zeffii/sublimetext_productivity | Packages/User/add_file_to_git.py | Python | mit | 843 |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'^manage/$', views.ManageChannel.as_view(), name='manage_channel'),
url(r'^delete/$', views.DeleteChannel.as_view(), name='delete_channel'),
)
| metabrainz/botbot-web | botbot/apps/bots/urls.py | Python | mit | 248 |
# BITGDI analyzer
# Copyright (c) 2011 Nokia
#
# 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, copy, modify, merge... | skyostil/tracy | src/analyzer/tools/bitgdi.py | Python | mit | 6,304 |
"""
2016 Gregory Way
TAD Pathways
scripts/build_custom_TAD_genelist.py
Description:
Calls two scripts from bin/ to build genelists of all genes in TADs harboring
significant SNPs
Usage:
Run on the command line:
python scripts/build_custom_TAD_genelist.py
With the following required flags:
--snp_data_file ... | gwaygenomics/tad_pathways | scripts/build_custom_TAD_genelist.py | Python | bsd-3-clause | 4,944 |
# -*- coding: utf-8 -*-
"""Redis merge reader."""
import codecs
from plaso.lib import definitions
from plaso.storage import identifiers
from plaso.storage import interface
from plaso.storage import logger
from plaso.storage.redis import redis_store
class RedisMergeReader(interface.StorageMergeReader):
"""Redis sto... | Onager/plaso | plaso/storage/redis/merge_reader.py | Python | apache-2.0 | 9,074 |
#------------------------------------------------------------------------------
# Copyright (c) 2008, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with the GPL version of PyQt the additional terms described in ... | pankajp/pyface | pyface/ui/qt4/wizard/wizard_page.py | Python | bsd-3-clause | 4,090 |
import xapian
import json
class SearchResult(object):
def __init__(self):
self.page_count = 0
self.products = []
class Product(object):
def __init__(self, title, url, image_url, description, price):
self.title = title
self.url = url
self.image_url = image_url
... | mlackman/productrepository | productrepository.py | Python | mit | 4,683 |
import string
import types
import Numeric
import LinearAlgebra
from UserArray import UserArray, asarray
from Numeric import dot, identity, multiply
from MLab import squeeze
# make translation table
_table = [None]*256
for k in range(256):
_table[k] = chr(k)
_table = ''.join(_table)
_numchars = string.digits + ".... | fxia22/ASM_xf | PythonD/site_python/Numeric/Matrix.py | Python | gpl-2.0 | 6,190 |
#!/usr/bin/env python
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import sys
import shutil
import urllib2
import argparse
import tempfile
from zipfile import ZipFile
from StringIO impor... | lixiangning888/whole_project | utils/community.py | Python | lgpl-3.0 | 4,792 |
from pyxb.bundles.wssplat.raw.soap12 import *
| CantemoInternal/pyxb | pyxb/bundles/wssplat/soap12.py | Python | apache-2.0 | 46 |
'''
Created on Jan 19, 2011
@author: al
'''
from util import *
"""
<updateHandler class="solr.DirectUpdateHandler2" />
<requestDispatcher handleSelect="true" >
<requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
</requestDispatcher>
<requestHandler name="standard" class="... | jumoconnect/openjumo | jumodjango/lib/bebop/config.py | Python | mit | 6,264 |
# -*- coding: utf-8 -*-
'''
Manage Cloudwatch alarms
.. versionadded:: 2014.7.0
Create and destroy cloudwatch alarms. Be aware that this interacts with
Amazon's services, and so may incur charges.
This module uses boto, which can be installed via package, or pip.
This module accepts explicit credentials but can als... | stephane-martin/salt-debian-packaging | salt-2016.3.3/salt/states/boto_cloudwatch_alarm.py | Python | apache-2.0 | 6,749 |
class RLPException(Exception):
"""Base class for exceptions raised by this package."""
pass
class EncodingError(RLPException):
"""Exception raised if encoding fails.
:ivar obj: the object that could not be encoded
"""
def __init__(self, message, obj):
super(EncodingError, self).__ini... | ethereum/pyrlp | rlp/exceptions.py | Python | mit | 5,825 |
# -*- coding: utf-8 -*-
"""Checker module."""
from . import Argument, Checker
from ..errors import DesignStructureMatrixError
from ..logging import Logger
logger = Logger.get_logger(__name__)
class CompleteMediation(Checker):
"""Complete mediation check."""
identifier = 'archan.CompleteMediation'
name... | Pawamoy/archan | src/archan/plugins/checkers.py | Python | isc | 20,100 |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# Modified for Datadog
# stdlib
import logging
import os
import os.path as osp
import platform
# To manage the agent on OSX
from subprocess import (
CalledProcessError,
check_call,
check_... | mderomph-coolblue/dd-agent | win32/gui.py | Python | bsd-3-clause | 28,641 |
from sys import stdout,argv, exit # , version_info
from urllib.request import urlopen
from urllib.error import URLError
from io import StringIO
import gzip
#from astropy import units as u
from . import SlipyError
from .Framework.Command import Parse, CommandError
from .Framework.Options import Options, OptionsError
... | codydirks/queries | Mast.py | Python | gpl-3.0 | 9,234 |
from django import forms
from django.forms import ModelForm
from models import Contact, Group
class ContactForm(ModelForm):
class Meta:
model = Contact
fields = ("first_name", "last_name", "email", "fields")
class GroupForm(ModelForm):
class Meta:
model = Group
fields = ("name"... | jscott1989/holloway | contacts/forms.py | Python | mit | 427 |
"""
Module to provide Palo Alto compatibility to Salt
:codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>``
:maturity: new
:depends: none
:platform: unix
.. versionadded:: 2018.3.0
Configuration
=============
This module accepts connection configuration details either as
parameters, or as configuration ... | saltstack/salt | salt/modules/panos.py | Python | apache-2.0 | 62,517 |
# pylint: disable=no-member,line-too-long
from __future__ import print_function
from builtins import str # pylint: disable=redefined-builtin
from django.core.management.base import BaseCommand
from ...decorators import handle_lock
from ...models import DataBundle
class Command(BaseCommand):
help = 'Removes proc... | audaciouscode/PassiveDataKit-Django | management/commands/pdk_clear_processed_bundles.py | Python | apache-2.0 | 1,629 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Harvard
#
# Authors:
# Xavier Antoviaque <xavier@antoviaque.org>
#
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute and/or modify this program under the terms of
# the GNU Affero General Public License (AGPL) as publishe... | open-craft/xblock-mentoring | mentoring/light_children.py | Python | agpl-3.0 | 13,429 |
print "I like pie"
| jedp/oakland_pm | sms/tests/__main__.py | Python | mit | 19 |
# -*- coding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1439353973.126062
_enable_loop = True
_template_filename = u'/usr/local/lib/python2.7/dist-packages/nikola/data/themes/bootstrap/templates... | brobeur/brobeurdotcom | cache/.mako.tmp/listing.tmpl.py | Python | mit | 5,563 |
"""
Read/write from stdin/stdout
"""
from sys import stdin, stdout
from yaml import safe_load_all
from microcosm_resourcesync.endpoints.base import Endpoint
class PipeEndpoint(Endpoint):
def __repr__(self):
return "{}()".format(
self.__class__.__name__,
)
def __eq__(self, othe... | globality-corp/microcosm-resourcesync | microcosm_resourcesync/endpoints/pipe_endpoint.py | Python | apache-2.0 | 785 |
import pytest
from cfme.infrastructure.provider.openstack_infra import OpenstackInfraProvider
from cfme.utils.appliance.implementations.ui import navigate_to
pytestmark = [
pytest.mark.usefixtures("setup_provider_modscope"),
pytest.mark.provider([OpenstackInfraProvider], scope='module'),
]
VIEWS = ["List Vi... | anurag03/integration_tests | cfme/tests/openstack/infrastructure/test_hosts.py | Python | gpl-2.0 | 5,077 |
from models import Carrier, Shipper
from satchmo_utils import load_once
load_once('tiered', 'shipping.modules.tiered')
def get_methods():
return [Shipper(carrier) for carrier in Carrier.objects.filter(active=True).order_by('ordering')]
| mitchellzen/pops | satchmo/apps/shipping/modules/tiered/__init__.py | Python | bsd-3-clause | 242 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.