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/python
import argparse
import sys
from azuremodules import *
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--distro', help='UBUNTU/SUSE/SLES/CENTOS/ORACLE', required=True)
args = parser.parse_args()
DetectedDistro = args.distro
def SetNTPVariables(DetectedDistro):
if DetectedDistro... | hglkrijger/azure-linux-automation | remote-scripts/ConfigureNTP.py | Python | apache-2.0 | 3,313 |
# 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 ... | mtagle/airflow | airflow/configuration.py | Python | apache-2.0 | 29,594 |
from sklearn.utils.testing import (assert_array_equal, assert_equal,
assert_raises)
from scipy.sparse import bsr_matrix, csc_matrix, csr_matrix
from sklearn.feature_selection import VarianceThreshold
data = [[0, 1, 2, 3, 4],
[0, 2, 2, 3, 5],
[1, 1, 2, 4, 0]]
def t... | chaluemwut/fbserver | venv/lib/python2.7/site-packages/sklearn/feature_selection/tests/test_variance_threshold.py | Python | apache-2.0 | 977 |
import hexchat
#Based on Weechat's Weestats: https://weechat.org/scripts/source/weestats.py.html/
#By Filip H.F. 'FiXato' Slagter <fixato [at] gmail [dot] com>
__module_name__ = 'HexStats'
__module_version__ = '0.0.1'
__module_description__ = 'Displays HexChat-wide User Statistics'
__module_author__ = 'Vlek'
de... | Vlek/plugins | HexChat/HexStats.py | Python | mit | 1,614 |
"""
Test functions for multivariate normal distributions.
"""
import pickle
from numpy.testing import (assert_allclose, assert_almost_equal,
assert_array_almost_equal, assert_equal,
assert_array_less, assert_)
import pytest
from pytest import raises as assert_rais... | WarrenWeckesser/scipy | scipy/stats/tests/test_multivariate.py | Python | bsd-3-clause | 81,262 |
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/common/lru_cache.py | Python | bsd-3-clause | 4,428 |
# coding: utf-8
import csv
import datetime
import glob
import json
import os
import sys
import time
from collections import namedtuple
from contextlib import contextmanager
from decimal import Decimal
from distutils.version import LooseVersion
from functools import partial
from tempfile import NamedTemporaryFile, gette... | thobbs/cassandra-dtest | cqlsh_tests/cqlsh_copy_tests.py | Python | apache-2.0 | 128,491 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-11-09 22:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0013_participationitem_creation_time'),
]
operations = [
migrations.... | better-dem/portal | core/migrations/0014_auto_20161109_2225.py | Python | agpl-3.0 | 649 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^my_honeypot/', views.my_honeypot, name='my_honeypot'),
url(r'^all_honeypots/', views.all_honeypots, name='all_honeypots'),
url(r'^team', views.team_attacks, name='team_attacks'),
url(r'^stats', views.team_stats, name='team_stat... | pcodes/mhn_interface | honeypots/urls.py | Python | mit | 326 |
"""
Description
"""
#STL
import os, sys, inspect, random
# Adding parent directory to sys.path
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
#3rd party
#kivy
from kivy.uix.screenmanager import Screen
... | nitinsaroha/Kivame | screens/help.py | Python | mit | 2,865 |
import unittest
import pytest
import six
from mock import patch
from http_prompt.context import Context
from http_prompt.execution import execute
class ExecutionTestCase(unittest.TestCase):
def setUp(self):
self.patchers = [
('httpie_main', patch('http_prompt.execution.httpie_main')),
... | Yegorov/http-prompt | tests/test_execution.py | Python | mit | 16,819 |
# -*- coding: utf-8 -*-
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
class Context(object):
pass
class System(object):
def os_init(x, y, z):
pass
def get_map(x):
pass
def CAPS(x):
pass
class FullAddress(object):
pass
KVADDR = 0
SYS_MAP_MACHPHYS_KPHYS = 0
| jeffmahoney/crash-python | doc-source/mock/addrxlat/__init__.py | Python | gpl-2.0 | 313 |
# vim: set fileencoding=utf-8 :
"""Test L{Changelog}'s guess_version_from_upstream"""
from . import context # noqa: 401
from . import testutils
from gbp.scripts import dch
class TestGuessDocumentedCommit(testutils.DebianGitTestRepo):
def setUp(self):
self.version = '1.0-1'
self.tagformat = 'de... | agx/git-buildpackage | tests/17_test_dch_guess_documented_commit.py | Python | gpl-2.0 | 2,683 |
from django.apps import AppConfig
class MemosConfig(AppConfig):
name = 'memos'
| a-kirin/Dockerfiles | sample01/web/sample01/memos/apps.py | Python | mit | 85 |
import sys
from numpy.random import *
from numpy import *
class Node(object):
def __init__(self, parent=None, tssb=None):
self.data = set([])
self._children = []#set([])#shankar
self.tssb = tssb
if parent is not None:
parent.add_child(self)
self.... | morrislab/phylowgs | node.py | Python | gpl-3.0 | 2,214 |
import cv2
img = cv2.imread('../BoardRecognizer/tests/state1.png', 0)
clahe = cv2.createCLAHE(clipLimit=20.0, tileGridSize=(32,32))
applied = clahe.apply(img)
cv2.imshow('CLAHE applied', applied)
cv2.imshow('Without CLAHE', img)
print applied
cv2.waitKey(20)
raw_input()
| nouwaarom/GameBot | Test/test.py | Python | gpl-3.0 | 273 |
from . import plugin_loader
from gi.repository import GObject, Gtk
from .gtk_extras import dialog_extras as de
from xml.sax.saxutils import escape
from gettext import gettext as _
from typing import Any, Optional
class PluginChooser:
def __init__ (self):
self.loader = plugin_loader.get_master_loader()
... | thinkle/gourmet | gourmet/plugin_gui.py | Python | gpl-2.0 | 7,397 |
"""
Model definitions for SQLAlchemy models used in this app.
"""
import datetime
import json
from sqlalchemy import and_, or_
from .extensions import db
def to_json(mdl):
"""
Jsonify a SQLAlchemy model.
"""
d = mdl.__dict__
return dict_to_json(d)
def dict_to_json(d):
d = dict_to_safe_for_... | gbasood/vgstation-statistics-viewer | app/models.py | Python | mit | 13,851 |
#
# argument_parsing.py: option parsing for anaconda (CLI and boot args)
#
# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
#
# 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 versi... | vathpela/anaconda | pyanaconda/argument_parsing.py | Python | gpl-2.0 | 25,790 |
########################################################################
# File : PilotStatusAgent.py
# Author : Stuart Paterson
########################################################################
""" The Pilot Status Agent updates the status of the pilot jobs in the
PilotAgents database.
"""
__RCSID__ ... | arrabito/DIRAC | WorkloadManagementSystem/Agent/PilotStatusAgent.py | Python | gpl-3.0 | 12,171 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/processing/analyses/view/analysis_view.py | Python | apache-2.0 | 12,051 |
import datetime as dt
from prophet.analyze import Analysis
from prophet.portfolio import Portfolio
from prophet.backtest import backtest
from prophet.exceptions import ProphetException
from prophet.utils import trading_days
class Prophet(object):
""" The application object. Serves as the primary interface for us... | mpritham/prophet | prophet/app.py | Python | bsd-3-clause | 6,692 |
from gusto import *
import itertools
from firedrake import (as_vector, SpatialCoordinate, PeriodicIntervalMesh,
ExtrudedMesh, exp, sin, Function)
import numpy as np
import sys
dt = 6.
if '--running-tests' in sys.argv:
tmax = dt
else:
tmax = 3600.
nlayers = 10 # horizontal layers
colum... | firedrakeproject/gusto | examples/sk_nonlinear.py | Python | mit | 3,591 |
# BurnMan - a lower mantle toolkit
# Copyright (C) 2012, 2013, Heister, T., Unterborn, C., Rose, I. and Cottaar, S.
# Released under GPL v2 or later.
import numpy as np
import scipy.integrate as integrate
import matplotlib.pyplot as plt
import time
"""
Functions for the Debye model. Note that this is not Mie-Gruenei... | tjhei/burnman_old2 | burnman/debye.py | Python | gpl-2.0 | 4,664 |
import six
import pytest
from mock import patch, call
from flask_musers import MUsers
class TestMUsers(object):
@patch('flask_musers.User.get_active_user_by_pk_or_none')
def test_load_user(self, mock_get_active_user_by_pk_or_none):
mu = MUsers()
mu.load_user('1234567')
assert mock_g... | s-m-i-t-a/flask-musers | tests/test_musers.py | Python | bsd-3-clause | 1,055 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | lucperkins/heron | heron/tools/tracker/src/python/handlers/containerfilehandler.py | Python | apache-2.0 | 6,562 |
#!/usr/bin/env python
'''
OWASP ZSC
https://www.owasp.org/index.php/OWASP_ZSC_Tool_Project
https://github.com/zscproject/OWASP-ZSC
http://api.z3r0d4y.com/
https://groups.google.com/d/forum/owasp-zsc [ owasp-zsc[at]googlegroups[dot]com ]
'''
import binascii
from core import stack
from core import color
from core.alert i... | zscproject/OWASP-ZSC | lib/opcoder/linux_x86.py | Python | gpl-3.0 | 24,284 |
# This file is part of jobs-admin.
# Copyright 2010 Jacob Peddicord <jpeddicord@ubuntu.com>
#
# jobs-admin 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)... | jpeddicord/jobs-admin | JobsAdmin/gtk/context.py | Python | gpl-3.0 | 1,142 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Nils Weiss <nils@we155.de>
# This program is published under a GPLv2 license
# scapy.contrib.description = UDS AutomotiveTestCaseExecutor
# scapy.contrib.status = loads
import struct
import random
import time
... | secdev/scapy | scapy/contrib/automotive/uds_scan.py | Python | gpl-2.0 | 47,606 |
"""
Tests for the backend objects. We instantiate local copies of
the backends and invoke the entry points for the protocol methods.
We do not set up any server processes or communicate over sockets.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
impor... | pansapiens/server | tests/unit/test_backends.py | Python | apache-2.0 | 9,182 |
from rest_framework import serializers
from posts.models import Post
class PostModelSerializer(serializers.ModelSerializer):
username = serializers.CharField(source="user.username", )
class Meta:
model = Post
fields = [
"title",
"content",
"youtube_origi... | lioliolio/fastube | fastube/posts/serializers/post.py | Python | mit | 365 |
#!/opt/anaconda2/bin/python
# -*- coding: utf-8 -*-
"""
################################################################################
#
# Copyright (c) 2015 Wojciech Migda
# All rights reserved
# Distributed under the terms of the MIT license
#
####################################################################... | WojciechMigda/TCO-PCFStupskiPrize1 | src/colorspaces.py | Python | mit | 1,744 |
'''
'''
from __future__ import absolute_import
from ...exceptions import ProtocolError
index = {}
def register(cls):
''' Decorator to add a Message (and its revision) to the Protocol index.
'''
key = (cls.msgtype, cls.revision)
if key in index:
raise ProtocolError("Duplicate message specifi... | htygithub/bokeh | bokeh/server/protocol/messages/__init__.py | Python | bsd-3-clause | 643 |
#!/usr/bin/env python
# Name: compare.py
# Purpose: Compare File Informaation
# By: Jerry Gamblin
# Date: 18.07.15
# Modified 18.07.15
# Rev Level 0.1
# -----------------------------------------------
import os
import stat
import time
import hashlib
import sys
colorred = "\033[01;31m{0}\033[00m"
co... | Saruspete/myshell | src/compare.py | Python | gpl-2.0 | 2,848 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | tpeek/bike_safety | imagersite/imager_profile/migrations/0001_initial.py | Python | mit | 1,147 |
#!/usr/bin/env python
""" """
# Standard library modules.
import unittest
import logging
# Third party modules.
# Local modules.
from pyhmsa_gui.util.testcase import TestCaseQApp, QTest
from pyhmsa_gui.spec.condition.region import RegionOfInterestWidget
# Globals and constants variables.
class TestRegionOfInterest... | pyhmsa/pyhmsa-gui | pyhmsa_gui/spec/condition/test_region.py | Python | mit | 659 |
from django.http import JsonResponse
from django.views import generic
from django.http import HttpResponseRedirect
from django.views.decorators.csrf import csrf_exempt
from .models import Game, Player, Tourney
from django.contrib.auth.models import User
from django.db.models import Q
from django.shortcuts import rende... | GenchoBG/HackTues3 | skeleton/pixelwars/views.py | Python | mit | 8,457 |
#!/usr/bin/env python
"""
Quick implementation of octhatrack with GraphQL
USAGE
./octohatrack_graphql.py user/repo
LIMITATIONS
Limitations in the github graphql api means that this will only return the:
- last 100 issues
- last 100 comments per issue
- last 100 pull requests
- last 100 co... | LABHR/octohatrack | octohatrack_graphql.py | Python | bsd-3-clause | 2,335 |
# -*- coding: utf-8 -*-
import configparser
import logging
import pathlib
logger = logging.getLogger('cibopath')
class UserConfig:
def __init__(self, file_path):
self.file_path = pathlib.Path(file_path).expanduser()
self.file_path.touch(exist_ok=True)
self._config = self._load_config()
... | hackebrot/cibopath | cibopath/user_config.py | Python | bsd-3-clause | 1,449 |
import factory
from microbiome.apps.mb_infant.models import InfantCleftDisorder
from .infant_congenital_anomalies_factory import InfantCongenitalAnomaliesFactory
class InfantCleftDisorderFactory(factory.DjangoModelFactory):
class Meta:
model = InfantCleftDisorder
congenital_anomalies = factory.Sub... | botswana-harvard/microbiome | microbiome/apps/mb_infant/tests/factories/infant_cleft_disorder_factory.py | Python | gpl-2.0 | 453 |
import pytest
from django.core.management import call_command
from oscar.core.loading import get_model
from oscar.core.utils import slugify
from ecommerce.core.constants import (
COUPON_PRODUCT_CLASS_NAME,
COURSE_ENTITLEMENT_PRODUCT_CLASS_NAME,
ENROLLMENT_CODE_PRODUCT_CLASS_NAME,
SEAT_PRODUCT_CLASS_NAM... | eduNEXT/edunext-ecommerce | conftest.py | Python | agpl-3.0 | 10,743 |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 01 18:21:30 2015
@author: Eric
"""
from pymongo import MongoClient
from location_methods import location_filter
client = MongoClient('52.5.211.193', 27017)
# hardcode database 'corpus'
db = client.corpus
# hardcode collection names 'twitter' 'filtered_tweets'
s_coll =... | ezeissler90/CSI_431 | tweet_locator.py | Python | gpl-2.0 | 530 |
import shutil
import uuid
from abc import abstractmethod
from enum import Enum, auto
from pathlib import Path
from typing import (
Callable,
Dict,
List,
Optional,
Union,
)
import aiofiles
# Type hinting for wrap must be turned off until (1) is resolved.
# (1) https://github.com/Tinche/aiofiles/issu... | joakim-hove/ert | ert/data/record/_transmitter.py | Python | gpl-3.0 | 7,784 |
import rdtest
import renderdoc as rd
class D3D12_Overlay_Test(rdtest.Overlay_Test):
demos_test_name = 'D3D12_Overlay_Test'
internal = False
def check_capture(self):
out: rd.ReplayOutput = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture)
... | Zorro666/renderdoc | util/test/tests/D3D12/D3D12_Overlay_Test.py | Python | mit | 2,194 |
import asyncio
import gzip
import json
import logging
from functools import partial
from types import MappingProxyType
from typing import Any, Awaitable, Callable, Mapping, Optional, TypeVar
import aiormq
from aiormq.tools import awaitable
from aio_pika.abc import (
AbstractChannel, AbstractExchange, AbstractInco... | mosquito/aio-pika | aio_pika/patterns/master.py | Python | apache-2.0 | 6,267 |
# Copyright 2012 Nebula, 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 agree... | ChameleonCloud/horizon | openstack_dashboard/test/test_data/cinder_data.py | Python | apache-2.0 | 22,098 |
import tensorflow as tf
import tensorflow.contrib.layers as tcl
import tensorflow.contrib.framework as tcf
import numpy as np
import os
import time
import random
from functools import partial
from DCGAN import DCGAN, SampleImageHook
from input_utils import get_image_paths, get_input_batch_tensor
# Newer version (newe... | vllab/TSMC_DL | DCGAN/main.py | Python | gpl-3.0 | 12,713 |
"""Print a GO term's lower-level hierarchy."""
__copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang. All rights reserved."
__author__ = "DV Klopfenstein"
import sys
# pylint: disable=too-many-instance-attributes,too-few-public-methods
class WrHierPrt(object):
"""Print the hierarchy of a set of obje... | tanghaibao/goatools | goatools/rpt/write_hierarchy_base.py | Python | bsd-2-clause | 5,169 |
import os
import unittest
import json
from .. import app, models
from ..models import Session, Race
from .. import query as q
class StorageTestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
self.app = app.test_c... | kartyboyz/n64-storage-flask | n64_storage/tests/api.py | Python | mit | 4,361 |
#!/usr/bin/env python
import argparse
import sys
from subprocess import check_call
from typing import List, Dict, Union
from .lister import list_files
def do_replace(listing, old_string, new_string):
# type: (Union[Dict[str, List[str]], List[str]], str, str) -> None
for filename in listing:
regex = '... | amanharitsh123/zulip | tools/replacer.py | Python | apache-2.0 | 2,213 |
# Author: Immanuel Bayer
# License: BSD 3 clause
import numpy as np
from sklearn.base import RegressorMixin
import ffm
from utils import check_consistent_length, check_array
from base import (FactorizationMachine, BaseFMClassifier,
_validate_class_labels, _check_warm_start)
class FMRegression(Fact... | macks22/fastFM | fastFM/als.py | Python | bsd-3-clause | 6,002 |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-oidc-provider',
version='0.... | wayward710/django-oidc-provider | setup.py | Python | mit | 1,629 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventory', '0003_auto_20170806_0041'),
]
operations = [
migrations.RemoveField(
model_name='tshirt',
... | PyConPune/pune.pycon.org | inventory/migrations/0004_auto_20171106_0516.py | Python | mit | 534 |
class Solution(object):
def findContestMatch(self, n):
"""
:type n: int
:rtype: str
"""
res = map(str, range(1, n+1))
k = 1
while k != n:
i = 0
j = len(res) - 1
temp = []
while i < j:
temp.append(... | Mlieou/oj_solutions | leetcode/python/ex_544.py | Python | mit | 477 |
from __future__ import print_function
import os
import re
import gzip
import itertools
import argparse
import subprocess
__author__ = 'Martin Aryee'
# python ~/work/projects/umi/umitag.py --read1_in bcl/Undetermined_S0_L001_R1_001.fastq.gz --read2_in bcl/Undetermined_S0_L001_R2_001.fastq.gz --read1_out umi1.fastq.gz ... | aryeelab/umi | umitag.py | Python | mit | 3,925 |
#!/usr/bin/python
from __future__ import with_statement
from contextlib import closing
import socket, uuid, struct, sys
def read_fully(sock, length):
result = ''
while(length-len(result) > 0):
result += sock.recv(length-len(result))
return result;
if(len(sys.argv) > 1 and sys.argv[1] == 'config'):
print "gra... | Medo42/Faucet-Lobby | munin-plugins/gg2_servers.py | Python | isc | 1,217 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | theflofly/tensorflow | tensorflow/examples/get_started/regression/dnn_regression.py | Python | apache-2.0 | 3,922 |
__author__ = 'Clive'
| dksahuji/neuromancy | neuromancy/__init__.py | Python | mit | 21 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_10_01/models/event_request_message.py | Python | mit | 1,700 |
# -*- coding: utf-8 -*-
# Copyright 2016 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
import math
from datetime import datetime, timedelta
from odoo import api, fields, models
from odoo.exceptions import Warning
from odoo.tools import DEFAULT_... | VitalPet/addons-onestein | hr_absenteeism/models/hr_holidays.py | Python | agpl-3.0 | 3,673 |
import sqlite3 as lite
conn = lite.connect('reddit.db')
c = conn.cursor()
# Create table
c.execute('''CREATE TABLE User
(id text PRIMARY KEY,
created text,
link_karma integer,
comment_karma integer)''');
c.execute('''CREATE TABLE Subreddit (
id text PRIMARY KEY,
name te... | ImanB/reddit_collector | database.py | Python | gpl-2.0 | 1,735 |
#! python
# (c) 2009 Juergen Riegel GPL
Usage = """examplePy2wiki - generating a wiki text out of a python example
Usage:
examplePy2wiki [Optionen]
Options:
-o --out-file=FILENAME use this file name for output, default resorces.qrc
-i, --in-file=FILENAME directory to search, default PWD
-h, ... | elgambitero/FreeCAD_sf_master | src/Tools/examplePy2wiki.py | Python | lgpl-2.1 | 1,441 |
# file django/emory_ldap/backends.py
#
# Copyright 2010 Emory University General Library
#
# 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/licen... | emory-libraries/eulcore-history | src/eulcore/django/emory_ldap/backends.py | Python | apache-2.0 | 1,467 |
import os
import json
import sys
from pathlib import Path
from argparse import ArgumentParser
from subprocess import check_call, check_output, CalledProcessError, run
from urllib.parse import quote_plus
HOME = os.getenv('HOME')
ROFI_OPTIONS = [
'rofi', '-dmenu', '-i', '-matching', 'fuzzy',
]
ROFI_PATH = os.path.d... | gregflynn/dotsanity | modules/rofi/rofi_actions.py | Python | mit | 6,525 |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | mk270/iatidq_model | iatidq/dqcodelists.py | Python | agpl-3.0 | 3,752 |
# -*- coding: iso-8859-1 -*-
#
# Copyright (C) 2009 Rene Liebscher
#
# This program 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 of the License, or (at your option) any
# later ver... | arruda/pyfuzzy | fuzzy/complement/Parametric.py | Python | lgpl-3.0 | 2,078 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | grengojbo/st2 | st2common/st2common/constants/pack.py | Python | apache-2.0 | 1,816 |
"""
Classes that define how vector spaces are formatted
Most of our models can be viewed as linearly transforming
one vector space to another. These classes define how the
vector spaces should be represented as theano/numpy
variables.
For example, the VectorSpace class just represents a
vector space with a vector, an... | kastnerkyle/pylearn2 | pylearn2/space/__init__.py | Python | bsd-3-clause | 86,480 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# resadmin - Resource view for ARC resources
# Copyright (C) 2003-2009 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | heromod/migrid | mig/cgi-bin/arcresources.py | Python | gpl-2.0 | 1,084 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Python Toolbox
Extensions to make coding in python less painful
"""
__author__ = "David Joy"
__copyright__ = "Copyright 2010-2013, David Joy"
__credits__ = ["David Joy"]
__license__ = "MIT"
__version__ = "0.1.0"
__maintainer__ = "David Joy"
__email__ = "videan42@gma... | videan42/python-toolbox | darkstarlabs/toolbox/__init__.py | Python | mit | 391 |
#!/usr/bin/python
'''
Faraday Penetration Test IDE - Community Version
Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/)
See the file 'doc/LICENSE' for the license information
'''
from model.hosts import Host, Interface, Service, ModelObjectVuln
import random
def new_random_workspace_name():
return ("... | Snifer/BurpSuite-Plugins | faraday/test_cases/common.py | Python | gpl-2.0 | 1,676 |
from alembic import op
import sqlalchemy as sa
from superset import db
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import (
Column, Integer, String)
"""update slice model
Revision ID: 33d996bcc382
Revises: 41f6a59a61f2
Create Date: 2016-09-07 23:50:59.366779
"""
# revision identifier... | alanmcruickshank/superset-dev | superset/migrations/versions/33d996bcc382_update_slice_model.py | Python | apache-2.0 | 1,573 |
#
# Copyright 2012 eNovance <licensing@enovance.com>
# Copyright 2012 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
#
# Unle... | mathslinux/ceilometer | ceilometer/tests/unit/compute/pollsters/test_instance.py | Python | apache-2.0 | 3,219 |
"""Pulse penetration ratio and density absolute mean calculations.
See https://github.com/eEcoLiDAR/eEcoLiDAR/issues/23.
"""
import numpy as np
from laserchicken.feature_extractor.base_feature_extractor import FeatureExtractor
from laserchicken.keys import point, normalized_height
# classification according to
# ht... | eEcoLiDAR/eEcoLiDAR | laserchicken/feature_extractor/pulse_penetration_feature_extractor.py | Python | apache-2.0 | 3,433 |
#!/usr/bin/env python2.6
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | jrha/aquilon | tests/broker/test_update_branch.py | Python | apache-2.0 | 4,922 |
#!/usr/bin/python
#
# Sandbox key:
#
from pypebbleapi import Timeline, Pin
from datetime import datetime
import urllib3.contrib.pyopenssl
urllib3.contrib.pyopenssl.inject_into_urllib3()
# Sandbox key: SBna3itxdgseq99nbw87kur33gi1q4yi
#
#
my_api_key="SBna3itxdgseq99nbw87kur33gi1q4yi"
user_key="SBACTtnBhLD2Pig05Gx... | obitoo/PebbleTidesUK | www/test_timeline.py | Python | gpl-3.0 | 2,561 |
# Copyright (c) 2018 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 agreed to in writi... | openstack/barbican | barbican/plugin/castellan_secret_store.py | Python | apache-2.0 | 8,032 |
#!/usr/bin/env python
import base
import readers
import os.path
import sys
if len(sys.argv) < 2:
base.Logger.log("Usage is %s topology" % sys.argv[0], base.Logger.CRITICAL)
sys.exit()
top_in = sys.argv[1]
try:
inp = open (top_in, 'r')
except:
base.Logger.die ('Could not open %s. Aborting' % top_in)
... | rgatkinson/oxdna | UTILS/printsqs.py | Python | gpl-3.0 | 669 |
# -*- coding: utf-8 -*-
import urllib
import json
import os
import stat
from datetime import datetime, timedelta
from django.conf import settings
from django.core.files import temp
from django.core.files.storage import default_storage as storage
from django.test.utils import override_settings
import mock
import resp... | atiqueahmedziad/addons-server | src/olympia/devhub/tests/test_views_submit.py | Python | bsd-3-clause | 94,819 |
import jax.numpy as np
from cleverhans.jax.attacks.fast_gradient_method import fast_gradient_method
from cleverhans.jax.utils import clip_eta, one_hot
def projected_gradient_descent(
model_fn,
x,
eps,
eps_iter,
nb_iter,
norm,
clip_min=None,
clip_max=None,
y=None,
targeted=Fals... | cleverhans-lab/cleverhans | cleverhans/jax/attacks/projected_gradient_descent.py | Python | mit | 3,740 |
from base64 import decodebytes
import pytest
from tests.support.asserts import assert_error, assert_success
def do_print(session, options):
return session.transport.send(
"POST", "session/{session_id}/print".format(**vars(session)),
options)
def assert_pdf(data):
assert data.startswith(b"%... | nwjs/chromium.src | third_party/blink/web_tests/external/wpt/webdriver/tests/print/printcmd.py | Python | bsd-3-clause | 2,835 |
#!/usr/bin/env python
# coding:utf-8
import os
import binascii
import time
import socket
import struct
import threading
import operator
import httplib
import socks
from xlog import getLogger
xlog = getLogger("gae_proxy")
current_path = os.path.dirname(os.path.abspath(__file__))
import OpenSSL
SSLError = OpenSSL.SS... | jt6562/XX-Net | gae_proxy/local/connect_manager.py | Python | bsd-2-clause | 19,670 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def UnlicensedVirtualMachinesEvent(vim, *args, **kwargs):
'''This event records that we h... | xuru/pyvisdk | pyvisdk/do/unlicensed_virtual_machines_event.py | Python | mit | 1,335 |
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
"""
Edit metadata in RTF files.
"""
import re, cStringIO, codecs
from calibre.ebooks.metadata import MetaInformation, string_to_authors
title_pat = re.compile(r'\{\\info.*?\{\\title(.*?)(?<!\\)\}', re.DOTALL)
author_pat = re.c... | yeyanchao/calibre | src/calibre/ebooks/metadata/rtf.py | Python | gpl-3.0 | 7,525 |
# (c) 2013-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2015 Toshio Kuratomi <tkuratomi@ansible.com>
#
# 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... | alvaroaleman/ansible | lib/ansible/executor/module_common.py | Python | gpl-3.0 | 35,832 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_li_edgedensity_ascii.py
-------------------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
********... | ghtmtt/QGIS | python/plugins/processing/algs/grass7/ext/r_li_edgedensity_ascii.py | Python | gpl-2.0 | 1,452 |
#!/usr/bin/python
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt # For plotting graphs.
import numpy as np
import subprocess # For issuing commands to the OS.
import os
import sys # For determining the Python version.
import Image
import time
import fk... | mlaprise/PyOFTK | PyOFTK/freespace/bessel_col_movie.py | Python | gpl-2.0 | 3,183 |
from FbBase import FbBase
from FbExporter import FbExporter, FbLikedUrlExporter
| waveface/SnsManager | SnsManager/facebook/__init__.py | Python | bsd-3-clause | 80 |
from .constants import *
from rapt.treebrd.node import Operator
latex_operator = {
Operator.select: SELECT_OP,
Operator.project: PROJECT_OP,
Operator.rename: RENAME_OP,
Operator.assign: ASSIGN_OP,
Operator.cross_join: JOIN_OP,
Operator.natural_join: NATURAL_JOIN_OP,
Operator.theta_join: THE... | pyrapt/rapt | rapt/transformers/qtree/operators.py | Python | mit | 440 |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 opt... | hexpl0it/plugin.video.genesi-ita | resources/lib/resolvers/mrfile.py | Python | gpl-3.0 | 1,517 |
"""
Given a nested list of integers, implement an iterator to flatten it.
Each element is either an integer, or a list -- whose elements may also be integers or other lists.
Example 1:
Given the list [[1,1],2,[1,1]],
By calling next repeatedly until hasNext returns false, the order of elements returned by next shoul... | algorhythms/LeetCode | 341 Flatten Nested List Iterator.py | Python | mit | 4,303 |
from __future__ import with_statement
import inspect
from random import choice, randint
import sys
from whoosh import fields, query, scoring
from whoosh.compat import u, xrange, permutations
from whoosh.filedb.filestore import RamStorage
def _weighting_classes(ignore):
# Get all the subclasses of Weighting in wh... | wdv4758h/ZipPy | edu.uci.python.benchmark/src/benchmarks/whoosh/tests/test_weightings.py | Python | bsd-3-clause | 2,736 |
"""
Copyright 2006 ThoughtWorks, 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 wr... | t-artistik/browserscope | bin/reflow/selenium.py | Python | apache-2.0 | 78,582 |
from __future__ import division
import contextlib
import json
import numbers
try:
import requests
except ImportError:
requests = None
from jsonschema import _utils, _validators
from jsonschema.compat import (
Sequence, urljoin, urlsplit, urldefrag, unquote, urlopen,
str_types, int_types, iteritems,
)... | vivekgalatage/libtracing | third-party/jsonschema/jsonschema/validators.py | Python | mit | 14,550 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "acessoPoint.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that ... | rodrigolucianocosta/controleAcesso | acessoPoint/manage.py | Python | mit | 809 |
from __future__ import print_function
import argparse
import os
import stat
import sys
# find the import for catkin's python package - either from source space or from an installed underlay
if os.path.exists(os.path.join('/opt/ros/groovy/share/catkin/cmake', 'catkinConfig.cmake.in')):
sys.path.insert(0, os.path.jo... | robotics-silver-surfer/surfer-main | lab3/triangle/build/catkin_generated/generate_cached_setup.py | Python | mit | 1,287 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys
from platformcode import config, logger
from core import scrapertools
from core.item import Item
from core import servertools
from core import httptools
server = {'1': 'https://www.ma... | alfa-jor/addon | plugin.video.alfa/channels/mangovideo.py | Python | gpl-3.0 | 4,670 |
import requests
data = {
'foo': '\\"bar\\"'
}
response = requests.post('http://example.com/', data=data)
| NickCarneiro/curlconverter | fixtures/python/post_escaped_double_quotes_in_single_quotes.py | Python | mit | 109 |
#!/usr/bin/env python
import re
import fileinput
def this_line_is_useless(line):
useless_es = [
'BEGIN TRANSACTION',
'COMMIT',
'sqlite_sequence',
'CREATE UNIQUE INDEX',
]
for useless in useless_es:
if re.search(useless, line):
return True
def ha... | liquid36/CLDownload | sqlitetomysql.py | Python | apache-2.0 | 2,372 |
# encoding: utf-8
# Git hooks for pastaspyge
from pastaspyge.git import Git
from pastaspyge.pasta import Pasta
import os
import sys
import logging
logger = logging.getLogger()
def not_hook():
print("This script should be run as post-receive hook")
print("Unclean exit")
sys.exit(1)
def post_receive(r... | annttu/pastaspyge | pastaspyge/git_hooks.py | Python | mit | 2,416 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.