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 2013 IBM Corp.
#
# 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... | phenoxim/nova | nova/objects/service.py | Python | apache-2.0 | 26,041 |
from sequana import TRF
from sequana import sequana_data
def test_trf():
tt = TRF(sequana_data("test_trf1.dat"))
tt.hist_period_size()
tt.hist_entropy()
tt.hist_repet_by_sequence()
| sequana/sequana | test/test_trf.py | Python | bsd-3-clause | 202 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('declaration', '0003_declaration_nsfw'),
]
operations = [
migrations.AddField(
model_name='declaration',
... | ej2/declarationshare | declarationshare/declaration/migrations/0004_declaration_ip_address.py | Python | bsd-3-clause | 434 |
from abc import ABC, abstractmethod
from dataclasses import dataclass
from dataclasses import field as dfield
from datetime import datetime
from typing import Union, overload
from django.conf import settings
from django.core.paginator import Paginator as DjPaginator, PageNotAnInteger, EmptyPage
from django.utils impor... | mozilla/kitsune | kitsune/search/base.py | Python | bsd-3-clause | 16,262 |
import logging
import os
import utils
def initialize(output_dir, reset=True):
all_path = os.path.join(output_dir, 'all.log')
error_path = os.path.join(output_dir, 'error.log')
if reset:
utils.safe_remove(all_path)
utils.safe_remove(error_path)
logger = logging.getLogger()
logger.... | arantes555/oblivious-movie-gharial | logger.py | Python | mit | 1,214 |
#!/usr/bin/python2
# -*- encoding: utf-8 -*-
# This is pncconf, a graphical configuration editor for LinuxCNC
# Chris Morley copyright 2009
# This is based from stepconf, a graphical configuration editor for linuxcnc
# Copyright 2007 Jeff Epler <jepler@unpythonic.net>
#
# This program is free software; y... | strahlex/machinekit | src/emc/usr_intf/pncconf/pncconf.py | Python | lgpl-2.1 | 548,563 |
#from kitti import kitti
#from pascal_voc import pascal_voc
from fpascal_voc import fpascal_voc
| fyhtea/squeezeDet-hand | src/dataset/__init__.py | Python | bsd-2-clause | 96 |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Templates for constructing various sorts of invalid transactions.
These templates (or an iterator ove... | chaincoin/chaincoin | test/functional/data/invalid_txs.py | Python | mit | 5,880 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013-15, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This pro... | numenta/nupic | tests/unit/nupic/data/fieldmeta_test.py | Python | agpl-3.0 | 3,531 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import string,re
alphabet = list(string.ascii_uppercase)
alphanum = list(range(1,len(alphabet)))
word = input("Type the word: ").upper()
word = word.replace("Ä", "A")
word = word.replace("Ö", "O")
word = word.replace("Ü", "U")
word = word.replace("ß", "S")
for letter i... | diaphon/gematria | gematria_mispar-siduri.py | Python | mit | 388 |
#!/usr/bin/env python
import tinyapi
import argparse
from getpass import getpass
import unicodecsv as csv
import json
import re
import sys
def dot_notate(d):
def expand(key, value):
if isinstance(value, dict):
return [ (key + '.' + str(k), v)
for k, v in dot_notate(value).items... | jsvine/tinystats | tinystats/cli.py | Python | mit | 3,997 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Study.organization'
db.delete_column(u'feed_study', 'or... | Squishymedia/feedingdb | src/feeddb/feed/migrations/0089_auto__del_field_study_organization__del_field_study_funding__del_field.py | Python | gpl-3.0 | 42,164 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | tkaitchuck/nupic | py/nupic/frameworks/opf/two_gram_model.py | Python | gpl-3.0 | 6,948 |
import numpy as np
def linearRegCostFunction(X, y, theta, Lambda):
"""computes the
cost of using theta as the parameter for linear regression to fit the
data points in X and y. Returns the cost in J and the gradient in grad
"""
# Initialize some useful values
m = y.size # number of training e... | robotenique/mlAlgorithms | supervised/modelEvaluation/linearRegCostFunction.py | Python | unlicense | 615 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | redhat-openstack/glance | glance/api/middleware/cache_manage.py | Python | apache-2.0 | 3,085 |
from django.utils.translation import ugettext_lazy as _
from keops.db import models
1
class Config(models.Model):
"""
Manage general db configuration attributes (ui visible).
"""
update_url = models.URLField(_('update URL'), help_text=_('Vendor update URL'))
support_url = models.URLField(_('support... | mrmuxl/keops | keops/modules/base/models/config.py | Python | agpl-3.0 | 937 |
# Copyright (c) 2016 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | uber/tchannel-python | tchannel/tornado/stream.py | Python | mit | 8,827 |
# -*- coding: utf_8 -*-
"""Module for iOS IPA Binary Analysis."""
import logging
from pathlib import Path
from macholib.mach_o import (CPU_TYPE_NAMES, MH_CIGAM_64, MH_MAGIC_64,
get_cpu_subtype)
from macholib.MachO import MachO
from mobsf.StaticAnalyzer.views.ios.classdump import (
ge... | MobSF/Mobile-Security-Framework-MobSF | mobsf/StaticAnalyzer/views/ios/binary_analysis.py | Python | gpl-3.0 | 3,793 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import print_function, unicode_literals
import os
import sys
from functools import partia... | mvidalgarcia/indico | indico/cli/database.py | Python | mit | 6,899 |
"""
This is an example thingflow program that is described in tutorial.rst.
"""
# First, let's define a sensor that generates a random number each time
# it is sampled.
import random
random.seed()
from thingflow.base import SensorAsOutputThing
class RandomSensor:
def __init__(self, sensor_id, mean, stddev, sto... | mpi-sws-rse/thingflow-python | examples/tutorial.py | Python | apache-2.0 | 2,404 |
# 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... | aldian/tensorflow | tensorflow/python/keras/layers/embeddings_test.py | Python | apache-2.0 | 5,558 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import datasets
import datasets.pascal_voc
import os
import datasets.im... | herobd/fast-rcnn | lib/datasets/pascal_voc.py | Python | mit | 12,043 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | deepfield/ibis | ibis/_version.py | Python | apache-2.0 | 15,759 |
"""Light platform support for yeelight."""
import logging
from typing import Optional
import voluptuous as vol
import yeelight
from yeelight import (
BulbException,
Flow,
RGBTransition,
SleepTransition,
transitions as yee_transitions,
)
from yeelight.enums import BulbType, LightType, PowerMode, Sce... | nkgilley/home-assistant | homeassistant/components/yeelight/light.py | Python | apache-2.0 | 30,470 |
from datetime import datetime, timedelta
import functools
import hashlib
from django.http import HttpResponseForbidden
from django.core.cache import cache
from django.conf import settings
class ratelimit(object):
"Instances of this class can be used as decorators"
# This class is designed to be sub-classed
... | opencorato/mapit | mapit/ratelimitcache.py | Python | agpl-3.0 | 3,974 |
#
# GNU Mailutils -- a suite of utilities for electronic mail
# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
#
# 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
# ve... | ssvlab/esbmc-gpu | regression/esbmc-cpp/projects/mailutils-2.2/python/mailutils/address.py | Python | apache-2.0 | 3,710 |
# -*- coding: utf-8 -*-
"""Module containing book resource class."""
from typing import Iterable
from goodreads_api_client.resources.base import Resource
class Book(Resource):
resource_name = 'book'
def id_to_work_id(self, ids: Iterable[str]):
id_csv = ','.join(ids)
endpoint = 'book/id_to_wo... | mdzhang/goodreads-api-client-python | goodreads_api_client/resources/book.py | Python | mit | 1,478 |
#!/usr/bin/env python
# Copyright (c) 2011 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 pyauto_functional
import pyauto
import chromeos.file_browser
import test_utils
class ChromeosFileBrowserTest(pyauto.PyUIT... | ropik/chromium | chrome/test/functional/chromeos_file_browser.py | Python | bsd-3-clause | 11,052 |
import unittest
from unittest.mock import patch
@patch("app.client.github.requests")
class TestGithubClient(unittest.TestCase):
def test_search_for_user_successful(self, mock_requests):
pass
if __name__ == '__main__':
unittest.main()
| darylmathison/github-user-queries | tests/client/test_github.py | Python | gpl-3.0 | 254 |
#!/usr/bin/env python
#
# Copyright 2010-2011 The Regents of the University of California
#
# 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
#... | TonyApuzzo/fuzzyjoin | fuzzyjoin-hadoop/src/test/scripts/util/average.py | Python | apache-2.0 | 1,107 |
from django.contrib.auth.models import User
from django.db import models
| aehlke/manabi | manabi/apps/manabi_auth/models.py | Python | mit | 73 |
"""Support for Vera cover - curtains, rollershutters etc."""
import logging
from homeassistant.components.cover import CoverDevice, ENTITY_ID_FORMAT, \
ATTR_POSITION
from homeassistant.components.vera import (
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
DEPENDENCIES = ['vera']
_LOGGER = logging.getLogger(__na... | nugget/home-assistant | homeassistant/components/vera/cover.py | Python | apache-2.0 | 2,003 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 VT SuperDARN Lab
# Full license can be found in LICENSE.txt
"""Van Allen probe module
This module handles Van Allen probe (formerly RBSP) foorpoint
calculations and plotting
Class
-------------------------------------------------
rbspFp FPs reading (or calculating) and p... | MuhammadVT/davitpy | davitpy/gme/sat/rbsp.py | Python | gpl-3.0 | 17,605 |
class StartEnterpriseBackendException(Exception):
pass
| dimagi/commcare-hq | corehq/messaging/smsbackends/start_enterprise/exceptions.py | Python | bsd-3-clause | 61 |
import aiml
import os
kernel = aiml.Kernel()
aiml_dir = os.path.join("chatbot", "core", "aiml-dir")
brain = os.path.join(aiml_dir, 'bot_brain.brn')
if os.path.isfile(brain):
kernel.bootstrap(brainFile= brain)
else:
files = os.listdir(aiml_dir)
for file in files:
kernel.learn(aiml_dir + '/' + file)... | danieltoncu/chatbot | chatbot/core/aiml_parser.py | Python | gpl-3.0 | 445 |
# coding: UTF-8
from unittest import TestCase
from frame import line
from numpy import allclose
class LineTests(TestCase):
def test_stiffness_local(self):
# As a truss
L = 3.68
E = 0.201
A = 0.01635
k = E * A / L
a = line.stiffness_local(L, E, 0, A)
... | 1stop-st/jsonrpc-calculator | frame/tests/test_line.py | Python | mit | 2,741 |
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is auto generated by ... | roadmapper/ansible | lib/ansible/module_utils/network/nxos/argspec/acl_interfaces/acl_interfaces.py | Python | gpl-3.0 | 2,759 |
'''
Copyright (c) 2017 Yogesh Khatri
This file is part of mac_apt (macOS Artifact Parsing Tool).
Usage or distribution of this software/code is subject to the
terms of the MIT License.
notes.py
---------------
This plugin will read databases from the built-in 'Notes' application.
#TODO:
... | ydkhatri/mac_apt | plugins/notes.py | Python | mit | 23,822 |
start_time = 0.0
end_time = 1800.0
timestep = 0.1
resultsfile = 'riboflavin.csv'
reactions = '''
ribA, GTP > C01304
ribD1, C01304 > C01268
ribD2, C01268 > C04454
E1, C04454 > C04732
ribH, C04732 > C04332
ribE, C04332 > riboflavin
E2, riboflavin > FMN
'''
# <enzyme>, <degradation rate>, <k1>, <k2>, <k-1> where Km = ... | imwiththou/PathwayNet | fiboflavin_model.py | Python | mit | 694 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
# Credits#######################################... | 3dfxsoftware/cbss-addons | price_structure/model/sale.py | Python | gpl-2.0 | 10,026 |
# Twisted, the Framework of Your Internet
# Copyright (C) 2001 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in t... | fxia22/ASM_xf | PythonD/site_python/twisted/news/news.py | Python | gpl-2.0 | 3,057 |
"""
The collection of mixins to be used in core classes.
Would be interesting only if you are planning to hack into Xentica
core functionality.
"""
import inspect
import xentica.core.base
from xentica.core.exceptions import XenticaException
__all__ = ['BscaDetectorMixin', 'DimensionsMixin', ]
class BscaDetectorMi... | a5kin/hecate | xentica/core/mixins.py | Python | mit | 2,951 |
#!/usr/bin/env python
import csv
import click # pip install click -- assumes version 5.x
@click.command()
@click.option('--incsv', type=click.File(mode='rU', lazy=True), help='input csv (the larger of the csv files)')
@click.option('--subcsv', type=click.File(mode='rU', lazy=True), help='subquery csv (the smaller ... | curtisalexander/csvsubquery | csvsubquery.py | Python | mit | 1,220 |
from what_apps.utility.admin import autoregister
autoregister('accounting') | SlashRoot/WHAT | what_apps/accounting/admin.py | Python | mit | 77 |
import os
from itertools import chain
from typing import Iterable, TypeVar, Callable, Set
"""
Contains small utility and shortcut functions
"""
def resolve_file_relative_path(file_path: str, target_path: str) -> str:
"""
Allows you to resolve a file path relative to the current file
:param file_path: mos... | nextcloud/appstore | nextcloudappstore/core/facades.py | Python | agpl-3.0 | 2,846 |
#
# Copyright (c) 2016 SUSE Linux GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRAN... | openSUSE/rstxml2docbook | src/rstxml2db/__main__.py | Python | gpl-3.0 | 867 |
#!/usr/bin/env python2.7
"""A python script to manage minecraft servers
Designed for use with MineOS: http://minecraft.codeemo.com
"""
__author__ = "William Dizon"
__license__ = "GNU GPL v3.0"
__version__ = "0.6.0"
__email__ = "wdchromium@gmail.com"
if __name__=="__main__":
from mineos import mc
from argpa... | MiLk/mineos | mineos_console.py | Python | gpl-3.0 | 7,809 |
from django.test import TestCase
from ..views import CandidacyMixin
class TestOrganizationToArea(TestCase):
def test_get_area_from_post_id(self):
api = CandidacyMixin()
area = api.get_area_from_post_id('14399')
self.assertEqual(
area,
{'id': 'http://mapit.mysociety... | mhl/yournextmp-popit | candidates/tests/test_helpers.py | Python | agpl-3.0 | 963 |
'''
Created on Feb 9, 2014
@author: Jing
'''
from randShoter import CRandShoter
from dotsSceneControler import CDotsSceneControler
from src.vx import *
from targetCenteredShoter import *
from configuration import *
import camera as Camera
import shoter as Shoter
import sceneControler as SceneControler
import shutil... | jxc761/3DMotionDataset | 3DMotionDB/src/vx/generator.py | Python | gpl-3.0 | 5,277 |
from __future__ import print_function, division
from sympy.core import C, Add, Mul, Pow, S
from sympy.core.compatibility import default_sort_key, string_types
from sympy.core.mul import _keep_coeff
from sympy.printing.str import StrPrinter
from sympy.printing.precedence import precedence
from sympy.core.sympify import... | dqnykamp/sympy | sympy/printing/codeprinter.py | Python | bsd-3-clause | 19,245 |
# -*- coding: utf-8 -*-
# A WordPress compiler plugin for Nikola
#
# Copyright (C) 2014-2015 by Felix Fontein
# Copyright (C) by the WordPress contributors
#
# 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... | pluser/nikola_plugins | v7/wordpress_compiler/wordpress/wordpress.py | Python | mit | 11,780 |
from urllib.parse import urlparse
from django.core.management.base import BaseCommand
from django.template.defaultfilters import pluralize
from normandy.recipes.models import RecipeRevision
from normandy.studies.models import Extension
def get_filename_from_url(url):
return urlparse(url).path.split("/")[-1]
c... | mozilla/normandy | normandy/recipes/management/commands/update_addon_urls.py | Python | mpl-2.0 | 2,400 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetThread
# Retrieves an individual thread from a user's mailbox.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may n... | jordanemedlock/psychtruths | temboo/core/Library/Google/Gmailv2/Threads/GetThread.py | Python | apache-2.0 | 5,180 |
#!/usr/bin/env python3
from imp import reload
from re import findall
from collections import OrderedDict, deque
from os.path import dirname, join
from logging import getLogger, FileHandler, Formatter
from copy import deepcopy
import connect
from config import get_config
from plugin_handler import PluginHandler
from s... | bunburya/bunbot | bot.py | Python | mit | 9,021 |
from pylab import *
import simplejson
import re
import csv
import iptools
def ipToList(ip):
return ip.split(".")
info = []
with open("node_listener.json") as f:
jsonres = f.read()
jsonres = jsonres.replace("\\'", "'")
info = simplejson.loads(jsonres, strict=False)
ipDict = {}
ipCount = 0
for match in... | SinZ163/GetDotaGraphs | RegionGraph.py | Python | mit | 2,721 |
""" Content attribute values for the observation forms"""
# Locators for observation forms data-types
NEWS_FORM_DATA_TYPE = 'ews'
NEURO_FORM_DATA_TYPE = 'neurological'
BG_FORM_DATA_TYPE = 'blood_glucose'
WEIGHT_FORM_DATA_TYPE = 'weight'
PBP_FORM_DATA_TYPE = 'pbp'
HEIGHT_FORM_DATA_TYPE = 'height'
BLOOD_PRODUCT_FORM_DAT... | bjss/BJSS_liveobs_automation | liveobs_ui/selectors/mobile/constants.py | Python | gpl-3.0 | 388 |
from __future__ import print_function
from builtins import object
import re
import csv
import unicodecsv
from openelex.base.load import BaseLoader
from openelex.models import RawResult
from openelex.lib.text import ocd_type_id, slugify
from .datasource import Datasource
"""
Montana elections have pre-processed CSV co... | openelections/openelections-core | openelex/us/mt/load.py | Python | mit | 6,545 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CommentReport'
db.create_table('foundry_commentreport', (
('id', self.gf('django... | praekelt/jmbo-foundry | foundry/migrations/0040_auto__add_commentreport.py | Python | bsd-3-clause | 28,264 |
# coding:utf-8
"""
tcc3portal.tcc_core.sso
~~~~~~~~~~~~~~~~~~~~~~~~~
tcc3portal tcc_core sso module, used for single-sign-on login/logout/register
:copyright: (c) 2015 by Vito.
:license: GNU, see LICENSE for more details.
"""
import urllib.parse
import urllib.request
import json
from flask import ... | Vito2015/tcc3-portal | tcc3portal/tcc_core/sso.py | Python | gpl-2.0 | 6,314 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
##
## S E R I A L B O X
##
## This file is distributed under terms of BSD license.
## See LICENSE.txt for more information.
##
##===----------... | thfabian/serialbox2 | test/serialbox-python/sdb/sdbcore/test_sdbcoreC.py | Python | bsd-2-clause | 2,590 |
"""This module provides a function to convert a state space into a set of state
nodes and transition edges."""
from z3 import Z3Exception
from mythril.laser.smt import simplify
from mythril.laser.ethereum.svm import NodeFlags
import re
colors = [
{
"border": "#26996f",
"background": "#2f7e5b",
... | b-mueller/mythril | mythril/analysis/traceexplore.py | Python | mit | 4,569 |
# 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/.
from IPy import IP, IPSet
import os
POWERS_OF_2 = dict((2 ** n, n) for n in range(1, 32 + 1))
representers = []
def ... | djmitche/prettyip | prettyip.py | Python | mpl-2.0 | 3,985 |
# -*- coding: utf-8 -*-
""" *==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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... | zrax/moul-scripts | Python/GiraBugs.py | Python | gpl-3.0 | 11,583 |
# Copyright 2008 Peter Bulychev
# http://clonedigger.sourceforge.net
#
# This file is part of Clone Digger.
#
# Clone Digger 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 o... | h2oloopan/easymerge | EasyMerge/clonedigger/suffix_tree.py | Python | mit | 4,949 |
# -*- coding: utf-8 -*-
"""
Implementation of graph products
Introduction
==============
>>> gptest_file = pkg_resources.resource_filename(__name__,"lib/examples/topologies/gptest.graphml")
>>> G_out = graph_product("gptest_file")
Implementation
==============
Disable plotting of examples in doctests:
>>> plot = la... | sk2/ank_le | AutoNetkit/algorithms/graph_product.py | Python | bsd-3-clause | 18,022 |
#
# The weights for this model come from training in a neural network library called CognitoNet which is now retired.
#
# That training session used images from the Face Scrub data set:
# http: http://vintage.winklerbros.net/facescrub.html
# H.-W. Ng, S. Winkler.
# A data-driven approach to cleaning large fac... | jfrancis71/TensorFlowApps | CZFaceDetection.py | Python | mit | 9,947 |
from extractors.extract_website import ExtractWebsite
from datawakestreams.extractors.extractor_bolt import ExtractorBolt
class WebsiteBolt(ExtractorBolt):
name ='website_extractor'
def __init__(self):
ExtractorBolt.__init__(self)
self.extractor = ExtractWebsite()
| Sotera/Datawake-Legacy | memex-datawake-stream/src/datawakestreams/extractors/website_bolt.py | Python | apache-2.0 | 293 |
"""
RuntimeError plugin object used for tests.
.. moduleauthor:: Jaisen Mathai <jaisen@jmathai.com>
"""
from __future__ import print_function
from elodie.plugins.plugins import PluginBase
class RuntimeError(PluginBase):
__name__ = 'ThrowError'
"""A dummy class to execute plugin actions for tests."""
de... | jmathai/elodie | elodie/plugins/runtimeerror/runtimeerror.py | Python | apache-2.0 | 597 |
import unittest
import PyOpenCLInterface
class LaptopResponses:
listDevicesOnSystem = [0]
deviceProperties = {'CL_DEVICE_MAX_MEM_ALLOC_SIZE': 134217728,
'CL_DEVICE_MAX_COMPUTE_UNITS': 5,
'CL_DEVICE_AVAILABLE': 1,
'CL_DEVICE_LOCAL_MEM_SIZE': 32768,
'CL_DEVICE_NAME': 'BeaverCr... | apatriciu/OpenStackOpenCL | ServerSidePythonOpenCLInterface/tests/testOpenCLInterfaceDevices.py | Python | apache-2.0 | 2,715 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Ali Anari
#
# 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
#... | zhuango/python | tools/paperDownloader/pdfMetadataExtractor.py | Python | gpl-2.0 | 3,171 |
#!/usr/bin/env python3
#
# Reverse : Generate an indented asm code (pseudo-C) with colored syntax.
# Copyright (C) 2015 Joel
#
# 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... | firebitsbr/reverse | lib/graph.py | Python | gpl-3.0 | 11,843 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | lonerr/ansible | lib/ansible/module_utils/ec2.py | Python | gpl-3.0 | 7,219 |
from proto_classes.node_data_pb2 import NodeData
class Node(object):
NODE_DATA_FIELDS = ("language",
"language_version",
"hostname",
"uname",
"exec_path",)
def __init__(self, node_id):
self.node_id = node_... | abranches/backmonitor | backmonitor/node.py | Python | apache-2.0 | 1,146 |
import cProfile
import time
from pathlib import Path
from typing import List, Optional, Tuple
from extractors.archiveextractor import ArchiveExtractor
from extractors.archivelistextractor import ArchiveListExtractor
from extractors.extractedinfo import ExtractedInfo
from extractors.extractorbase import ExtractorBase
f... | GitExl/DoomIdgamesArchive | idgames-extract/src/extract.py | Python | bsd-2-clause | 4,536 |
# ############################################################################
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business i... | uclouvain/osis | base/management/commands/behave.py | Python | agpl-3.0 | 2,864 |
from django.contrib import admin
from apps.afiliados.models import Titular, Adherente, Parentesco
from lib.admin import EliminarListAdmin
class ParentescoAdmin(EliminarListAdmin, admin.ModelAdmin):
list_display = [
'descripcion',
'observacion',
'delete',
'edit'
]
list_f... | montenegroariel/sigos | apps/afiliados/admin.py | Python | gpl-3.0 | 1,236 |
# 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... | kobejean/tensorflow | tensorflow/compiler/tests/scan_ops_test.py | Python | apache-2.0 | 7,707 |
import math
import cupy
from cupyx.scipy import special
def _normalize(x, axis):
"""Normalize, preserving floating point precision of x."""
x_sum = x.sum(axis=axis, keepdims=True)
if x.dtype.kind == 'f':
x /= x_sum
else:
x = x / x_sum
return x
def entropy(pk, qk=None, base=None,... | cupy/cupy | cupyx/scipy/stats/_distributions.py | Python | mit | 1,950 |
# Copyright FuseSoC contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause
def test_generators():
import os
import tempfile
from fusesoc.config import Config
from fusesoc.coremanager import CoreManager
from fusesoc.edalizer import ... | lowRISC/fusesoc | tests/test_edalizer.py | Python | gpl-3.0 | 1,641 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PySphinxMultiversion(PythonPackage):
"""A Sphinx extension for building self-hosted versio... | LLNL/spack | var/spack/repos/builtin/packages/py-sphinx-multiversion/package.py | Python | lgpl-2.1 | 957 |
#!/usr/local/bin/python2.7
# -*- coding: utf-8 -*-
#
# run-mpileup-combined-varscan.py
#==============================================================================
import argparse
import sys
import os
from subprocess import Popen, PIPE
import datetime
#==========================================================... | qfma/ohnolog-dc | ase-estimation/run-mpileup-combined-varscan.py | Python | mit | 3,468 |
#!/usr/bin/env python
import sys,os
#TODO IMPORT UITLS
DEBUG=True
VERBOSE=True
def fail(msg):
print("[F] %s" % msg)
sys.exit(42)
def debug(msg):
if DEBUG:
print("[D] %s" % (msg))
def debug_pause(msg):
debug(msg)
input("<press enter to roll forward>")
def verbose(msg):
if VERBOSE:
... | borkenpipe/hacklab | qemu-helpers/lib/loggerSupport.py | Python | gpl-2.0 | 591 |
from django.test import LiveServerTestCase
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from blog.models import Post, Tag
from selenium import webdriver
import random
class BlogViewerTest(LiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox()
... | ericls/djanblog | blog/tests.py | Python | mit | 3,209 |
from twisted.internet import reactor
from twisted.internet.protocol import Protocol, Factory
import obfsproxy.common.log as logging
import obfsproxy.common.heartbeat as heartbeat
import obfsproxy.network.buffer as obfs_buf
import obfsproxy.transports.base as base
log = logging.get_obfslogger()
"""
Networking subsys... | masterkorp/obfsproxy | obfsproxy/network/network.py | Python | bsd-3-clause | 17,857 |
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class crm_phonecall(models.Model):
_inherit = 'crm.phonecall'
repair_id = fields.Many2one(comodel_name="mrp.repair", string="Repair", required=False, )
class mrp_repair(models.Model):
_inherit = 'mrp.repair'
phonecalls = fields.One2man... | gmathers/iii-addons | iii-phonecall/iii_phonecall.py | Python | agpl-3.0 | 417 |
# -*- 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-securitycenter | samples/generated_samples/securitycenter_v1p1beta1_generated_security_center_list_assets_sync.py | Python | apache-2.0 | 1,546 |
##################
# futures中的线程池方式并发
from concurrent import futures
from flags import save_flag, get_flag, show, main
MAX_WORKERS = 20
def download_one(cc):
img = get_flag(cc)
show(cc)
save_flag(img, cc.lower()+".gif")
return cc
def download_many(cc_list):
workers = min(MAX_WORKERS, len(cc_list... | stoneflyop1/fluent_py | ch17/flags_threadpool.py | Python | mit | 1,312 |
"""A collection of modules for building different kinds of tree from
HTML documents.
To create a treebuilder for a new type of tree, you need to do
implement several things:
1) A set of classes for various types of elements: Document, Doctype,
Comment, Element. These must implement the interface of
_base.treebuilders... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py | Python | mit | 3,405 |
import csv
from app import db
from app.models import *
# Drop all database tables.
db.drop_all()
# Create new database tables.
db.create_all()
field_names = ['legalfees', 'accountingfees', 'insurance', 'feesforsrvcmgmt',
'feesforsrvclobby', 'profndraising', 'feesforsrvcinvstmgmt', 'feesforsrvcothr',
'advrtpromo', 'o... | hack4impact/UAC | populate.py | Python | mit | 792 |
import DBCV
from sklearn import datasets
from sklearn.cluster import KMeans
from scipy.spatial.distance import euclidean
def generate_data(n_samples=300, noise=0.05):
noisy_moons = datasets.make_moons(n_samples=n_samples, noise=noise)
X = noisy_moons[0]
return X
def generate_labels(X):
kmeans = KM... | christopherjenness/DBCV | profiling/profiler.py | Python | mit | 553 |
from __future__ import absolute_import, division, print_function, unicode_literals
from . import BaseSignal
class Signal(BaseSignal):
""" Classifier signal detecting the UT1 categories: https://dsi.ut-capitole.fr/blacklists/index_en.php """
def get_value(self, document, url_metadata):
classes = {}
... | commonsearch/cosr-back | cosrlib/signals/ut1_blacklist.py | Python | apache-2.0 | 486 |
from django.db import models
from django.contrib.auth.models import User
class Email(models.Model):
class Meta:
managed = False #Requires Django 1.1
class Log(models.Model):
user = models.ForeignKey(User)
action = models.TextField(max_length=256)
timestamp = models.DateTimeField(auto_now_add=... | bondgeek/django-webfaction | models.py | Python | bsd-3-clause | 379 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
fr... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api_v3/models/invited_position_v30.py | Python | mit | 14,027 |
from unittest import TestCase
import os
import cv2
from bot.providers import trainer_matches as tm
from bot.shared import LOW_CORR
base = '..\\assets'
class TestTrainer(TestCase):
def test_get_matches(self):
location = os.path.join(base, "ok_box.png")
base_location = os.path.join(base, "nox", ... | will7200/Yugioh-bot | tests/test_trainer.py | Python | mit | 1,326 |
# Copyright (c) 2011 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 ... | openstack/nova | nova/compute/utils.py | Python | apache-2.0 | 63,683 |
import unittest
from igraph import Graph
class TestIgraph(unittest.TestCase):
def test_graph(self):
# Create a graph with 10 vertices & 2 children each.
g2 = Graph.Tree(n=10, children=2)
self.assertEqual(9, len(g2.get_edgelist()))
| Kaggle/docker-python | tests/test_igraph.py | Python | apache-2.0 | 272 |
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2005 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2005-2012 Julio Sanchez
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Genera... | sam-m888/gramps | gramps/plugins/rel/rel_es.py | Python | gpl-2.0 | 35,961 |
"""Make membership fees more flexible
Revision ID: 92ee63f41c5b
Revises: 6f1a37baa574
Create Date: 2018-11-01 14:57:25.498035
"""
from datetime import timedelta
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '92ee63f41c5b... | agdsn/pycroft | pycroft/model/alembic/versions/92ee63f41c5b_make_membership_fees_more_flexible.py | Python | apache-2.0 | 1,711 |
"""
simpleSetup2: runs POST the JS setup
NOTE: for 1.2 USERS (and their signatures) still done here. Next jsSetup will take this over and the User setup part
will be removed from here.
"""
import os
import sys
import logging
import time
sys.path = ['rasUtilities'] + sys.path
import OSEHRASetup
from OSEHRAHelper impo... | vistadataproject/nodeVISTA | setupDocker/pySetup/simpleSetup2.py | Python | agpl-3.0 | 5,139 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-07-12 13:53
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0021_merge_20190429_1531'),
]
operations = [
... | cmjatai/cmj | sapl/protocoloadm/migrations/0022_auto_20190712_1053.py | Python | gpl-3.0 | 910 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.