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 |
|---|---|---|---|---|---|
import collections
from django.contrib.contenttypes.models import ContentType
from .models import Stars, AggregateStars
from constants import MIN_RATING, MAX_RATING
def get_avg_rating(ctype_id, object_id):
"""Get average rating for an object
"""
aggregate_stars = AggregateStars.objects.filter(
... | djangothon/django-stars | stars/utils.py | Python | mit | 4,129 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | phrocker/accumulo | test/system/auto/simple/tablets.py | Python | apache-2.0 | 1,884 |
#!/usr/bin/env python3
import io
import contextlib
import os
import sys
import glob
import multiprocessing
import configparser
import itertools
import pytest
def run_tests(src, test, fail):
stderr = io.StringIO()
stdout = io.StringIO()
with contextlib.redirect_stderr(stderr):
with contextlib.redi... | vhaupert/mitmproxy | test/individual_coverage.py | Python | mit | 2,653 |
"""
remember.py: written by Scaevolus 2010
"""
import re
import string
import unittest
from util import hook
def db_init(db):
db.execute("create table if not exists memory(chan, word, data, nick,"
" primary key(chan, word))")
db.commit()
def get_memory(db, chan, word):
row = db.execute(... | olslash/skybot | plugins/remember.py | Python | unlicense | 9,869 |
#
# Copyright (c) 2014 Tom Carroll
#
# 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, publish, dis... | haxsaw/actuator | src/actuator/provisioners/example_resources.py | Python | mit | 2,612 |
import allensdk.core.json_utilities as json_utilities
from allensdk.model.glif.glif_neuron import GlifNeuron
# initialize the neuron
neuron_config = json_utilities.read('472423251_neuron_config.json')
neuron = GlifNeuron.from_dict(neuron_config)
# make a short square pulse. stimulus units should be in Amps.
stimulus ... | wvangeit/AllenSDK | doc_template/examples/glif_ex2.py | Python | gpl-3.0 | 619 |
#!/usr/bin/env python
from setuptools import setup
import sys
if sys.version_info < (3,):
install_requires = ['importlib']
extras_require = {
'test': ['mock']
}
else:
install_requires = []
extras_require = {}
setup(
name="varlet",
version='0.0.5',
author='Matt Johnson',
aut... | mdj2/varlet | setup.py | Python | mit | 604 |
# Copyright (C) 2014-2016 The BET Development Team
r"""
This module provides methods for calulating error estimates of
the probability measure for calculate probability measures. See
`Butler et al. 2015. <http://arxiv.org/pdf/1407.3851>`.
* :meth:`~bet.calculateErrors.cell_connectivity_exact` calculates
the co... | eecsu/BET | bet/calculateP/calculateError.py | Python | gpl-3.0 | 26,381 |
# -*- coding: utf-8 -*-
"""
"""
from __future__ import unicode_literals
import logging
import os
import hashlib
logger = logging.getLogger(__name__)
_log = "pelican_comment_system: avatars: "
try:
from . identicon import identicon
_identiconImported = True
except ImportError as e:
logger.warning(_log + "identi... | znegva/pelican-plugins | pelican_comment_system/avatars.py | Python | agpl-3.0 | 2,305 |
#
# Copyright 2001 - 2016 Ludek Smid [http://www.ospace.net/]
#
# This file is part of Pygame.UI.
#
# Pygame.UI is free software; you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or... | ospaceteam/outerspace | client/pygameui/Exception.py | Python | gpl-2.0 | 877 |
import socket
def get_host_by_addr(addr):
try:
host_name = socket.gethostbyaddr(addr)
except socket.herror:
return "Unable to find host name. Maybe ip is wrong"
return host_name
def get_host_by_name(name):
try:
addr = socket.gethostbyname(name)
except socket.herror... | thinkbeforecode/Algorithms | Network/GetHost/gethost.py | Python | mit | 412 |
# -*- coding: utf-8 -*-
###############################################################################
#
# account_statement_paypal_import for Odoo
# Copyright (C) 2012 Akretion Benoît GUILLOT <benoit.guillot@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the ... | houssine78/addons | account_statement_paypal_import/models/statement.py | Python | agpl-3.0 | 5,065 |
#!/usr/bin/env python
import time,linecache,sys,re,os
def times2r(t):
os.environ['TZ'] = 'US/Eastern'
time.tzset()
if t.isdigit():
return int(t)
else:
return int(time.mktime(time.strptime(t,"%Y-%m-%d %H:%M:%S")))
def timer2s(t):
os.environ['TZ'] = 'US/Eastern'
time.tzset()
return... | asymmetry/beampackage | beampackage/epicst2v.py | Python | gpl-3.0 | 3,197 |
# coding: utf-8
# comment
from __future__ import division
# None
print None
# integer
print (1 + 2) * 3
print 1 / 2
print 3 / 2
print 10 ** 200
# float
print 1.
print 1e10
print 0.1 * 8
print 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1
import math
print math.sin(math.pi)
# sequences
# tu... | ceumicrodata/adatmesterseg | code/class3.py | Python | cc0-1.0 | 2,203 |
import pytest
from website.deployment import cloud
from website.deployment import exceptions
from website.deployment.stubs import CloudStubConnection
from website.deployment.test import CloudStubConnectionFactory
class TestConnect:
def test_cloud_connection(self):
factory = CloudStubConnectionFactory()
... | arugifa/website | tests/deployment/test_deployment_cloud.py | Python | gpl-3.0 | 671 |
from mangopaysdk.entities.entitybase import EntityBase
class Client (EntityBase):
"""Client entity."""
def __init__(self, id = None):
# Client identifier
self.ClientId = None
# Name of client
self.Name = None
# Email of client
self.Email = None
# Pa... | gracaninja/mangopay2-python-sdk | mangopaysdk/entities/client.py | Python | mit | 410 |
s = input()
i = 0
cnt = 0
ans = 0
while i < len(s):
if s[i:i+2] == '25':
cnt += 1
i += 1
elif cnt > 0:
ans += (cnt * (cnt+1) // 2)
cnt = 0
i += 1
ans += (cnt * (cnt+1) // 2)
print(ans)
| knuu/competitive-programming | atcoder/corp/dwango_b.py | Python | mit | 237 |
from FireGirlOptimizer import *
import random
random.seed(0)
#create pathways
pathways = []
for l in range(100):
pathways.append(FireGirlPathway(l))
#create ignitions
for ls in pathways:
for i in range(15):
ign = FireGirlIgnitionRecord()
f1 = random.randint(-100,100)
f2 = random.rand... | OregonStateUniversityFireTeam/gravity | ts_synthetic_pathway_3.py | Python | mpl-2.0 | 3,756 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | cmouse/buildbot | master/buildbot/test/unit/util/test_misc.py | Python | gpl-2.0 | 4,070 |
#*- coding: utf-8 -*-
"""
FileBot class
Released under the MIT license
Copyright (c) 2012, Jason Millward
@category misc
@version $Id: 1.7.0, 2016-08-22 14:53:29 ACST $;
@author Jason Millward
@license http://opensource.org/licenses/MIT
"""
import re
import subprocess
import logger
class FileBot(objec... | carrigan98/Autorippr | classes/filebot.py | Python | mit | 3,655 |
{ "eix":
{
'(_app-admin_sudo-1.7.0_, _Gentoo_)':dict(
setProductKey=('app-admin/sudo-1.7.0', 'Gentoo'),
setDescription="Allows users or groups to run commands as other users",
setInstallDate="2009/03/30",
),
}
}
| zenoss/ZenPacks.community.Gentoo | ZenPacks/community/Gentoo/tests/plugindata/linux/server1/eix.py | Python | gpl-2.0 | 248 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | qrohlf/cf-client | lib/cfclient/ui/main.py | Python | gpl-2.0 | 25,439 |
#!/usr/bin/env python
import numpy as np
def sigmoid(x):
# Implement sigmoid function
return 1 / (1 + np.exp(-x))
inputs = np.array([0.7, -0.3])
weights = np.array([0.1, 0.8])
bias = -0.1
# Calculate the output
output = sigmoid(np.dot(inputs, weights) + bias)
print('Output:')
print(output)
| mmaraya/nd101 | ch02/lesson04/simple.py | Python | mit | 306 |
import sys
import os
import time
import sphinx_rtd_theme
html_logo = "images/zammad_logo_70x61.png"
html_favicon = "images/favicon.ico"
project = u'Zammad'
copyright = u'%s, Zammad' % time.strftime("%Y")
author = u'Zammad'
source_suffix = '.rst'
master_doc = 'index'
exclude_patterns = ['_build', 'html', 'doctrees']
... | zammad/zammad-documentation | conf.py | Python | agpl-3.0 | 1,432 |
# -*- coding: utf-8 -*-
from wikitools.api import APIRequest
from wikitools.wiki import Wiki
from wikitools.page import Page
from urllib2 import quote
pairs = [
['"', '"'],
['(', ')'],
['[', ']'],
['{', '}'],
['<!--', '-->'],
['<', '>'],
['<gallery', '</gallery>'],
['<includeonly>', '</includeonly>'],
... | jbzdarkid/Random | mismatched.py | Python | apache-2.0 | 1,737 |
#! /usr/bin/env python
# TextThought.py
# This file is part of CharTr
#
# Copyright (C) 2006 - Don Scorgie <Don@Scorgie.org> (labyrinth part)
# Copyright (C) 2008 - Nicolas Bigeard <nico.bigeard@gmail.com>
# CharTr is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public ... | google-code/chartr | src/TextThought.py | Python | gpl-3.0 | 50,306 |
###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2012-2013, Zenoss Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License ... | zenoss/ZenPacks.zenoss.CloudStack | ZenPacks/zenoss/CloudStack/RouterVM.py | Python | gpl-2.0 | 4,769 |
# Hidden Markov Model Implementation
import pylab as pyl
import numpy as np
import matplotlib.pyplot as pp
#from enthought.mayavi import mlab
import scipy as scp
import scipy.ndimage as ni
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import rospy
#import hrl_lib.mayavi2_util as mu
import hrl_lib.viz ... | tapomayukh/projects_in_python | classification/Classification_with_HMM/Single_Contact_Classification/Variable_Stiffness_Variable_Velocity/HMM/with padding 1.2s/hmm_crossvalidation_force_20_states.py | Python | mit | 29,306 |
# ***************************************************************************
# * Copyright (c) 2013 Juergen Riegel <FreeCAD@juergen-riegel.net> *
# * Copyright (c) 2016 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * Th... | sanguinariojoe/FreeCAD | src/Mod/Fem/femobjects/material_common.py | Python | lgpl-2.1 | 3,987 |
"""
Initialize the module.
Author:
Panagiotis Tsilifis
Date:
5/22/2014
"""
from _forward_model_dmnless import *
| PredictiveScienceLab/inverse-bgo | demos/catalysis/__init__.py | Python | mit | 124 |
#!/usr/bin/env python
# vim: expandtab sw=4 ts=4 sts=4:
#
# Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of python-gammu <https://wammu.eu/python-gammu/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | gammu/python-gammu | examples/getallcalendar.py | Python | gpl-2.0 | 1,747 |
# coding=utf-8
"""
创建SSH服务端
前置依赖:sudo pip install paramiko
"""
import socket
import sys
import threading
import paramiko
host_key = paramiko.RSAKey(filename='test_rsa.key')
class Server(paramiko.ServerInterface):
def __init__(self):
self.event = threading.Event()
def check_channel_request(self, kin... | Hope6537/hope-tactical-equipment | hope-python-script/network/ssh/simple_ssh_server.py | Python | apache-2.0 | 2,224 |
"""
Test that 'stty -a' displays the same output before and after running the lldb command.
"""
from __future__ import print_function
import os
import lldb
import six
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestSTTYBeforeAndAfter(TestB... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py | Python | bsd-3-clause | 3,751 |
# -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from datetime import timedelta
from gluon import current, Field, URL
from gluon.html import *
from gluon.storage import Storage
from s3 imp... | devinbalkind/eden | private/templates/Syria/config.py | Python | mit | 76,451 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from .core import *
from .kernels import *
from .utils import discretize_model
try:
# Not guaranteed available at setup time
from .convo... | kelle/astropy | astropy/convolution/__init__.py | Python | bsd-3-clause | 442 |
#!/usr/bin/python3
import sys
is_debug = False
if 'debug' in sys.argv:
is_debug = True
| ictmaster/backpack-aco | debug.py | Python | mit | 98 |
from flask import Flask, render_template
from flask_wtf import Form
from flask_wtf.file import FileField
from wtforms import FieldList
class FileUploadForm(Form):
uploads = FieldList(FileField())
DEBUG = True
SECRET_KEY = 'secret'
app = Flask(__name__)
app.config.from_object(__name__)
@app.route("/", methods=(... | Maxence1/flask-wtf | examples/uploadr/app.py | Python | bsd-3-clause | 742 |
# Copyright 2011 OpenStack LLC.
# 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... | klmitch/dtest | tests/test_inheritance.py | Python | apache-2.0 | 1,722 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fexum.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | KDD-OpenSource/fexum | manage.py | Python | mit | 803 |
from collections import Iterable, namedtuple
from glob import iglob
import os.path
from coala_utils.decorators import (
enforce_signature, generate_eq, generate_repr)
from coalib.parsing.ConfParser import ConfParser
@generate_repr()
@generate_eq('language', 'docstyle', 'markers')
class DocstyleDefinition:
""... | Asnelchristian/coala | coalib/bearlib/languages/documentation/DocstyleDefinition.py | Python | agpl-3.0 | 8,116 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
... | vlegoff/tsunami | src/primaires/communication/masques/id_conversation/__init__.py | Python | bsd-3-clause | 3,969 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2016 Rahul Raturi
# Copyright (C) 2018 Laurent Monin
# Copyright (C) 2019, 2021 Philipp Wolfer
# Copyright (C) 2020 Ray Bouchard
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of t... | musicbrainz/picard | picard/ui/tablebaseddialog.py | Python | gpl-2.0 | 7,322 |
"""Comfo Twirp API client."""
import asyncio
import functools
from twirp.context import Context
from twirp.errors import Errors as TwirpErrors
from twirp.exceptions import TwirpServerException
from . import comfo_pb2, exceptions
from .comfo_twirp import ComfoClient
from .types import BootInfo, Bypass, Errors, FanProf... | ti-mo/comfo | python/comfo/client.py | Python | mit | 8,138 |
from sklearn import datasets
from sklearn.neural_network import MLPClassifier
import traceback
from submissions.Fritz import medal_of_honor
class DataFrame:
data = []
feature_names = []
target = []
target_names = []
honordata = DataFrame()
honordata.data = []
honortarget = []
class DataFrame2:
da... | SimeonFritz/aima-python | submissions/Fritz/myNN.py | Python | mit | 4,756 |
import cvxpy as cvxpy
import numpy as np
import unittest
from projection_methods.oracles.nonneg import NonNeg
import projection_methods.tests.utils as utils
class TestNonNeg(unittest.TestCase):
def test_projection(self):
"""Test projection, query methods of the NonNeg oracle."""
x = cvxpy.Variable... | akshayka/projection-methods | projection_methods/tests/test_nonneg.py | Python | gpl-3.0 | 2,209 |
import sys
import os
from Dice3DS import dom3ds
import zlib
import StringIO
import struct
class Model(object):
def __init__(self,filename):
self.SetFilename(filename)
self._shape = None
def SetFilename(self, filename):
self._filename = filename
def ReadFile(self):
if not ... | gastrodia/convert3d | convert3d.py | Python | apache-2.0 | 5,255 |
from os import walk
import os
import unittest
class MdTestCase(unittest.TestCase):
def test_articles(self):
for (dirpath, dirnames, filenames) in walk("md"):
for x in filenames:
path = dirpath + os.path.sep + x
htmlpath = path.replace("md" + os.path.... | PotteriesHackspace/knowledgebase | tests.py | Python | mit | 552 |
from collections import defaultdict
from ilxutils.interlex_sql import IlxSql
import json
import os
import pandas as pd
from pathlib import Path
from rdflib import Graph, RDF, RDFS, OWL, BNode, URIRef, Literal
from sys import exit
from typing import Union, List, Dict, Tuple
from ilxutils.ontopandas import OntoPandas
... | tgbugs/pyontutils | ilxutils/ilxutils/interlex_ingestion.py | Python | mit | 23,283 |
try:
import uzlib as zlib
import uio as io
except ImportError:
print("SKIP")
raise SystemExit
# Raw DEFLATE bitstream
buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00')
inp = zlib.DecompIO(buf, -8)
print(buf.seek(0, 1))
print(inp.read(1))
print(buf.seek(0, 1))
print(inp.read(2))
print(inp.read())
print(bu... | AriZuu/micropython | tests/extmod/uzlib_decompio.py | Python | mit | 691 |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | zouzhberk/ambaridemo | demo-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_tracer.py | Python | apache-2.0 | 896 |
"""
Test connecting to a server.
"""
from gabbletest import exec_test
import constants as cs
def test(q, bus, conn, stream):
conn.Connect()
q.expect('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTING, cs.CSR_REQUESTED])
q.expect('stream-authenticated')
q.expect('dbus-signal', sign... | jku/telepathy-gabble | tests/twisted/connect/test-success.py | Python | lgpl-2.1 | 558 |
# -*- coding: utf-8 -*-
"""
Django development settings for sita project.
"""
from . import * # noqa
# Short key for tests speed up
SECRET_KEY = 'secret'
# Debug
DEBUG = False
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
# Application definition
INSTALLED_APPS += (
)
# Database
# https://docs.djangoproject.com/en/1.... | Fabfm4/Sita-BackEnd | src/sita/settings/testing.py | Python | apache-2.0 | 724 |
import os, sys, time, DDG4
from DDG4 import OutputLevel as Output
from SystemOfUnits import *
#
#
"""
DD4hep example setup using the python configuration
\author M.Frank
\version 1.0
"""
def run():
kernel = DDG4.Kernel()
install_dir = os.environ['DD4hepINSTALL']
kernel.setOutputLevel('Geant4Converter... | vvolkl/DD4hep | examples/ClientTests/scripts/MiniTel.py | Python | gpl-3.0 | 1,937 |
class PresentDeliverer:
present_locations = {}
def __init__(self, name):
self.name = name
self.x = 0
self.y = 0
self.present_locations[self.get_key()]=1
def get_key(self):
return str(self.x)+"-"+str(self.y)
def status(self):
print(self.name + " x: "+str(self.x)+" y: "+str(self.y))
def move(self... | caw13/adventofcode | python/day_three_part2.py | Python | mit | 939 |
import argparse
import logging.config
import lib.worker
from lib.connection import Connection
from lib.s3 import S3
from lib.dynamodb import DynamoDB
LOG_PATH = "/tmp/abc.log"
def s3_checker(key):
"""THREAD METHOD - check result_set is all in DynamoDB
"""
global db, db_table
if db:
table = db... | msfuko/CSTools | s3-dynamo-sync-check/db_storage_sync.py | Python | apache-2.0 | 3,540 |
#!/usr/bin/env sage
import sys
import operator
import pprint
from sympy import Symbol, expand, sympify, symbols, Integer
from sympy.simplify.cse_main import numbered_symbols
from shell import *
import sage.all
def mathematica_to_sympy(e):
return sympify(str(e).replace("^", "**").replace("\n", ""))
def simplify... | andremirt/v_cond | gamess/libqc/rysq/lib/python/rysq-generate.py | Python | unlicense | 6,728 |
from secrets import TWILIO_SID, TWILIO_AUTH_TOKEN
import requests
import json
from twilio.rest import TwilioRestClient
import serial
import time
import threading
from mongo_setup import USER_COLLECTION, PENDING_COLLECTION, GALLERY_VERSION
import kairos
import os
import fnmatch
BAUD_RATE = 9600
DEFAULT_GALLERY = 'galle... | adamreis/DANIEL-server | utils.py | Python | mit | 3,683 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for a in orm.Activity.objects.all():
package, version = a.subproject.split()
a.subproject = packa... | openhatch/oh-greenhouse | greenhouse/migrations/0026_add_back_version.py | Python | agpl-3.0 | 9,406 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from rapidsms.utils.modules import import_class
from rapidsms.log.mixin import LoggerMixin
class BackendBase(object, LoggerMixin):
"""Base class for outbound backend functionality."""
@classmethod
def find(cls, module_name):
"""
Helper f... | caktus/rapidsms | rapidsms/backends/base.py | Python | bsd-3-clause | 2,324 |
from django.db import models
from django.utils.safestring import mark_safe
from django.utils.translation import get_language, get_language_from_request
from django.utils.translation import ugettext_lazy as _
from mistune import Markdown
from oioioi.base.utils.deps import check_django_app_dependencies
check_django_app... | sio2project/oioioi | oioioi/newsfeed/models.py | Python | gpl-3.0 | 2,012 |
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Joe Wreschnig
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""APEv2 reading and writing.
The APEv2 format is most commonly used wi... | ronie/script.cu.lrclyrics | resources/lib/mutagen_culrc/apev2.py | Python | gpl-2.0 | 20,975 |
"""Post-processing plugin to perform IQ demodulation"""
try:
from obspy.signal.filter import lowpass # pylint: disable=import-error
except ImportError:
pass
import numpy as np
from numpy.lib import recfunctions as rfn
import matplotlib.pyplot as plt
from place.config import PlaceConfig
from place.plugins.postpr... | PALab/PLACE | place/plugins/iq_demod/iq_demod.py | Python | lgpl-3.0 | 6,810 |
#-*- coding: utf-8 -*-
import requests
import time
import random
import shelve
from bs4 import BeautifulSoup
CONSTANTS = {
'AGENT_SOURCE_ADDRESS': 'https://developers.whatismybrowser.com/useragents/explore/software_type_specific/web-browser/',
'MAX_SLEEP_TIME': 2,
'SHELVE_STORAGE_NAME': 'agent_storage',
... | JMwill/wiki | notebook/tool/spider/crawl_toolkit/uagent/uagent.py | Python | mit | 2,183 |
# -*- coding: utf-8 -*-
"""
Use optimal adaptation code to adapt show possible adpatations to the NAND grammar
"""
import pickle
from LOTlib.Miscellaneous import Infinity
from LOTlib.Subtrees import *
from Model import *
from TargetConcepts import TargetConcepts
from Model.Grammar import grammar
if __name__ == "__ma... | ebigelow/LOTlib | LOTlib/Examples/NAND/Adapt.py | Python | gpl-3.0 | 1,747 |
# Copyright (C) 2016-2019 Virgil Security Inc.
#
# Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# (1) Redistribution... | VirgilSecurity/virgil-sdk-python | virgil_sdk/tests/cards/card_manager_test.py | Python | bsd-3-clause | 28,966 |
from pox.core import core
from collections import defaultdict
import pox.openflow.libopenflow_01 as of
import pox.openflow.discovery
import pox.openflow.spanning_tree
from pox.lib.revent import *
from pox.lib.util import dpid_to_str
from pox.lib.util import dpidToStr
from pox.lib.addresses import IPAddr, EthAddr
from c... | AndreaLombardo90/SDN-Controller | SDN_Controller.py | Python | apache-2.0 | 13,947 |
import FSGDP
def main():
Recv = FSGDP.Receiver()
sender = FSGDP.Sender()
desc = input("Start chat or join chat [s/j]")
if desc == "s":
adress = input("Adress[8-bit]:")
message_back = input("Message:")
sender.send_string(message_back, adress)
while True:
Recv.daten =... | GQDeltex/FSG-DataProtocol | Chat.py | Python | mit | 758 |
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2018 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distrib... | jhoenicke/python-trezor | trezorlib/tests/device_tests/test_msg_ethereum_signmessage.py | Python | lgpl-3.0 | 1,685 |
import errno
import json
import os
import re
class Error(Exception):
"""Base class for exceptions in this module"""
pass
class URLError(Error, ValueError):
pass
def verify_url(url, port=8000):
"""Returns complete URL with http prefix and port number
"""
pattern = re.compile(
r'^(htt... | kbase/assembly | lib/assembly/utils.py | Python | mit | 2,298 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('spellweb', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='attempt',
name='succ... | shearichard/spellsplash | splsplsh_project/spellweb/migrations/0002_auto_20140919_2143.py | Python | gpl-3.0 | 397 |
# Copyright 2012-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 la... | dtroyer/python-openstackclient | openstackclient/identity/v2_0/endpoint.py | Python | apache-2.0 | 5,998 |
import subprocess as sp
import json, os, time, urllib2
import config_handler
class server(object):
# represents a server to be interfaced with
def __init__(self, name):
self.name = name
# read in config file
self.json = config_handler.load_json()
self.config = self.json.read()
self.SERVERLOC... | 1egoman/mconmanager | server.py | Python | gpl-2.0 | 5,821 |
"""
Django settings for reposeacademy project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
impor... | atulmishra-one/repose-academy | reposeacademy/settings.py | Python | apache-2.0 | 4,190 |
from __future__ import division, print_function, absolute_import
import threading
import numpy as np
from ._ufuncs import _ellip_harm
from ._ellip_harm_2 import _ellipsoid, _ellipsoid_norm
# the functions _ellipsoid, _ellipsoid_norm use global variables, the lock
# protects them if the function is called from multi... | gdooper/scipy | scipy/special/_ellip_harm.py | Python | bsd-3-clause | 5,747 |
#!/usr/bin/env python
'''
Workflow Thread
'''
from threading import Thread
import sys
import os
import socket
import logging.config
from xfero import get_conf as get_conf
from xfero.workflow_manager.copy_file import Copy_File
from xfero.workflow_manager.av_check import Anti_Virus
from xfero.workflow_manager.case_conve... | tickbox-smc-ltd/xfero | src/xfero/workflow.py | Python | agpl-3.0 | 14,723 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import mock
from nose.tools import eq_, ok_
import socorro.processor.signature_utilities as sig
import socorro.lib.util... | bsmedberg/socorro | socorro/unittest/processor/test_signature_utilities.py | Python | mpl-2.0 | 31,083 |
import os
from check.factory import create_app
app = create_app(os.environ['SETTINGS'])
| openregister/check-demo | check/__init__.py | Python | mit | 88 |
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class PetitionType(models.Model):
_name = "petition.type"
_description = "Petition Template"
_order = "sequence, name"
name = fields.Char(string="Petition Template")
seq... | mozaik-association/mozaik | mozaik_petition/models/petition_type.py | Python | agpl-3.0 | 483 |
__author__ = 'sondredyvik'
class ConstraintNet:
def __init__(self):
self.constraints = {}
def add_constraint(self,key,constraint):
if key in self.constraints:
self.constraints[key].append(constraint)
else:
self.constraints[key] = [constraint]
| pmitche/it3105-aiprogramming | project1/common/constraintnet.py | Python | mit | 304 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-31 18:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('genevieve_client', '0009_auto_20160731_1621'),
]
operations = [
migrations.A... | madprime/genevieve | genevieve_client/migrations/0010_auto_20160731_1842.py | Python | mit | 471 |
#----------------------------------------------------------------------
# Copyright (c) 2011-2013 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | EICT/C-BAS | src/vendor/geni_trust/ext/geni/am/aggregate.py | Python | bsd-3-clause | 3,257 |
#!/usr/bin/env python
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | turon/openthread | tests/scripts/thread-cert/Cert_6_1_02_REEDAttach_SED.py | Python | bsd-3-clause | 5,431 |
import os
from django.core import serializers
from django.db import models
from django.utils.functional import cached_property
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.core.fields import RichTextField
from wagtail.core.models import Page
from .settings import DISPLAYED_FACTOID_TYPES, BASE_DIR
... | kingsdigitallab/pbw-django | pbw/models.py | Python | gpl-2.0 | 46,771 |
# Copyright (C) 2009, Hyves (Startphone Ltd.)
#
# This module is part of the Concurrence Framework and is released under
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
class HTTPError(Exception): pass
class HTTPRequest(object):
"""A class representing a HTTP request."""
def __i... | concurrence/concurrence | lib/concurrence/http/__init__.py | Python | bsd-3-clause | 2,344 |
'''tzinfo timezone information for America/Martinique.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Martinique(DstTzInfo):
'''America/Martinique timezone definition. See datetime.tzinfo for details'''
zone = 'America/M... | newvem/pytz | pytz/zoneinfo/America/Martinique.py | Python | mit | 591 |
import math
print("factorial(100) using Python = %.0x" % math.factorial(100))
| kokke/tiny-bignum-c | scripts/fact100.py | Python | unlicense | 78 |
"""
>>> import pyarrow
>>> import pyarrow.feather
>>> import pandas
>>> import numpy
>>> pyarrow.from_pylist([1,2,3]) # doctest: +ELLIPSIS
<pyarrow.array.Int64Array object at 0x...>
[
1,
2,
3
]
>>> fn = 'example.feather'
>>> df = pandas.DataFrame({'ints': numpy.random.randint(0, 10, 5)})
>>> pyarrow.feather.wri... | rvernica/docker-library | apache-arrow/example.py | Python | mit | 503 |
import io
import re
import os
import csv
import sys
import time
import datetime
import collections
from sets import Set
from Defaulter import Defaulter
from optparse import OptionParser
class ProcessDefaulters:
def __init__(self):
self.defaulterList = []
def run(self, filename):
"""
Reads the text and sets... | brennash/DefaultersDashboard | src/ProcessDefaulters.py | Python | mit | 3,298 |
from typing import List
from ray import workflow
@workflow.step
def start():
titles = ["Stranger Things", "House of Cards", "Narcos"]
children = []
for t in titles:
children.append(a.step(t))
return end.step(children)
@workflow.step
def a(title: str) -> str:
return "{} processed".format... | ray-project/ray | python/ray/workflow/examples/comparisons/metaflow/foreach_workflow.py | Python | apache-2.0 | 483 |
from .bot_basic import Bot, TelegramChat, TelegramUser, Message
from .likes import Like
from .scheduled_task import ScheduledTask
from .tourette import TouretteUser
from .context import Context | orangefrg/rpfti_bot | models/__init__.py | Python | apache-2.0 | 193 |
# encoding: 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):
# Deleting field 'TempMeter.controller'
db.delete_column('rainman_tempmeter', 'controller_id')
# ... | smurfix/HomEvenT | irrigation/rainman/migrations/0019_auto__del_field_tempmeter_controller__del_field_rainmeter_controller__.py | Python | gpl-3.0 | 19,752 |
# -*- coding: utf-8 -*-
"""rpi2casterd: hardware control daemon for the rpi2caster software.
This program runs on a Raspberry Pi or a similar single-board computer
and listens on its address(es) on a specified port using the HTTP protocol.
It communicates with client(s) via a JSON API and controls the machine
using se... | elegantandrogyne/rpi2casterd | rpi2casterd/main.py | Python | mit | 34,920 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import time
import os
import filecmp
from webdriver_testing.webdriver_base import WebdriverTestCase
from webdriver_testing.pages.site_pages.teams import videos_tab
from webdriver_testing.pages.site_pages.teams.tasks_tab import TasksTab
from webdriver_testing.pages.s... | ujdhesa/unisubs | apps/webdriver_testing/check_teams/test_videos.py | Python | agpl-3.0 | 42,783 |
"""
Kodi resolveurl plugin
Copyright (C) 2018 script.module.resolveurl
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) an... | felipenaselva/felipe.repository | script.module.resolveurl/lib/resolveurl/plugins/streamgo.py | Python | gpl-2.0 | 1,733 |
# Copyright (c) 2016-present, Facebook, 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... | Yangqing/caffe2 | caffe2/python/operator_test/mod_op_test.py | Python | apache-2.0 | 2,236 |
from __future__ import annotations
import io
import re
import struct
from pathlib import Path
from typing import List, Union, Optional, BinaryIO
from PIL import Image
from elma.constants import LGR_DEFAULT_PALETTE
from elma.constants import LGR_END_OF_FILE
from elma.constants import LGR_FOOD_NAME
from elma.constants ... | sigvef/elma | elma/lgr.py | Python | mit | 13,521 |
#!/usr/bin/env python
from __future__ import print_function
import numpy
import math
import cProfile
# from http://math2.uncc.edu/~shaodeng/TEACHING/math5172/Lectures/Lect_15.PDF
# u, v, weight
gaussPtsAndWeights = {
1: numpy.transpose(((0.33333333333333, 0.33333333333333, 1.00000000000000),)),
2: numpy.trans... | gregvonkuster/icqsol | bem/icqQuadrature.py | Python | mit | 6,408 |
import json
import os
import platform
from robot.api import logger
class BigListOfNaughtyStrings:
"""The Big List of Naughty Strings is originally copied from here:
https://github.com/minimaxir/big-list-of-naughty-strings
"""
def get_blns(self):
if platform.system() == "Windows":
... | rtomac/robotframework-selenium2library | atest/resources/testlibs/BigListOfNaughtyStrings.py | Python | apache-2.0 | 611 |
################################################################################
# A simple script to convert the iris training data to the vowpal wabbit format.
#
# Author: Carl Cortright
# Date: 9/10/2016
#
# Copyright 2016 Carl Cortright
###############################################################################... | carlcortright/CSCI4380MachineLearning | ProgrammingAssignments/IrisClassification/Vowpal/convertToVowpal.py | Python | mit | 2,033 |
#! /usr/bin/env python
# Copyright (C) 2010 Antoine Drouin
#
# This file is part of Paparazzi.
#
# Paparazzi 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, or (at your option)
# any later ... | tcunis/paparazzi | sw/tools/calibration/calibrate.py | Python | gpl-2.0 | 6,309 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.