text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#
# Copyright (c) 2008--2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | dmacvicar/spacewalk | backend/server/rhnSQL/sql_types.py | Python | gpl-2.0 | 1,465 | 0 |
#!/usr/bin/python
#
# Copyright 2015 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 b... | falbassini/googleads-dfa-reporting-samples | python/v2.2/target_ad_to_remarketing_list.py | Python | apache-2.0 | 2,651 | 0.00679 |
"""
Redis Blueprint
===============
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.redis
settings:
redis:
# bind: 0.0.0.0 # Set the bind address specifically (Default: 127.0.0.1)
"""
import re
from fabric.decorators import task
from fabric.utils import abort
from ref... | 5monkeys/blues | blues/redis.py | Python | mit | 1,983 | 0.001513 |
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns(
'show.views',
url(r'^radioshow/entrylist/$', 'radioshow_entryitem_list', name='radioshow_entryitem_list'),
url(r'^showcontributor/list/(?P<slug>[\w-]+)/$', 'showcontributor_content_list', name='showcontributor_content_list'),
u... | praekelt/panya-show | show/urls.py | Python | bsd-3-clause | 804 | 0.007463 |
n, k, l, c, d, p, nl, np = map(int,raw_input().split())
a = k*l
x = a/nl
y = c*d
z = p/np
print min(x,y,z)/n
| Sarthak30/Codeforces | soft_drinking.py | Python | gpl-2.0 | 109 | 0.027523 |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... | Marcdnd/cryptoescudo | contrib/spendfrom/spendfrom.py | Python | mit | 10,054 | 0.005968 |
# Copyright 2015-2016 Mirantis, 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 la... | ozamiatin/oslo.messaging | oslo_messaging/_drivers/zmq_driver/client/publishers/dealer/zmq_dealer_publisher_direct.py | Python | apache-2.0 | 6,687 | 0.00015 |
"""Global test fixtures."""
import uuid
import pytest
from s3keyring.s3 import S3Keyring
from s3keyring.settings import config
from keyring.errors import PasswordDeleteError
@pytest.fixture
def keyring(scope="module"):
config.boto_config.activate_profile("test")
return S3Keyring()
@pytest.yield_fixture
d... | InnovativeTravel/s3-keyring | tests/conftest.py | Python | mit | 714 | 0 |
print(__doc__)
from time import time
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import metrics
from sklearn.cluster import KMeans
from sklearn.datasets import load_digits
from sklearn.decomposition import PCA
from sklearn.preprocessing import scale
from sklearn.preprocessing i... | georgetown-analytics/skidmarks | bin/cluster.py | Python | mit | 2,943 | 0.016989 |
"""This file contains code for use with "Think Stats" and
"Think Bayes", both by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
"""This file contains class definitions for:
H... | AllenDowney/MarriageNSFG | thinkstats2.py | Python | mit | 75,264 | 0.000864 |
# -*- coding: utf-8 -*-
# Copyright 2013 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 require... | GoogleCloudPlatform/gsutil | gslib/tests/test_notification.py | Python | apache-2.0 | 6,042 | 0.002648 |
import logging
import os
import datetime
import tba_config
import time
import json
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from consts.event_type import EventType
from consts.media_type imp... | bdaroz/the-blue-alliance | controllers/datafeed_controller.py | Python | mit | 31,351 | 0.002775 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016, 2017 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | CERNDocumentServer/cds-videos | cds/modules/records/bundles.py | Python | gpl-2.0 | 2,122 | 0 |
from __future__ import absolute_import, unicode_literals
from django.core.management.base import BaseCommand
from molo.core.models import LanguageRelation
from molo.core.models import Page
class Command(BaseCommand):
def handle(self, *args, **options):
for relation in LanguageRelation.objects.all():
... | praekelt/molo | molo/core/management/commands/add_language_to_pages.py | Python | bsd-2-clause | 702 | 0 |
'''
@author: Michael Wan
@since : 2014-11-08
'''
from math import log
import operator
def createDataSet():
dataSet = [[1, 1, 'yes'],
[1, 1, 'yes'],
[1, 0, 'no'],
[0, 1, 'no'],
[0, 1, 'no']]
labels = ['no surfacing','flippers']
#cha... | onehao/opensource | pyml/inaction/ch03/decisiontree/trees.py | Python | apache-2.0 | 4,087 | 0.015659 |
import random, inspect
from sched import scheduler
from time import time, sleep
from datetime import datetime
####################################################################################################
# Minimal implementation of the signaling library
class Signal(object):
def __init__(self, name):
... | dstcontrols/osisoftpy | examples/mini_signal_example.py | Python | apache-2.0 | 5,723 | 0.007863 |
import os
def get_terminal_columns():
terminal_rows, terminal_columns = os.popen('stty size', 'r').read().split()
return int(terminal_columns)
def get_terminal_rows():
terminal_rows, terminal_columns = os.popen('stty size', 'r').read().split()
return int(terminal_rows)
def get_header_l1(lines_li... | skomendera/PyMyTools | providers/terminal.py | Python | mit | 2,039 | 0.00049 |
"""Utilities for B2share deposit."""
from flask import request
from werkzeug.local import LocalProxy
from werkzeug.routing import PathConverter
def file_id_to_key(value):
"""Convert file UUID to value if in request context."""
from invenio_files_rest.models import ObjectVersion
_, record = request.view_... | emanueldima/b2share | b2share/modules/deposit/utils.py | Python | gpl-2.0 | 823 | 0 |
#-*-coding=utf-8-*-
class SupportEncodings(object):
"""
Given the support encoding of piconv
"""
supports = []
def __init__(self):
self.supports = ['ASCII','UTF-8','UTF-16','UTF-32',\
'BIG5','GBK','GB2312','GB18030','EUC-JP', 'SHIFT_JIS', 'ISO-2022-JP'\
'WINDOWS-1252']
def get_support_encodings(self):
... | coodoing/piconv | support_encodings.py | Python | apache-2.0 | 13,095 | 0.002596 |
# module includes
import elliptic
import heat
import IRT
print "Loading comatmor version 0.0.1"
| fameyer/comatmor | src/comatmor/__init__.py | Python | gpl-2.0 | 96 | 0 |
from layers.receivers.base_receiever import BaseReceiver
class ReceiptReceiver(BaseReceiver):
def onReceipt(self, receiptEntity):
ack = ReceiptReceiver.getAckEntity(receiptEntity)
self.toLower(ack)
| hyades/whatsapp-client | src/layers/receivers/receipt_receiver.py | Python | gpl-3.0 | 221 | 0 |
from rest_framework.serializers import ModelSerializer
from app.schedule.models.patient import Patient
from app.schedule.serializers.clinic import ClinicListSerializer
from app.schedule.serializers.dental_plan import DentalPlanSerializer
class PatientSerializer(ModelSerializer):
class Meta:
model = Patie... | agendaodonto/server | app/schedule/serializers/patient.py | Python | agpl-3.0 | 559 | 0.001789 |
# -- coding: utf-8 --
from flask import render_template, session, redirect, url_for, current_app, request
from .. import db
from ..models import Detail,Contents,Keywords,WXUrls
from . import main
from .forms import NameForm
import wechatsogou
import hashlib
from .errors import *
from ..API.reqweb import *
@main.route... | Rcoko/flaskLearn | app/main/views.py | Python | mit | 3,576 | 0.014646 |
import argparse
from collections import defaultdict, Counter, deque
import random
import json
import time
from tqdm import tqdm
import wikipedia
class MarkovModel(object):
def __init__(self):
self.states = defaultdict(lambda: Counter())
self.totals = Counter()
def add_sample(self, state, foll... | bschug/neverending-story | markov.py | Python | mit | 5,169 | 0.001161 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 OpenERP - Team de Localización Argentina.
# https://launchpad.net/~openerp-l10n-ar-localization
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | pronexo-odoo/odoo-argentina | l10n_ar_account_check_debit_note/invoice.py | Python | agpl-3.0 | 31,158 | 0.008634 |
from __future__ import absolute_import
import filecmp
import os
import sys
import llvmbuild.componentinfo as componentinfo
from llvmbuild.util import fatal, note
###
def cmake_quote_string(value):
"""
cmake_quote_string(value) -> str
Return a quoted form of the given value that is suitable for use in C... | endlessm/chromium-browser | third_party/swiftshader/third_party/llvm-7.0/llvm/utils/llvm-build/llvmbuild/main.py | Python | bsd-3-clause | 34,146 | 0.002577 |
import os
import logging
from superdesk import get_resource_service
from jinja2.loaders import FileSystemLoader, ModuleLoader, ChoiceLoader, DictLoader, PrefixLoader
from liveblog.mongo_util import decode as mongodecode
__all__ = ['ThemeTemplateLoader', 'CompiledThemeTemplateLoader']
logger = logging.getLogger('supe... | hlmnrmr/liveblog | server/liveblog/themes/template/loaders.py | Python | agpl-3.0 | 3,378 | 0.001184 |
# Copyright 2016 Nicolas Bessi, Camptocamp SA
# Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from lxml import etree
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class ResPartner(models.Model):
_inherit = "res.par... | OCA/partner-contact | base_location/models/res_partner.py | Python | agpl-3.0 | 5,851 | 0.001196 |
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.postgres.search import SearchVector, SearchQuery, SearchRank
from django.core.urlresolvers import reverse
from django.db import models
from github import UnknownObjectException
from social.apps.django_app.default.models imp... | ZeroCater/Eyrie | interface/models.py | Python | mit | 4,056 | 0.00074 |
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | deepmind/brave | brave/training/trainer.py | Python | apache-2.0 | 3,771 | 0.003447 |
__author__ = 'matjaz'
| anirudhvenkats/clowdflows | workflows/management/commands/__init__.py | Python | gpl-3.0 | 23 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-07 22:51
from __future__ import unicode_literals
import c3nav.mapdata.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateMod... | c3nav/c3nav | src/c3nav/site/migrations/0001_announcement.py | Python | apache-2.0 | 1,128 | 0.004433 |
# Copyright 2017, 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 ... | calpeyser/google-cloud-python | vision/google/cloud/vision_v1/types.py | Python | apache-2.0 | 1,284 | 0 |
#!/usr/local/bin/python
# -*-coding:utf8-*-
from scrapy.contrib.downloadermiddleware.useragent import UserAgentMiddleware
import random
class RotateUserAgentMiddleware(UserAgentMiddleware):
def __init__(self, user_agent=''):
self.user_agent = user_agent
def process_request(self, request, spider):
... | phodal-archive/scrapy-elasticsearch-demo | dianping/dianping/spiders/rotateAgent.py | Python | mit | 2,814 | 0.013859 |
from __future__ import absolute_import
from agms.configuration import Configuration
from agms.agms import Agms
from agms.transaction import Transaction
from agms.safe import SAFE
from agms.report import Report
from agms.recurring import Recurring
from agms.hpp import HPP
from agms.version import Version
| agmscode/agms_python | agms/__init__.py | Python | mit | 305 | 0 |
#!/usr/bin/env python
# coding=utf-8
"""303. Multiples with small digits
https://projecteuler.net/problem=303
For a positive integer n, define f(n) as the least positive multiple of n
that, written in base 10, uses only digits ≤ 2.
Thus f(2)=2, f(3)=12, f(7)=21, f(42)=210, f(89)=1121222.
Also, $\sum \limits_{n = 1}... | openqt/algorithms | projecteuler/pe303-multiples-with-small-digits.py | Python | gpl-3.0 | 418 | 0.014423 |
import json
import os.path
from ems.app import Bootstrapper, absolute_path
from ems.inspection.util import classes
from ems.validation.abstract import Validator, MessageProvider
from ems.validation.registry import Registry
from ems.validation.rule_validator import RuleValidator, SimpleMessageProvider
from ems.validat... | mtils/ems | ems/support/bootstrappers/validation.py | Python | mit | 1,933 | 0.002587 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This ... | valeriocos/perceval | perceval/backends/core/twitter.py | Python | gpl-3.0 | 14,309 | 0.002238 |
import os
import pydoc
import sys
class DocTree:
def __init__(self, src, dest):
self.basepath = os.getcwd()
sys.path.append(os.path.join(self.basepath, src))
self.src = src
self.dest = dest
self._make_dest(dest)
self._make_docs(src)
self._move_docs(dest)
... | Artemkaaas/indy-sdk | vcx/wrappers/python3/generate_docs.py | Python | apache-2.0 | 952 | 0.003151 |
# Copyright 2012, Nachi Ueno, NTT MCL, 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
#
# Unles... | igor-toga/local-snat | neutron/tests/unit/agent/linux/test_iptables_firewall.py | Python | apache-2.0 | 86,232 | 0.000116 |
def add_without_op(x, y):
while y !=0:
carry = x & y
x = x ^ y
y = carry << 1
print(x)
def main():
x, y = map(int, input().split())
add_without_op(x, y)
if __name__ == "__main__":
main() | libchaos/algorithm-python | bit/add_with_op.py | Python | mit | 233 | 0.017167 |
#!/usr/bin/env python
from __future__ import print_function
import os, platform
from argparse import ArgumentParser
import numpy as np
import time
import resource
from mayavi import mlab
from netCDF4 import Dataset
from mpl_toolkits.basemap import Basemap
from numba import jit
@jit
def add_triangles_from_square(x, ... | NEMO-NOC/NEMOsphere | lego5.py | Python | gpl-2.0 | 14,256 | 0.012556 |
# stdlib
import re
import traceback
from contextlib import closing, contextmanager
from collections import defaultdict
# 3p
import pymysql
try:
import psutil
PSUTIL_AVAILABLE = True
except ImportError:
PSUTIL_AVAILABLE = False
# project
from config import _is_affirmative
from checks import AgentCheck
GAU... | lookout/dd-agent | checks.d/mysql.py | Python | bsd-3-clause | 62,670 | 0.002266 |
############################################
# [config.py]
# CONFIGURATION SETTINGS FOR A PARTICULAR METER
#
#
# Set the long-form name of this meter
name = "*PEAK only"
#
# [Do not remove or uncomment the following line]
Cs={}
############################################
############################################
#... | quadrismegistus/prosodic | meters/strength_and_resolution.py | Python | gpl-3.0 | 10,457 | 0.005929 |
# -*- coding: utf-8 -*-
"""
feedjack
Gustavo Picón
fjlib.py
"""
from django.conf import settings
from django.db import connection
from django.core.paginator import Paginator, InvalidPage
from django.http import Http404
from django.utils.encoding import smart_unicode
from oi.feedjack import models
from oi.feedjack im... | MehmetNuri/ozgurlukicin | feedjack/fjlib.py | Python | gpl-3.0 | 9,326 | 0.006005 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "street_agitation_bot.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ens... | Kurpilyansky/street-agitation-telegram-bot | manage.py | Python | gpl-3.0 | 818 | 0.001222 |
# 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 applicable ... | ml6973/Course | tf-hands-on/slim/python/slim/nets/alexnet_test.py | Python | apache-2.0 | 5,839 | 0.008392 |
import numpy as np
import nengo
import ctn_benchmark
# define the inputs when doing number comparison task
class NumberExperiment:
def __init__(self, p):
self.p = p
self.pairs = []
self.order = []
rng = np.random.RandomState(seed=p.seed)
for i in range(1, 10):
fo... | tcstewar/finger_gnosis | pointer.py | Python | gpl-2.0 | 16,229 | 0.00875 |
from PySide2 import QtGui, QtCore, QtWidgets
from design import SidUi, DdUi
from ServersData import ServersDownloadThread, servers
import sys
class SpeedInputDialog(QtWidgets.QDialog, SidUi):
def __init__(self):
QtWidgets.QDialog.__init__(self)
self.setupUi()
def get_data(self)... | ZeX2/TWTools | CustomDialogs.py | Python | gpl-3.0 | 3,155 | 0.005071 |
from rpg.plugin import Plugin
from rpg.command import Command
from rpg.utils import path_to_str
from re import compile
from subprocess import CalledProcessError
import logging
class CPlugin(Plugin):
EXT_CPP = [r"cc", r"cxx", r"cpp", r"c\+\+", r"ii", r"ixx",
r"ipp", r"i\+\+", r"hh", r"hxx", r"hpp",... | jsilhan/rpg | rpg/plugins/lang/c.py | Python | gpl-2.0 | 2,122 | 0 |
# -*- coding: utf-8 -*-
from .env import *
from amoco.cas.expressions import regtype
from amoco.arch.core import Formatter, Token
def mnemo(i):
mn = i.mnemonic.lower()
return [(Token.Mnemonic, "{: <12}".format(mn))]
def deref(opd):
return "[%s+%d]" % (opd.a.base, opd.a.disp)
def opers(i):
s = []
... | LRGH/amoco | amoco/arch/eBPF/formats.py | Python | gpl-2.0 | 1,781 | 0 |
# from http://diydrones.com/forum/topics/mission-planner-python-script?commentId=705844%3AComment%3A2035437&xg_source=msg_com_forum
import socket
import sys
import math
from math import sqrt
import clr
import time
import re, string
clr.AddReference("MissionPlanner.Utilities")
import MissionPlanner #import *
clr.AddRe... | ryokochang/Slab-GCS | bin/Release/Scripts/example6.py | Python | gpl-3.0 | 3,744 | 0.029129 |
from oscar.test.testcases import WebTestCase
from oscar.test.factories import create_product, UserFactory
from oscar.core.compat import get_user_model
from oscar.apps.catalogue.reviews.signals import review_added
from oscar.test.contextmanagers import mock_signal_receiver
class TestACustomer(WebTestCase):
def se... | itbabu/django-oscar | tests/functional/catalogue/review_tests.py | Python | bsd-3-clause | 2,113 | 0 |
#!/usr/bin/python
import cv2
import numpy as np
import sys, getopt
import matplotlib
matplotlib.use('Agg') # Force matplotlib to not use any Xwindows backend.
from matplotlib import pyplot as plt
image_path = None
def printHelp():
print 'main.py\n' \
' -i <Image Path. Ex: /home/myImage.jpg > (Mandatory)\n' \... | gustavovaliati/ci724-ppginfufpr-2016 | exerc-3a/main.py | Python | gpl-3.0 | 930 | 0.022581 |
#!/usr/bin/env python
# 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... | vuntz/glance | glance/cmd/cache_manage.py | Python | apache-2.0 | 16,590 | 0.000241 |
# -*- coding: utf-8 -*-
#
# mete0r.gpl : Manage GPL'ed source code files
# Copyright (C) 2015 mete0r <mete0r@sarangbang.or.kr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, ... | mete0r/gpl | mete0r_gpl/__init__.py | Python | agpl-3.0 | 810 | 0 |
# encoding: UTF-8
import talib as ta
import numpy as np
from ctaBase import *
from ctaTemplate import CtaTemplate
import time
########################################################################
class TickBreaker(CtaTemplate):
"""跳空追击策略(MC版本转化)"""
className = 'TickBreaker'
author = u'融拓科技'
# 策略... | freeitaly/Trading-System | vn.trader/ctaAlgo/strategyTickBreaker.py | Python | mit | 8,133 | 0.00262 |
"""sandbox URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | nshafer/django-hashid-field | sandbox/sandbox/urls.py | Python | mit | 1,076 | 0 |
from datetime import timedelta
from django.db.models import Sum
from django.utils.duration import duration_string
from rest_framework_json_api.serializers import (
CharField,
ModelSerializer,
SerializerMethodField,
)
from timed.projects.models import Project
from timed.tracking.models import Report
from ... | adfinis-sygroup/timed-backend | timed/subscription/serializers.py | Python | agpl-3.0 | 2,642 | 0.000379 |
# Copyright 2013 IBM Corp.
# Copyright (c) 2013 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... | tlakshman26/cinder-https-changes | cinder/tests/unit/test_ibm_xiv_ds8k.py | Python | apache-2.0 | 30,480 | 0 |
"""
Pseudo code
Breadth-First-Search(Graph, root):
create empty set S
create empty queue Q
root.parent = NIL
Q.enqueue(root)
while Q is not empty:
current = Q.dequeue()
if current is the goal:
return current
for each node n that is adjacent to current:
... | codervikash/algorithms | Python/Graphs/breath_first_traversal.py | Python | mit | 2,188 | 0.002285 |
from util.arguments import Arguments
from discord.ext import commands
from shlex import split
import random
class Choices:
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['choose'], description='Randomly picks a 1 of the given choices.')
async def choices(self, *, msg):
... | duke605/RunePy | commands/choices.py | Python | mit | 957 | 0.003135 |
import logging
import socket
from . import arcade
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
class Switch:
remote_ip = None
remote_port = 9999
state = None
commands = {'info': '{"system":{"get_sysinfo":{}}}',
'on': u'{"system... | droberin/blackhouse | blackhouse/__init__.py | Python | mit | 2,518 | 0.000397 |
import ctypes
class _DpxGenericHeaderBigEndian(ctypes.BigEndianStructure):
_fields_ = [
('Magic', ctypes.c_char * 4),
('ImageOffset', ctypes.c_uint32),
('Version', ctypes.c_char * 8),
('FileSize', ctypes.c_uint32),
('DittoKey', ctypes.c_uint32),
('GenericSize', ctyp... | plinecom/pydpx_meta | pydpx_meta/low_header_big_endian.py | Python | mit | 4,246 | 0 |
import random
from gatesym import core, gates, test_utils
from gatesym.blocks import latches
def test_gated_d_latch():
network = core.Network()
clock = gates.Switch(network)
data = gates.Switch(network)
latch = latches.gated_d_latch(data, clock)
network.drain()
assert not latch.read()
da... | tolomea/gatesym | gatesym/tests/blocks/test_latches.py | Python | mit | 2,835 | 0 |
# Copyright 2019 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 agreed to in writing, ... | google/vulncode-db | data/forms/__init__.py | Python | apache-2.0 | 4,727 | 0.001269 |
import socket,sys,os,hashlib,codecs,time # Import socket module
#filecodec = 'cp037'
filecodec = None
buffersize = 1024
failed = False
def filehash(filepath):
openedFile = codecs.open(filepath,'rb',filecodec)
# readFile = openedFile.read().encode()
readFile = openedFile.read()
openedFile.cl... | TNT-Samuel/Coding-Projects | File Sending/V1.0/output/receivefile.py | Python | gpl-3.0 | 5,213 | 0.005179 |
# -*- coding: utf-8 -*-
import operator
import os
import re
import subprocess
import time
import urllib
from xml.dom.minidom import parseString as parse_xml
from module.network.CookieJar import CookieJar
from module.network.HTTPRequest import HTTPRequest
from ..internal.Hoster import Hoster
from ..internal.misc impo... | Arno-Nymous/pyload | module/plugins/hoster/YoutubeCom.py | Python | gpl-3.0 | 42,175 | 0.004268 |
import math
# According to Law of cosines, p^2 + p*r + r^2 = c^2.
# Let c = r+k, => r = (p^2-k^2)/(2*k-p) and p > k > p/2 (k is even).
# Suppose p <= q <= r.
max_sum = 120000
d = {} # p => set(r)
for p in range(1, max_sum/2+1):
if p%10000 == 0:
print p
d[p] = set()
mink = int(p/2)+1
maxk = int... | renxiaoyi/project_euler | problem_143.py | Python | unlicense | 739 | 0.002706 |
# -*- coding: utf-8 -*-
#
# http://www.privacyidea.org
# (c) cornelius kölbel, privacyidea.org
#
# 2014-12-08 Cornelius Kölbel, <cornelius@privacyidea.org>
# Complete rewrite during flask migration
# Try to provide REST API
#
# privacyIDEA is a fork of LinOTP. Some code is adapted from
# the syste... | woddx/privacyidea | privacyidea/api/realm.py | Python | agpl-3.0 | 10,603 | 0.000283 |
"""Tests for distutils.command.build_py."""
import os
import sys
import StringIO
import unittest
from distutils.command.build_py import build_py
from distutils.core import Distribution
from distutils.errors import DistutilsFileError
from distutils.tests import support
class BuildPyTestCase(support.Te... | babyliynfg/cross | tools/project-creator/Python2.6.6/Lib/distutils/tests/test_build_py.py | Python | mit | 3,817 | 0.000786 |
# -------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Stefan
#
# Created: 11.07.2017
# Copyright: (c) Stefan 2017
# Licence: <your licence>
# ------------------------------------------------------------------------... | stcioc/localdocindex | python/scrape_ps3.py | Python | mit | 7,074 | 0.003675 |
###############################################################################
# Name: ed_statbar.py #
# Purpose: Custom statusbar with builtin progress indicator #
# Author: Cody Precord <cprecord@editra.org> #
... | garrettcap/Bulletproof-Backup | wx/tools/Editra/src/ed_statbar.py | Python | gpl-2.0 | 12,020 | 0.001165 |
from datetime import datetime, date
import pytest
from pytz import UTC
from uber.config import c
from uber.models import Attendee, Session
from uber.site_sections import summary
@pytest.fixture
def birthdays():
dates = [
date(1964, 12, 30),
date(1964, 12, 31),
date(1964, 1, 1),
d... | magfest/ubersystem | tests/uber/site_sections/test_summary.py | Python | agpl-3.0 | 3,732 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('structure', '0039_remove_permission_groups'),
]
operations = [
migrations.AlterField(
model_name='customerpermis... | opennode/nodeconductor | waldur_core/structure/migrations/0040_make_is_active_nullable.py | Python | mit | 634 | 0 |
import glob
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
import scipy.signal
import shutil
import display_pyutils
def apply_averaging_filter(x, filter_size=5):
return np.convolve(x, np.ones(filter_size,) / float(filter_size), mode='valid')
def apply_median_filter(x, filter_size=5):... | alliedel/anomalyframework_python | anomalyframework/results.py | Python | mit | 2,930 | 0.024232 |
# Copyright 2013 IBM Corp.
# 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 app... | afaheem88/tempest_neutron | tempest/services/image/v1/json/image_client.py | Python | apache-2.0 | 11,416 | 0 |
"""
Functional Data Analysis Routines
"""
from __future__ import division
import numpy as np
def _curve_area(A, B):
r1 = np.mean(A-B)
r2 = np.mean(B-A)
if r1 > r2:
return r1
else:
return r2
def curve_test(Y, cnd_1, cnd_2, n_perm=1000):
"""
Assess whether two curves are stati... | akhambhati/Echobase | Echobase/Statistics/FDA/fda.py | Python | gpl-3.0 | 1,634 | 0 |
""" pyvalence
"""
__version__ = '0.0.1.3'
| blakeboswell/valence | pyvalence/__init__.py | Python | bsd-3-clause | 44 | 0 |
#!/usr/bin/python
def conversionMap():
""" returns conversionmap """
return {
'a': [1, -2, -1],
'b': [1, 2, 1],
'c': [1, 2, -1],
'd': [1, -2, 1],
'e': [-1, 1, 1],
'f': [1, -2, 2],
'g': [-2, 1, 2],
'h': [-2, -1, 2],
'i': [-1, -1, 1],
'j': [2, 1, 2],
'k': [2, -1, 2],
'... | theysconator/Scribbler | scribbler.py | Python | lgpl-3.0 | 2,173 | 0.02485 |
from tgbot import plugintest
from plugin_examples.guess import GuessPlugin
class GuessPluginTest(plugintest.PluginTestCase):
def setUp(self):
self.plugin = GuessPlugin()
self.bot = self.fake_bot('', plugins=[self.plugin])
def test_play(self):
self.receive_message('/guess_start')
... | fopina/tgbotplug | tests/examples/test_guess.py | Python | mit | 1,935 | 0.00155 |
"""
Compatibility module.
This module contains duplicated code from Python itself or 3rd party
extensions, which may be included for the following reasons:
* compatibility
* we may only need a small subset of the copied library/module
"""
import _inspect
import py3k
from _inspect import getargspec, f... | beiko-lab/gengis | bin/Lib/site-packages/numpy/compat/__init__.py | Python | gpl-3.0 | 434 | 0 |
# -*- coding: utf-8 -*-
import hook
import bnetprotocol
from misc import *
from config import config
#settings = config[__name__.split('.')[-1]]
def message_received(bn, d):
if d.event == bnetprotocol.EID_TALK:
msg_list = str(d.message).split(' ', 1)
try:
command, payload = msg_list
except ValueError:
... | w3gh/ghost.py | plugins/join.py | Python | mit | 716 | 0.023743 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from preggy import expect
from tornado.testing import gen_test
from... | gi11es/thumbor | tests/filters/test_max_age.py | Python | mit | 2,711 | 0.001107 |
# -*- coding: utf-8 -*-
#
# Copyright 2014-2021 BigML
#
# 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 ... | jaor/python | bigml/predicates.py | Python | apache-2.0 | 2,025 | 0.000494 |
from functools import reduce
from operator import or_
from django.db.models import Q
from django.conf import settings
from django.contrib.auth.models import User
from django.http import JsonResponse
from cities_light.models import City, Country, Region
from dal import autocomplete
from pytz import country_timezones
... | akatsoulas/mozillians | mozillians/users/views.py | Python | bsd-3-clause | 9,979 | 0.001203 |
# Daniel Fernandez Rodriguez <danielfr@cern.ch>
from argparse import ArgumentParser
from collections import defaultdict
from requests_kerberos import HTTPKerberosAuth
import json
import requests
import subprocess
import logging
import sys
class PuppetDBNodes(object):
def __init__(self, args):
for k, v ... | ak0ska/rundeck-puppetdb-nodes | rundeck-puppetdb-nodes-plugin/contents/rundeck_puppetdb_nodes.py | Python | apache-2.0 | 5,881 | 0.006802 |
from django.contrib import admin
from core.models import Language
# Register your models here.
class LanguageAdmin(admin.ModelAdmin):
model = Language
fieldsets = [
('', {'fields': ['name', 'locale']})
]
list_display = ['name', 'locale']
search_fields = ['name', 'locale']
ordering = ('name',)
admin.site.regis... | ekaradon/demihi | core/admin.py | Python | mit | 348 | 0.028736 |
from csacompendium.research.models import ExperimentUnit
from csacompendium.utils.pagination import APILimitOffsetPagination
from csacompendium.utils.permissions import IsOwnerOrReadOnly
from csacompendium.utils.viewsutils import DetailViewUpdateDelete, CreateAPIViewHook
from rest_framework.filters import DjangoFilter... | nkoech/csacompendium | csacompendium/research/api/experimentunit/experimentunitviews.py | Python | mit | 2,054 | 0.003408 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "game_server.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| cypreess/PyrateDice | game_server/game_server/manage.py | Python | mit | 254 | 0 |
#! /usr/bin/env python
from PyFoam.Applications.ChangePython import changePython
changePython("pvpython","PVSnapshot",options=["--mesa"])
| Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | bin/pyFoamPVSnapshotMesa.py | Python | gpl-2.0 | 140 | 0.014286 |
# 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... | punalpatel/st2 | st2common/tests/unit/test_db_rule_enforcement.py | Python | apache-2.0 | 2,863 | 0 |
#!/usr/bin/python
# -*- Coding:utf-8 -*-
#
# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
#
# 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.1 of the License, ... | jsafrane/openlmi-storage | test/test_create_lv.py | Python | lgpl-2.1 | 12,008 | 0.002498 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# Convolve MTSS rotamers with MD trajectory.
# Copyright (c) 2011-2017 Philip Fowler and AUTHORS
# Published under the GNU Public Licence, version 2 (or higher)
#
# Includ... | MDAnalysis/RotamerConvolveMD | rotcon/library.py | Python | gpl-2.0 | 5,002 | 0.003798 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of cpe package.
This module of is an implementation of name matching
algorithm in accordance with version 2.2 of CPE (Common Platform
Enumeration) specification.
Copyright (C) 2013 Alejandro Galindo García, Roberto Abdelkader Martínez Pérez
This ... | nilp0inter/cpe | cpe/cpeset2_2.py | Python | lgpl-3.0 | 3,512 | 0.000571 |
## begin license ##
#
# "Meresco Components" are components to build searchengines, repositories
# and archives, based on "Meresco Core".
#
# Copyright (C) 2007-2009 SURF Foundation. http://www.surf.nl
# Copyright (C) 2007 SURFnet. http://www.surfnet.nl
# Copyright (C) 2007-2010 Seek You Too (CQ2) http://www.cq2.nl
# C... | seecr/meresco-components | meresco/components/http/pathrename.py | Python | gpl-2.0 | 1,768 | 0.003394 |
#coding=utf8
import thread, time, sys, os, platform
try:
import termios, tty
termios.tcgetattr, termios.tcsetattr
import threading
OS = 'Linux'
except (ImportError, AttributeError):
try:
import msvcrt
OS = 'Windows'
except ImportError:
raise Exception('Mac i... | littlecodersh/EasierLife | Plugins/ChatLikeCMD/ChatLikeCMD.py | Python | mit | 7,974 | 0.007399 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Daniel Reis, 2013
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, eith... | raycarnes/project | project_issue_baseuser/__openerp__.py | Python | agpl-3.0 | 1,661 | 0 |
from argparse import ArgumentParser
from typing import Any
from zerver.lib.actions import create_stream_if_needed
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):
help = """Create a stream, and subscribe all active users (excluding bots).
This should be used for TESTING only, u... | tommyip/zulip | zerver/management/commands/create_stream.py | Python | apache-2.0 | 919 | 0.002176 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/poi/shared_lok_nymshenchman_medium.iff"
result.attribute_template_i... | anhstudios/swganh | data/scripts/templates/object/building/poi/shared_lok_nymshenchman_medium.py | Python | mit | 454 | 0.046256 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.