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 |
|---|---|---|---|---|---|
# Copyright 2020 Red Hat, Inc. Jake Hunsaker <jhunsake@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General ... | slashdd/sos | sos/cleaner/mappings/username_map.py | Python | gpl-2.0 | 1,265 |
# Time: O(nlogn)
# Space: O(n)
#
# Given an unsorted array of integers,
# find the length of longest increasing subsequence.
#
# For example,
# Given [10, 9, 2, 5, 3, 7, 101, 18],
# The longest increasing subsequence is [2, 3, 7, 101],
# therefore the length is 4. Note that there may be more
# than one LIS combination... | kamyu104/LeetCode | Python/longest-increasing-subsequence.py | Python | mit | 1,743 |
def extractFeatures(filename):
import numpy as np
labels = []
labels = np.array([labels])
features = []
features = np.array([features])
for line in file(filename):
row = line.split(',')
labels = np.append(labels, np.array(row[5]))
features = np.append(features, np.array(... | TharindraParanagama/MovieClassification | Movie.py | Python | mit | 5,811 |
#/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import datetime
import re
from collections import OrderedDict
def __os_getdb(file, _name):
db_list = OrderedDict()
mod_list = OrderedDict()
db_count = 0
set_size = 1
fobj = open(file, 'r')
# Database pattern
skpattern = "^\S\S\S(\d+... | classcat/cc-prism-hids | main/webapp/os_lib_syscheck.py | Python | gpl-3.0 | 8,533 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
import subprocess
from setuptools import setup
from setuptools.command.sdist import sdist as base_sdist
class sdist(base_sdist):
"""
Regular sdist class plus compilation of front end assets
"""
def compile_assets(self):
... | JamesRamm/longclaw | setup.py | Python | mit | 3,519 |
from unittest.mock import create_autospec, sentinel
import pytest
from tests.conftest import assert_cache_control
from tests.unit.matchers import temporary_redirect_to
from via.resources import QueryURLResource
from via.views.route_by_content import route_by_content
@pytest.mark.usefixtures("via_client_service")
cl... | hypothesis/via | tests/unit/via/views/route_by_content_test.py | Python | bsd-2-clause | 2,306 |
import frappe
def execute():
frappe.reload_doc('accounts', 'doctype', 'sales_invoice')
frappe.reload_doc('accounts', 'doctype', 'sales_invoice_payment')
for time_sheet in frappe.db.sql(""" select sales_invoice, name, total_billable_amount from `tabTimesheet`
where sales_invoice is not null and docstatus < 2""", a... | hassanibi/erpnext | erpnext/patches/v7_0/move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py | Python | gpl-3.0 | 773 |
"""
Author: Elias Bakken
email: elias(dot)bakken(at)gmail(dot)com
Website: http://www.thing-printer.com
License: GNU GPL v3: http://www.gnu.org/copyleft/gpl.html
Redeem 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 Fou... | quillford/redeem | redeem/BedCompensation.py | Python | gpl-3.0 | 3,785 |
# Copyright (C) 2007, One Laptop Per Child
#
# This library 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 2 of the License, or (at your option) any later version.
#
# This library is ... | quozl/sugar-toolkit-gtk3 | src/sugar3/graphics/combobox.py | Python | lgpl-2.1 | 5,504 |
# Script that produces:
# a) courses, started in the last six months, in which there are new lessons in the last month,
# b) courses created over the past six months, in which more than 10 students
#
# Issues (stdout + csv file):
# 0) the condition a) or b) or a) + b)
# 1) a reference to the course
# 2) the nam... | StepicOrg/Stepic-API | examples/get_active_courses.py | Python | mit | 3,803 |
"""
WSGI config for composeexample project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | krukmat/docker-rest-django | website/wsgi.py | Python | cc0-1.0 | 398 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Common filesystem operations """
from __future__ import absolute_import
from __future__ import unicode_literals
from __... | aldebaran/qibuild | python/qisys/sh.py | Python | bsd-3-clause | 22,082 |
#
# Data caching mechanism
# ~~~~~~~~~~~~~~~~~~~~~~
# Copyright (C) 2011 Brian M Hunt.
# All Rights Reserved.
#
import csv
import json
import logging
import StringIO
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
from flask import Flask, jsonify, abort, send_file
#
# Google Docs spread... | brianmhunt/SIWorldMap | data.py | Python | mit | 1,845 |
#
# Represents OS distribution specific install data
#
# Copyright 2006-2007, 2013 Red Hat, Inc.
# Daniel P. Berrange <berrange@redhat.com>
#
# 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; eith... | bwildenhain/virt-manager | virtinst/urlfetcher.py | Python | gpl-2.0 | 37,564 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Stephen Fromm <sfromm@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': ... | drmrd/ansible | lib/ansible/modules/system/user.py | Python | gpl-3.0 | 81,234 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import os, base64, re
import hashlib
import mimetypes
from frappe.utils import get_site_path, get_hook_method, get_files_path
from frappe import _
from frappe imp... | gangadharkadam/shfr | frappe/utils/file_manager.py | Python | mit | 8,083 |
"""
Tests for Blocks Views
"""
import json
import unittest
import ddt
import httpretty
from django.conf import settings
from django.urls import reverse
from django.test import RequestFactory, TestCase, override_settings
from mock import call, patch
from Cryptodome.PublicKey import RSA
from jwkest import jwk
from oa... | ahmedaljazzar/edx-platform | openedx/core/djangoapps/oauth_dispatch/tests/test_views.py | Python | agpl-3.0 | 28,148 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# tests/server/server_rpc.py
#
# 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 ... | securestate/king-phisher | tests/server/server_rpc.py | Python | bsd-3-clause | 8,736 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
##
## This is part of Pybble, a WMS (Whatever Management System) based on
## Jinja2/Haml, Werkzeug, Flask, and Optimism.
##
## Pybble is Copyright © 2009-2014 by Matthias Urlichs <matthias@urlichs.de>,
## it is li... | smurfix/pybble | pybble/core/models/types.py | Python | gpl-3.0 | 6,851 |
"""
Conda packages
===============
This module provides tools for installing conda packages using
the `miniconda`_ distribution.
.. _miniconda: http://conda.pydata.org/miniconda.html
"""
from contextlib import contextmanager
from pipes import quote
import os
import posixpath
from fabric.api import cd, run, settings... | AMOSoft/fabtools | fabtools/conda.py | Python | bsd-2-clause | 8,326 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['ConstantTrend'] , ['NoCycle'] , ['ARX'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Quantization/model_control_one_enabled_Quantization_ConstantTrend_NoCycle_ARX.py | Python | bsd-3-clause | 157 |
# -*- coding: utf-8 -*-
"""Tests for plugin manager."""
import unittest
try:
from unittest import mock
except ImportError:
import mock
from dyndnsc.plugins import manager
class Dummy(object):
"""Empty Dummy class used to test plugin system."""
pass
class TestPluginProxy(unittest.TestCase):
... | infothrill/python-dyndnsc | dyndnsc/tests/plugins/test_manager.py | Python | mit | 2,939 |
from nose.plugins.attrib import attr
from tests import WordPressTestCase
from wordpress_xmlrpc.methods import users
from wordpress_xmlrpc.wordpress import WordPressUser, WordPressBlog, WordPressAuthor
class TestUsers(WordPressTestCase):
@attr('users')
@attr('pycompat')
def test_user_repr(se... | Lobosque/python-wordpress-xmlrpc | tests/test_users.py | Python | mit | 2,313 |
import unittest
from src.data_structures.mockdata import MockData
class TestMockData (unittest.TestCase):
def setUp(self):
self.data = MockData()
def test_random_data(self):
data = MockData()
a_set = data.get_random_elements(10)
self.assertTrue(len(a_set) == 10, "the data sh... | alcemirsantos/algorithms-py | tests/data_stuctures/test_mockdata.py | Python | mit | 400 |
#!/usr/bin/python
#
# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | dagwieers/ansible | lib/ansible/modules/cloud/azure/azure_rm_sqldatabase_info.py | Python | gpl-3.0 | 8,870 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Injects local copies of CocoaPods in Podfile
# Version 1.2
# Homepage: https://github.com/anodamobi/Local-CocoaPods-auto-attacher
# Author: Alex Zavrazhniy <alex@anoda.mobi>
# Copyright 2014, ANODA Mobile Development Agency
# License: MIT
import argparse
import os
impo... | anodamobi/LocalPods | localpods.py | Python | mit | 7,420 |
# -*- coding: UTF-8 -*-
## Copyright 2014-2015 Rumma & Ko Ltd
"""
Adds usage of the `AwesomeUploader
<http://jsjoy.com/blog/ext-js-extension-awesome-uploader>`_ by Andrew
Rymarczyk, hosted at
<https://code.google.com/p/awesomeuploader/source/checkout>.
Example configuration in a :xfile:`settings.py` file or
a :xfile:... | lino-framework/lino | lino/modlib/awesomeuploader/__init__.py | Python | bsd-2-clause | 1,955 |
__source__ = 'https://leetcode.com/problems/decode-string/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/decode-string.py
# Time: O(n)
# Space: O(h), h is the depth of the recursion
#
# Description: 394. Decode String
#
# Given an encoded string, return it's decoded string.
#
# The encoding rule is: k[enc... | JulyKikuAkita/PythonPrac | cs15211/DecodeString.py | Python | apache-2.0 | 3,596 |
import _plotly_utils.basevalidators
class YhoverformatValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="yhoverformat", parent_name="scatter", **kwargs):
super(YhoverformatValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_n... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter/_yhoverformat.py | Python | mit | 411 |
# $HeadURL$
__RCSID__ = "$Id$"
import sys
import os
import getopt
import types
import DIRAC
from DIRAC import gLogger
from DIRAC import S_OK, S_ERROR
from DIRAC.ConfigurationSystem.Client.ConfigurationData import gConfigurationData
from DIRAC.ConfigurationSystem.private.Refresher import gRefresher
from DIRAC.Configu... | Sbalbp/DIRAC | ConfigurationSystem/Client/LocalConfiguration.py | Python | gpl-3.0 | 17,781 |
"""
This config file extends the test environment configuration
so that we can run the lettuce acceptance tests.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614
from .test import *
from lms.envs.sauce import *... | huchoi/edx-platform | cms/envs/acceptance.py | Python | agpl-3.0 | 4,093 |
#!/usr/bin/python
# Frederic-Gerald Morcos 4-1805 E11
import sys
if len(sys.argv) < 3:
print "Usage: ./des.py <enc|dec> <key> <plaintext>"
sys.exit(0)
enc = (sys.argv[1] == "enc")
key = sys.argv[2]
msg = ""
for i in range(3, len(sys.argv)):
msg += str(sys.argv[i])
while len(key) % 8:
key += "x"
while len(msg... | fredmorcos/attic | projects/des-playfair/des.py | Python | isc | 6,392 |
from urllib.error import URLError, HTTPError
from xml.dom import minidom
from dns import resolver
import urllib.request
import logging
def parse_thunderbird_autoconfig(xml_autoconfig):
mx_servers = []
dom_tree = minidom.parseString(xml_autoconfig)
c_nodes = dom_tree.childNodes
for i in c_nodes[0].ge... | bartQu9/fallenmua | resolvers.py | Python | gpl-3.0 | 3,740 |
ONE = 'I'
FIVE = 'V'
TEN = 'X'
VALUE_FIVE = 5
VALUE_TEN = 10
class Roman(object):
@classmethod
def translate(cls, number):
base_digit, base_digit_value = cls.base_roman_digit(number)
remains_to_translate = number - base_digit_value
if number <= 3:
return cls.translate_lowe... | alejandrodob/dojo | katas/roman-numerals/python-24-09-15/roman_numerals.py | Python | mit | 882 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# 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 ... | sergiusens/snapcraft | tests/unit/commands/test_build.py | Python | gpl-3.0 | 3,820 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime, timedelta
from odoo import models, api, fields
from odoo.fields import Datetime as FieldDateTime
from odoo.tools.translate import _
from odoo.exceptions import UserError
from odoo.osv.expre... | ygol/odoo | addons/l10n_fr_pos_cert/models/account_closing.py | Python | agpl-3.0 | 9,347 |
import sys
from pdb import pm
from future.utils import viewitems
from miasm.loader.strpatchwork import StrPatchwork
from miasm.core import parse_asm
from miasm.expression.expression import ExprCompose, ExprOp, ExprInt, ExprId
from miasm.core.asmblock import asm_resolve_final
from miasm.analysis.machine import Machine... | commial/miasm | test/analysis/dse.py | Python | gpl-2.0 | 4,283 |
# coding=utf-8
# -----------------
# file : debugger_mode.py
# date : 2014/11/18
# author : Victor Zarubkin
# contact : victor.zarubkin@gmail.com
# copyright : Copyright (C) 2014 Victor Zarubkin
# license : This file is part of BehaviorStudio.
# :
# : BehaviorStudio is fre... | cas4ey/behavior-studio | source/remote_debugger/debugger_mode.py | Python | gpl-3.0 | 2,171 |
#!/usr/bin/env python3
"""
Collection of Handy Utilities & Dialogs used by RHP-POS.
A smattering of functions & objects used to make
everything run smoothly & correctly.
"""
#-*- coding: utf-8 -*-
#import wxversion
#wxversion.select('2.8')
import wx
import os
import re
import json
import pout
import sys
import strin... | fuspu/RHP-POS | handy_utils.py | Python | mit | 455,655 |
# Copyright 2010-present Basho Technologies, 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... | basho/riak-python-client | riak/transports/tcp/__init__.py | Python | apache-2.0 | 2,223 |
"""
LinkedIn Authentication
"""
from xml.etree import ElementTree
from django.conf import settings
from .oauthclient import client
API_KEY = settings.LINKEDIN_API_KEY
API_SECRET = settings.LINKEDIN_API_SECRET
# some parameters to indicate that status updating is possible
STATUS_UPDATES = False
STATUS_UPDATE_WORDIN... | benadida/helios-server | helios_auth/auth_systems/linkedin.py | Python | apache-2.0 | 2,727 |
import socket, time, re
class TwitchWinner():
def __init__(self, chan='', nick='', password=''):
self.host = "irc.chat.twitch.tv"
self.port = 6667
self.chan = chan
self.nick = nick
self.password = password # www.twitchapps.com/tmi/
self.msgTimer = 0
self.setu... | danpaquin/twitch-giveaway-winner | TwitchWinner.py | Python | mit | 3,473 |
##
# Copyright (c) 2006-2015 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | red-hood/calendarserver | twistedcaldav/method/report_calendar_query.py | Python | apache-2.0 | 12,641 |
from django.contrib.auth.models import User
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from models import ImagerProfile
@receiver(post_save, sender=User)
def create_profile(sender, **kwargs):
"""When creating a new User also create a new ImagerProfile"""
if ... | edpark13/django-imager | imager/profiles/signals.py | Python | mit | 624 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-dialogflow-cx | tests/unit/gapic/dialogflowcx_v3beta1/test_transition_route_groups.py | Python | apache-2.0 | 108,321 |
# Copyright 2014 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.
import time
from telemetry.page.actions import page_action
class RepaintContinuouslyAction(page_action.PageAction):
""" Continuously repaints the visible... | patrickm/chromium.src | tools/telemetry/telemetry/page/actions/repaint_continuously.py | Python | bsd-3-clause | 1,828 |
# -*- coding: utf-8 -*-
"""
Unit tests for LMS instructor-initiated background tasks helper functions.
Tests that CSV grade report generation works with unicode emails.
"""
import ddt
from mock import Mock, patch
import tempfile
from openedx.core.djangoapps.course_groups import cohorts
import unicodecsv
from django.... | jamiefolsom/edx-platform | lms/djangoapps/instructor_task/tests/test_tasks_helper.py | Python | agpl-3.0 | 61,734 |
"""
This module defines export functions for decision trees.
"""
# Authors: Gilles Louppe <g.louppe@gmail.com>
# Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Brian Holt <bdholt1@gmail.com>
# Noel Dawe <noel@dawe.me>
# Satrajit Gosh <satrajit.ghosh@gmail.com>
# Trevor... | zorroblue/scikit-learn | sklearn/tree/export.py | Python | bsd-3-clause | 18,326 |
"""Basic tests for the cherrypy.Request object."""
import os
localDir = os.path.dirname(__file__)
import sys
import types
import six
from cherrypy._cpcompat import IncompleteRead, ntob, ntou
import cherrypy
from cherrypy.lib import httputil
defined_http_methods = ("OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE",... | flakey-bit/plugin.audio.spotify | resources/libs/cherrypy/test/test_request_obj.py | Python | gpl-3.0 | 32,367 |
import copy
import re
from optparse import OptionParser
from pocketpy.auth import auth
from pocketpy.jsonconfig import JsonConfig
from pocketpy.pocket import retrieve
from pocketpy.tags import add_tags, has_tag
def has_long_tag(item):
return has_tag(item, 'long')
def isolate_long_articles(items, long_word_coun... | Newky/PocketPy | bin/operators.py | Python | mit | 2,713 |
# This let's python know about the addon_manager module. | jstitch/wesnoth | data/tools/addon_manager/__init__.py | Python | gpl-2.0 | 56 |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.cache
~~~~~~~~~~~~~~~~~~~~~~
The main problem with dynamic Web sites is, well, they're dynamic. Each
time a user requests a page, the webserver executes a lot of code, queries
the database, renders templates until the visitor gets the page he sees.
... | zhaoguixu/werkzeug | werkzeug/contrib/cache.py | Python | bsd-3-clause | 26,468 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from builtins import object, open
from textwrap import dedent
from pants.util.... | twitter/pants | tests/python/pants_test/backend/project_info/tasks/resolve_jars_test_mixin.py | Python | apache-2.0 | 3,747 |
class Solution(object):
def twoSum(self, nums, target):
lookup = {}
for i, num in enumerate(nums):
if target - num in lookup:
return [lookup[target - num], i]
lookup[num] = i
return []
if __name__ == '__main__':
print Solution().twoSum((0, 2, 7, 1... | ravyg/algorithms | python/1_twoSum.py | Python | gpl-3.0 | 331 |
from __future__ import absolute_import
import responses
import pytest
import six
from exam import fixture
from django.test import RequestFactory
from time import time
from sentry.integrations.exceptions import IntegrationError
from sentry.integrations.vsts.integration import VstsIntegration
from sentry.models impor... | mvaled/sentry | tests/sentry/integrations/vsts/test_issues.py | Python | bsd-3-clause | 16,821 |
# -*- encoding: utf-8 -*-
"""
Kupfer's Hosts API
Main definition and *constructor* classes.
"""
from kupfer.obj.grouping import GroupingLeaf
__author__ = ("Ulrik Sverdrup <ulrik.sverdrup@gmail.com>, "
"Karol Będkowski <karol.bedkowsk+gh@gmail.com>" )
HOST_NAME_KEY = "HOST_NAME"
HOST_ADDRESS_KEY = "HOS... | Theragon/kupfer | kupfer/obj/hosts.py | Python | gpl-3.0 | 1,293 |
import cv2
import numpy as np
from digital_image_processing.filters.convolve import img_convolve
from digital_image_processing.filters.sobel_filter import sobel_filter
PI = 180
def gen_gaussian_kernel(k_size, sigma):
center = k_size // 2
x, y = np.mgrid[0 - center : k_size - center, 0 - center : k_size - ce... | TheAlgorithms/Python | digital_image_processing/edge_detection/canny.py | Python | mit | 4,698 |
########################################################################################
## This file is a part of YAP package of scripts. https://github.com/shpakoo/YAP
## Distributed under the MIT license: http://www.opensource.org/licenses/mit-license.php
## Copyright (c) 2011-2013 Sebastian Szpakowski
#############... | shpakoo/YAP | YAPBLAST.py | Python | mit | 6,143 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 Stephen Bunn <ritashugisha>
# MIT License <https://opensource.org/licenses/MIT>
"""
word
.. module:: models
:platform: Linux, MacOSX, Win32
:synopsis:
:created: 2016-10-10T13:03:19-04:00
.. moduleauthor:: Stephen Bunn <ritashugisha> (ri... | ritashugisha/scrab | scrab/models/word.py | Python | mit | 1,519 |
import numpy as np
from . import config as ttconf
from . import MissingDataError
from .treeanc import TreeAnc
from .utils import numeric_date, DateConversion, datestring_from_numeric
from .distribution import Distribution
from .branch_len_interpolator import BranchLenInterpolator
from .node_interpolator import NodeInte... | neherlab/treetime | treetime/clock_tree.py | Python | mit | 48,273 |
import numpy as np
import data
import amino_acid
import iedb
#X,Y = iedb.load_dataset(assay_group = 'cytotoxicity')
X,Y = iedb.load_dataset()
import sklearn
import sklearn.cross_validation
import sklearn.ensemble
import sklearn.linear_model
print "Amino acid histogram vectors w/ Logistic Regression"
lr = sklearn... | iskandr/immuno | Jan24.py | Python | gpl-2.0 | 1,126 |
#
# This sets up how models are displayed
# in the web admin interface.
#
from builtins import object
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCre... | titeuf87/evennia | evennia/players/admin.py | Python | bsd-3-clause | 9,894 |
import glob
import logging
import os
import subprocess
from plugins import BaseAssembler
from yapsy.IPlugin import IPlugin
class A6Assembler(BaseAssembler, IPlugin):
OUTPUT = 'scaffolds'
def run(self):
reads = self.data.readsets
cmd_args = [self.executable]
libfile = open(os.path.join... | cbun/assembly | lib/assembly/plugins/a6.py | Python | mit | 1,404 |
from scipy import signal
# Currently this filter uses numbers for boundaries defined in Oliver's matlab code.
# Shoaib pointed out that it should be 13 bands instead of 11 for original MFCC bands.
# Need to remove .62* later.
period16=16000
period8=8000
period4=4000
period2=2000
#why do we use different period value?
... | UWNetworksLab/GlimpseData | Visualizer/Filter.py | Python | apache-2.0 | 1,654 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('orb', '0012_auto_20150505_1740'),
]
operations = [
migrations.AlterField(
model_name='searchtracker',
... | mPowering/django-orb | orb/migrations/0013_auto_20150506_1914.py | Python | gpl-3.0 | 552 |
#! /usr/bin/env python
from glob import glob
pFiles = glob('*_p.py')
for p in pFiles:
pf = open(p,'r')
lines = pf.readlines()
pf.close()
pf = open(p,'w')
for line in lines:
if line.find('PyadhTools') != -1:
pass
elif line.find('default_p') != -1:
line = 'from... | erdc/proteus | scripts/update_p.py | Python | mit | 601 |
from django.conf.urls.defaults import *
from piston.resource import Resource
from handlers import AllocationByTopHandler,AllocationByProjectHandler
import settings
alloc_by_top = Resource(AllocationByTopHandler)
alloc_by_project = Resource(AllocationByProjectHandler)
urlpatterns = patterns('',
url(r'^allocationbyt... | cernops/CloudMan | export/urls.py | Python | apache-2.0 | 602 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# test_client modeltest urls
(r'^test_client/', include('modeltests.test_client.urls')),
(r'^test_client_regress/', include('regressiontests.test_client_regress.urls')),
# File upload test views
(r'^file_uploads/', include('regress... | hugs/django | tests/urls.py | Python | bsd-3-clause | 1,144 |
import math
from psi4 import core
from ..diis import DIIS, StoragePolicy, RemovalPolicy
def _RHF_orbital_gradient(self, save_fock: bool, max_diis_vectors: int) -> float:
gradient = self.form_FDSmSDF(self.Fa(), self.Da())
if save_fock:
if not self.initialized_diis_manager_:
storage_policy ... | susilehtola/psi4 | psi4/driver/procrouting/scf_proc/subclass_methods.py | Python | lgpl-3.0 | 3,657 |
# This utility guides the user in the process of adding a movie.
# The only field required is "Title".
# The other fields can be left blank
#
# It is important to avoid different names for the fields: (*)
# eg. "Frankstein Jr" against "Frankstein Junior".
# Of course this does not apply to titles since a movie is expec... | rationalpsyche/Movie-map | add.py | Python | gpl-3.0 | 1,427 |
# BSD 3-Clause License -> see /LICENSE
# Copyright (c) 2017-2020 by Ben de Waal, All rights reserved.
#
# two consecutuve calls in this window passses the turing test and will be allowed through and whitelisted
# this is how long the state machine spends in p-mode
REDIAL_WINDOW = 60 # s
# how long to block the line w... | benjaveri/phonescreen | v2/config.py | Python | bsd-3-clause | 390 |
"""
Microsoft Archive parser
Author: Victor Stinner
Creation date: 2007-03-04
"""
MAX_NB_FILE = 100000
from hachoir_parser import Parser
from hachoir_core.field import FieldSet, String, UInt32, SubFile
from hachoir_core.endian import LITTLE_ENDIAN
from hachoir_core.text_handler import textHandler, filesizeHandler, h... | goofwear/raspberry_pwn | src/pentest/metagoofil/hachoir_parser/archive/mar.py | Python | gpl-3.0 | 2,204 |
# Copyright 2016 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | google/smilesparser | test_smilesparser.py | Python | apache-2.0 | 1,060 |
# -*- coding: utf-8 -*-
'''
Created on 2014/07/04
@author: deadblue
'''
import string
import urllib2
import os
__all__ = ['StringPart', 'FilePart', 'FileDataPart', 'MultipartRequest']
def _create_boundary():
import random
buf = ['----']
for _ in xrange(16):
buf.append(random.choice(string.ascii_... | deadblue/baidupan_shell | baidupan/http.py | Python | gpl-2.0 | 2,445 |
"""Equipment: most kinds of mechanical shit that does things. It may need power. It may take from atmo. It may open onto space. It may spontaneously explode. Equipment is guaranteed to liven up any old party! Equipment is not for everyone. Consult your doctor before using equipment."""
from atmospherics import... | facepalm/bliss-station-game | src/equipment/general.py | Python | gpl-3.0 | 28,386 |
# ubuntuone.syncdaemon.local_rescan - local rescanning
#
# Author: Facundo Batista <facundo@canonical.com>
#
# Copyright 2009-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 version 3, as published
# by the Free Software... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/ubuntuone-client/ubuntuone/syncdaemon/local_rescan.py | Python | gpl-3.0 | 30,813 |
import hive
hive.register() | agoose77/hivesystem | test-addon.py | Python | bsd-2-clause | 28 |
# -*- coding: 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 License, Version 2.0 (the
#... | akosel/incubator-airflow | airflow/www/views.py | Python | apache-2.0 | 113,249 |
import pytest
import unittest.mock as mock
import tilemapbase.utils as utils
import PIL.Image
import threading
import time
def test_logging():
with mock.patch("sys.__stdout__") as stdmock:
utils.start_logging()
import logging
logger = logging.getLogger("tilemapbase")
logger.debug("... | MatthewDaws/TileMapBase | tests/test_utils.py | Python | mit | 2,719 |
#! /usr/bin/env python
import sys
from time import time
from rpython.rlib.rbigint import rbigint
# __________ Entry point __________
def entry_point(argv):
"""
All benchmarks are run using --opt=2 and minimark gc (default).
Benchmark changes:
2**N is a VERY heavy operation in d... | oblique-labs/pyVM | rpython/translator/goal/targetbigintbenchmark.py | Python | mit | 6,563 |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from ocfnet.database import Model
from ocfnet.media.models import *
from ocfnet.user.models import *
try:
from config import DATABASE_URL
except:
from configd... | oregoncountryfair/ocfnet | ocfnet/migrations/env.py | Python | mit | 2,236 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def populate_region(apps, schema_editor):
Issue = apps.get_model("polls", "Issue")
for issue in Issue.objects.all():
if issue.regions.count() == 1:
issue.region = issue.regions.first()... | xkmato/tracpro | tracpro/polls/migrations/0016_auto_20150204_1327.py | Python | bsd-3-clause | 552 |
import glob
import os
class Kfake():
def __init__(self):
self.conn = 'fake'
def volumes(self, iso=True):
return glob.glob('*.iso')
def add_image(self, url, pool, cmd=None, name=None, size=None):
os.system("curl %s > %s" % (url, os.path.basename(url)))
def delete_image(self, ... | karmab/kcli | kvirt/providers/fake/__init__.py | Python | apache-2.0 | 460 |
import time
import pingo
board = pingo.detect.get_board()
rgb = [board.pins[i] for i in (11, 13, 15)]
for pin in rgb:
pin.mode = pingo.OUT
pin.low()
while True:
for pin in rgb:
pin.low()
print(pin, pin.state)
time.sleep(.5)
pin.high()
break
| dyegocantu/pingo-py | pingo/examples/rgb_led.py | Python | mit | 294 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ..util.process import Process
from ..util.color import Color
from ..tools.tshark import Tshark
from ..tools.pyrit import Pyrit
import re, os
class Handshake(object):
def __init__(self, capfile, bssid=None, essid=None):
self.capfile = capfile
sel... | derv82/wifite2 | wifite/model/handshake.py | Python | gpl-2.0 | 8,963 |
#!/usr/bin/python
# This is a simple port-forward / proxy, written using only the default python
# library. If you want to make a suggestion or fix something you can contact-me
# at voorloop_at_gmail.com
# Distributed over MIT license
import socket
import select
import time
import sys
buffer_size = 4096
forward_to = (... | voorloopnul/proxy | proxy.py | Python | mit | 3,043 |
from __future__ import division
import sys
import os
# XXX: also redirect C streams, for capturing nvcc messages (else it looks like there are excessive newlines in log file)
class ConsoleAndFileLogger(object):
"""
Logging helper which prints to a file and a stream (e.g. stdout) simultaneously.
Can be use... | bnsnapper/keras_bn_library | keras_extensions/logging.py | Python | mit | 4,350 |
# import os
import numpy as np
import matplotlib.pyplot as plt
import random
# cluster_dp_GPU = "./cluster_dp_GPU"
# os.system(cluster_dp_GPU)
input_file = raw_input("enter the input file name:")
result_file = raw_input("enter the result file name:")
location = []
# input_lable = []
for line in open("dataset/"+input_f... | GeKeShi/cluster-dp | cluster_image.py | Python | gpl-3.0 | 1,589 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 2013Commons/HUE-SHARK | desktop/core/src/desktop/lib/test_export_csvxls.py | Python | apache-2.0 | 1,595 |
# Copyright (c) 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... | noelbk/neutron-juniper | neutron/extensions/extra_dhcp_opt.py | Python | apache-2.0 | 2,850 |
# (C) British Crown Copyright 2014, Met Office
#
# This file is part of Iris.
#
# Iris 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 ve... | Jozhogg/iris | lib/iris/tests/unit/analysis/maths/test_add.py | Python | lgpl-3.0 | 1,586 |
from distutils.core import setup, Extension
from distutils.command.build import build as DistutilsBuild
import os, platform
make = 'make'
ext = 'so'
if platform.system() == 'Darwin':
ext = 'dylib'
elif 'BSD' in platform.system():
make = 'gmake'
class Build(DistutilsBuild):
def run(self):
if not os... | zshipko/libtwombly | setup.py | Python | mit | 771 |
# Copyright 2014
# The Cloudscaling Group, 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... | openstack/ec2-api | ec2api/tests/unit/test_context.py | Python | apache-2.0 | 2,461 |
import sys
import datetime
import restx.core
from restx.testtools.utils import init_test_run
def _get_func( func_name ):
"""
Return a function object for a function specified by name.
This function is courtesy of hasen j, who supplied it as an
answer to this StackOverflow question:
http://s... | jbrendel/RESTx | src/python/restx/testtools/runner.py | Python | gpl-3.0 | 2,704 |
import tensorflow as tf
import numpy as np
import pytest
import os
import random
from Images import get_shuffled_images, time_offset_label, load_transform
class OmniglotGenerator(object):
"""Docstring for OmniglotGenerator"""
def __init__(self, data_folder, batch_size=1, nb_samples=5, nb_samples_per_class=10,... | llSourcell/How-to-Learn-from-Little-Data | MANN/Utils/Generator.py | Python | mit | 2,932 |
"""Infrastructure to provide FPBench tests and benchmarks."""
import traceback
from . import toolserver
from . import fpcparser
class Benchmarks(object):
"""All of the FPBench benchmarks."""
def _import_cores(self, paths):
cores = []
for path in paths:
try:
core... | billzorn/fpunreal | titanfp/fpbench/benchmarks.py | Python | mit | 1,192 |
# 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/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_cluster_versions_operations.py | Python | mit | 14,467 |
"""
Wrapper for OpenMM Amber potential.
To be consistent with GMIN, units are kcal/mol and angstroms
Requires:
coords.inpcrd and coords.prmtop
"""
# TODO: if BasePotential is imported after simtk imports, it gives a seg fault!!
from pele.potentials import BasePotential
from simtk.openmm.app impor... | js850/pele | pele/amber/openmm_potential.py | Python | gpl-3.0 | 5,664 |
__author__ = "Roman Bogorodskiy <bogorodskiy@gmail.com>"
class EcruPost(object):
text = ''
props = {}
def __init__(self, text):
self.parseText(text)
def parseText(self, text):
lines = text.split('\n')
readingText = False
if lines[0].find(":") == -1:
self.t... | novel/ecru | python/ecru.py | Python | bsd-2-clause | 985 |
# supplementing modifiedMexicanHatTest5.py
# outputing the charts, given the results
import numpy as np
import matplotlib.pyplot as plt
from armor import pattern
from armor import defaultParameters as dp
dbz = pattern.DBZ
DS = pattern.DBZstream
dataFolder = dp.root + "labLogs/2014-5-5-modifiedMexicanHatTest8/"
... | yaukwankiu/armor | tests/modifiedMexicanHatTest8a.py | Python | cc0-1.0 | 1,807 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.