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 subprocess
from pyrm114 import *
#
p = pyrmClassifier(['a','b'])
p.train('a', 'ay lmao')
p.train('b', 'b rip')
p.classify('lmao')
with open('rip.txt', 'w') as f:
p.classify('lmao', f)
subprocess.call('cat rip.txt')
os.remove('rip.txt')
print p.crm_files_exist()
p.reset()
print p.crm_files_exist()
| errcHuang/pyRM114 | tests/test.py | Python | mit | 310 |
# DO NOT EDIT THIS FILE in the QGIS plugin directory.
# Edit the original library file in the qgpkg directory and
# execute `make` to update the QGIS plugin files.
from __future__ import print_function
import sys
import os
import sqlite3
import tempfile
import logging
from xml.etree import ElementTree as ET
from qgis.c... | pka/qgpkg | qgisgpkg/qgpkg_owc.py | Python | mit | 15,628 |
import os.path
import pickle
import sys
import unittest.mock
from pathlib import Path
from textwrap import dedent
from types import ModuleType
from typing import Generator
import py
import pytest
from _pytest.monkeypatch import MonkeyPatch
from _pytest.pathlib import bestrelpath
from _pytest.pathlib import commonpath... | nicoddemus/pytest | testing/test_pathlib.py | Python | mit | 16,530 |
# -*- coding: utf-8 -*-
# Copyright 2013 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 requi... | SmartInfrastructures/fuel-web-dev | nailgun/nailgun/test/base.py | Python | apache-2.0 | 56,661 |
# -*- coding: utf-8 -*-
"""
The module :mod:`openerp.tests.common` provides unittest2 test cases and a few
helpers and classes to write tests.
"""
import errno
import glob
import json
import logging
import os
import select
import subprocess
import threading
import time
import unittest2
import urllib2
import xmlrpclib
... | numerigraphe/odoo | openerp/tests/common.py | Python | agpl-3.0 | 13,126 |
"""
dj-stripe SubscriptionSchedule model tests.
"""
from copy import deepcopy
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from djstripe.enums import SubscriptionScheduleStatus
from djstripe.models import SubscriptionSchedule
from . import (
FAKE... | pydanny/dj-stripe | tests/test_subscription_schedule.py | Python | bsd-3-clause | 2,029 |
# Copyright (c) 2014 Alcatel-Lucent Enterprise
# 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
#
# Un... | OpenTouch/python-facette | src/facette/v1/collections.py | Python | apache-2.0 | 2,084 |
from auth import *
from documents import *
from notes import *
from topics import *
| CENDARI/editorsnotes | editorsnotes/main/models/__init__.py | Python | agpl-3.0 | 84 |
from django.core.management.base import BaseCommand
from attachments.models import Attachment, get_file_suffix, \
is_img
class Command(BaseCommand):
help = "update attachment's base info."
def handle(self, **options):
attachments = Attachment.objects.all()
for o in attachments:
... | pombredanne/django-lb-attachments | attachments/management/commands/update_attachments.py | Python | bsd-3-clause | 612 |
import numpy as np
import copy
from pybullet_utils.logger import Logger
import inspect as inspect
from pybullet_envs.deep_mimic.env.env import Env
import pybullet_utils.math_util as MathUtil
class ReplayBuffer(object):
TERMINATE_KEY = 'terminate'
PATH_START_KEY = 'path_start'
PATH_END_KEY = 'path_end'
def __... | MadManRises/Madgine | shared/bullet3-2.89/examples/pybullet/gym/pybullet_envs/deep_mimic/learning/replay_buffer.py | Python | mit | 10,316 |
#!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
# Program Parameters
#
import os
import s... | dmaticzka/bioconda-recipes | recipes/peptide-shaker/peptide-shaker.py | Python | mit | 3,272 |
#!/usr/bin/env python
import shogun as sg
parameter_list=[[".", "features_string_char.py"]]
def features_string_file (directory, fname):
from shogun import StringCharFeatures, RAWBYTE
# load features from directory
f=StringCharFeatures(RAWBYTE)
f.load_from_directory(directory)
#and output several stats
#print(... | shogun-toolbox/shogun | examples/undocumented/python/features_string_file.py | Python | bsd-3-clause | 966 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import absolute_import
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('fixes', parent_package, top_pa... | alexis-roche/nipy | nipy/fixes/setup.py | Python | bsd-3-clause | 656 |
# author : Etienne THIERY
from matgen import *
import random
import numpy
def test_symmetricPositiveDefinite():
for i in range(10):
print(".", end="", flush=True)
size = random.randint(400, 500)
maxVal = random.randint(0, 1000)
M = symmetricPositiveDefinite(size, maxVal)
if... | ethiery/heat-solver | trunk/test_matgen.py | Python | mit | 1,289 |
import logging
from collections import OrderedDict
from functools import wraps
from gevent import spawn
import zmq.green as zmq
from frankdux.types import Descriptor, Int, Float, String, Bytes, TypeRegistry
from .exceptions import ArgumentCountException
from .encoding import MessageEncoder
from frankdux.codegen impo... | rustyrazorblade/FrankDux | frankdux/__init__.py | Python | bsd-2-clause | 5,024 |
from typing import Tuple
from .. import Provider as CompanyProvider
class Provider(CompanyProvider):
formats = (
"{{last_name}} {{company_suffix}}",
"{{last_name}} {{last_name}} {{company_suffix}}",
"{{last_name}}",
"{{last_name}}",
)
catch_phrase_formats = ("{{catch_phra... | joke2k/faker | faker/providers/company/fr_FR/__init__.py | Python | mit | 3,985 |
import threading
import time
import sublime
import sublime_plugin
from ..show_error import show_error
from .existing_packages_command import ExistingPackagesCommand
from ..thread_progress import ThreadProgress
from ..package_disabler import PackageDisabler
from ..package_manager import PackageManager
class RemovePa... | koery/win-sublime | Data/Packages/Package Control/package_control/commands/remove_package_command.py | Python | mit | 2,356 |
from flask import Flask, jsonify, abort, request
app = Flask(__name__)
vnf_nodes = [
{
'vnf_id': 1,
'vnf_name': u'vnf01',
'vnf_desc': u'test1',
'vnf_load': u'R17'
},
{
'vnf_id': 2,
'vnf_name': u'vnf02',
'vnf_desc': u'test2',
... | IT-SeanWANG/CodeJam | 2016_1st/Refer1_Q3.py | Python | apache-2.0 | 1,621 |
# Copyright 2016-2017 ZTE Corporation.
#
# 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 t... | open-o/nfvo | lcm/lcm/packages/tests/test_nf.py | Python | apache-2.0 | 23,203 |
from pytest import mark
from tests import factories
from tests import common_tools
from tests.common_tools import (
make_user,
create_talk_for_user,
get_default_conference,
template_used)
from conference import user_panel
from conference import models
STERAMS_1 = [
{
"title": "Holy Grail",... | EuroPython/epcon | tests/test_streamset.py | Python | bsd-2-clause | 1,750 |
#!/usr/bin/python
# Copyright (c) 2009 Las Cumbres Observatory (www.lcogt.net)
#
# 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
#... | nowelium/protobuf-socket-rpc | python/src/example/time/run_server.py | Python | mit | 2,616 |
from sqlalchemy import *
from migrate import *
from floof.model.types import Timezone
from sqlalchemy.ext.declarative import declarative_base
TableBase = declarative_base()
# Modified tables
class User(TableBase):
__tablename__ = 'users'
id = Column(Integer, primary_key=True, nullable=False)
resource_id =... | eevee/floof | migration/versions/024_Add_user_email_addresses.py | Python | isc | 1,361 |
from os.path import exists, isdir
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
PROMPT = "> "
def chunks(l, n):
# noinspection PyArgumentList
for i in range(0, len(l), n):
yield l[i:i + n]
# noinspection PyUnusedLocal
def good_... | RoyalDev/RoyalCommands-converter | converter/__init__.py | Python | gpl-3.0 | 3,485 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | v-iam/azure-sdk-for-python | azure-batch/azure/batch/models/start_task.py | Python | mit | 4,412 |
import logging
from SWDProtocol import *
from SWDErrors import *
# Refs:
# "Serial Wire Debug and the CoreSightTM Debug and Trace Architecture"
class SWDAdapterBase(object):
"Base abstract class for SWD adapter hardware"
def __init__(self):
self.log = logging.getLogger("comm")
#
# Mandator... | heartscrytech/PySWD | SWDAdapterBase.py | Python | bsd-3-clause | 4,081 |
import fdr
| akhambhati/Echobase | Echobase/Statistics/FDR/__init__.py | Python | gpl-3.0 | 11 |
#######
# Objetos
#######
class Persona:
#atributos de la clase
edad=0
genero=""
nombre=""
altura=0
#metodos de la clase
def caminar(self):
print("Estoy caminando!!")
def saludar(self):
print("Hola!! soy %s"%self.nombre)
def comer(self,comida):
print("Me gusta ",comida)
def cumpleaños(self):
self... | allanstone/cursoSemestralPython | SextaClase/objetos.py | Python | mit | 1,595 |
import unittest,sys,os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from PSFile import PSFile
class TestPSFile(unittest.TestCase):
def testInit(self):
fn = 'ps_r0_20140815-121539.h5'
psf = PSFile(fn)
print "fn=",psf.openfile
for i,freq in enumerate(psf.freq):
... | bmazin/SDR | Setup/test/TestPSFile.py | Python | gpl-2.0 | 400 |
'''
@author: Rahul Tanwani
@summary: Contains base test case for reusable test methods.
'''
import json
from django.test import TestCase
from batch_requests.settings import br_settings as settings
class TestBase(TestCase):
'''
Base class for all reusable test methods.
'''
def assert_reponse_co... | tanwanirahul/django-batch-requests | tests/test_base.py | Python | mit | 2,053 |
# Copyright 2022 Mark Bolhuis <mark@bolhuis.dev>
# 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... | mesonbuild/meson | mesonbuild/modules/unstable_wayland.py | Python | apache-2.0 | 4,615 |
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Matthias Luescher
#
# Authors:
# Matthias Luescher
#
# This file is part of edi.
#
# edi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of... | lueschem/edi | tests/lib/test_sshkeyhelpers.py | Python | lgpl-3.0 | 3,151 |
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return render(request, 'home/home.html')
| KokareIITP/vms | vms/home/views.py | Python | gpl-2.0 | 139 |
#!/usr/bin/env python
# Copyright (C) 2015 OpenStack, 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... | phinexus/jenkins-job-builder | jenkins_jobs/registry.py | Python | apache-2.0 | 18,370 |
#!/usr/bin/python3
from gi.repository import Gtk as gtk
from armadito import jrpc
import pprint
import sys
conn = jrpc.Connection('/tmp/.armadito-daemon')
conn.connect()
def on_status_received(result):
pprint.pprint(vars(result))
pprint.pprint(vars(result.module_infos[0]))
for b in result.module_infos[0... | armadito/armadito-systray-ui | python/tests/test-jrpc.py | Python | gpl-3.0 | 821 |
#! /usr/bin/env python
from __future__ import print_function
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
dimension = 2
sampleSize = 1000
# we create an analytical function
analytical = NumericalMathFunction(['x0', 'x1'], ['f'], ['10+3*x0+x1'])
# we create a collection... | dubourg/openturns | python/test/t_CorrelationAnalysis_std.py | Python | gpl-3.0 | 1,110 |
# 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... | jendap/tensorflow | tensorflow/contrib/training/python/training/hparam.py | Python | apache-2.0 | 26,772 |
#!/usr/bin/python
# -*- coding: ISO-8859-15 -*-
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
# Angelos Tzotsos <tzotsos@gmail.com>
#
# Copyright (c) 2015 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtai... | ocefpaf/pycsw | bin/pycsw-admin.py | Python | mit | 8,634 |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------
#
# fTools
# Copyright (C) 2008-2011 Carson Farmer
# EMAIL: carson.farmer (at) gmail.com
# WEB : http://www.ftools.ca/fTools.html
#
# A collection of data management and analysis tools for vector data
#
#-----------------------------... | NINAnor/QGIS | python/plugins/fTools/tools/doVisual.py | Python | gpl-2.0 | 20,290 |
#!/usr/bin/env python
# coding=utf-8
import requests
import gevent.timeout
import logging
__author__ = 'chenfengyuan'
PROXIES = {
'http': 'http://127.0.0.1:9999',
'https': 'http://127.0.0.1:9999',
}
PROXIES = {}
logger = logging.getLogger(__name__)
class Chunk:
def __init__(self, start, chunk_size):
... | chenfengyuan/mcurl | python3/mcurl/utils/http_chunk_client.py | Python | mit | 3,712 |
import sys
from PyQt5 import QtGui
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton, QApplication, QVBoxLayout, QTabWidget, QLineEdit, QColorDialog,
QSlider, QInputDialog, QFileDialog)
from PyQt5.QtGui import QFont, QColor
from PyQt5.QtCore import ... | ChesnakovKonstantin/Test-Example | Python projects/PythonApplication3/PythonApplication3/PythonApplication3.py | Python | mit | 44,107 |
#!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import patch
from diamond.collector import Collector
from netstat import NetstatCollector
####... | skbkontur/Diamond | src/collectors/netstat/test/testnetstat.py | Python | mit | 1,230 |
# (c) 2016 RedHat
#
# This file is part of Ansible.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribu... | naslanidis/ansible | lib/ansible/plugins/shell/__init__.py | Python | gpl-3.0 | 6,488 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Python wrapper around the C extension for the pair counter in
``mocks/DDrppi_mocks/``. This python wrapper is
:py:mod:`Corrfunc.mocks.DDrppi_mocks`
"""
from __future__ import (division, print_function, absolute_import,
unicode_literals)
__auth... | manodeep/Corrfunc | Corrfunc/mocks/DDrppi_mocks.py | Python | mit | 18,727 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | ikargis/horizon_fod | horizon/test/tests/tables.py | Python | apache-2.0 | 46,698 |
import os
import numpy as np
import pandas as pd
from sqlalchemy import create_engine
from tests.settings import POSTGRESQL_ENGINE
from tests.utils import get_repository_path, DBTest
from ukbrest.common.pheno2sql import Pheno2SQL
from ukbrest.common.postloader import Postloader
class PostloaderTest(DBTest):
def... | miltondp/ukbrest | tests/test_postloader.py | Python | gpl-3.0 | 38,352 |
"""
N-Queens Problem: Given a chess board having cells, we need to place queens in such a way that no queen is attacked by any other queen. A queen can attack horizontally, vertically and diagonally.
So initially we are having unattacked cells where we need to place queens. Let's place the first queen at a cell... | rkhale/python | generic questions/attack_queen.py | Python | unlicense | 4,008 |
import logging
import cv2
import numpy as np
from chunk import Chunk
import struct
import math
from time import time
import os.path
from common import SushiError, clip
WAVE_FORMAT_PCM = 0x0001
WAVE_FORMAT_EXTENSIBLE = 0xFFFE
class DownmixedWavFile(object):
def __init__(self, path):
super(DownmixedWavFile... | alicx1/Sushi | wav.py | Python | mit | 7,544 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def initial_data(apps, schema_editor):
SH = apps.get_model('ship', 'ShipHull')
SH(name='Frigate', space=25, cost=25).save()
SH(name='Destroyer', space=60, cost=85).save()
SH(name='Cruiser', space=120, cos... | dwagon/pymoo | moo/ship/migrations/0002_populate_shiphulls.py | Python | gpl-2.0 | 665 |
import os
pythondir = os.path.join(installdir, 'Python') # noqa
path = os.environ.get('PATH', '')
os.environ['PATH'] = os.pathsep.join([pythondir, pkgdir, path]) # noqa
| davvid/git-cola | contrib/win32/pynsist-preamble.py | Python | gpl-2.0 | 172 |
# -*- coding: Latin-1 -*-
"""
@file CompareVelocitys.py
@author Sascha Krieg
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-04-29
Creates a file with a comparison of velocities between Taxi-FCD and vtypeprobe.
SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
Copyright (C) 2... | rudhir-upretee/Sumo17_With_Netsim | tools/projects/TaxiFCD_Krieg/src/analysis/CompareVelocitys.py | Python | gpl-3.0 | 4,238 |
#!/usr/bin/env python2.7
"""
@package: pyHerkulex
@name: herkulex.py
@author: Achu Wilson (achuwilson@gmail.com), Akhil Chandran (akhilchandran.t.r@gmail.com)
@version: 0.1
This is a python library for interfacing the Herkulex range of smart
servo motors manufactured by Dongbu Robotics.
The library was created by ... | seiji56/rmaze-2016 | logic_code/last_ver/sim/herkulex.py | Python | gpl-3.0 | 23,289 |
# -*- coding: utf-8 -*-
"""
jinja.nodes
~~~~~~~~~~~
This module implements additional nodes derived from the ast base node.
It also provides some node tree helper functions like `in_lineno` and
`get_nodes` used by the parser and translator in order to normalize
python and jinja nodes.
:co... | dcramer/jinja1-djangosupport | jinja/nodes.py | Python | bsd-3-clause | 17,573 |
from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.sparse as sps
from ._numdiff import approx_derivative, group_columns
from ._hessian_update_strategy import HessianUpdateStrategy
from scipy.sparse.linalg import LinearOperator
FD_METHODS = ('2-point', '3-point', 'cs')
c... | jor-/scipy | scipy/optimize/_differentiable_functions.py | Python | bsd-3-clause | 18,349 |
import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from datetime import datetime, timedelta
from Lclassifier import testClassifier
import pickle
import os
classifier_path = 'langSer/manager/classifier.pickle'
@csrf_exempt
def detect (request):
if request.method =... | rahulgoel/Language-Detection | langSer/langSer/manager/LanguageManager.py | Python | gpl-2.0 | 980 |
"""
Describe the purpose of the test class here.
"""
from __future__ import print_function
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
class RenameThisSampleTestTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
# If your test case doesn't stress... | apple/swift-lldb | packages/Python/lldbsuite/test/sample_test/TestSampleTest.py | Python | apache-2.0 | 1,625 |
#!/usr/bin/env python
import TransferErrors as TE
import cPickle as pickle
with open('stuck.pkl','rb') as pklfile:
stuck = pickle.load(pklfile)
TE.makeBasicTable(stuck,TE.workdir+'html/table.html',TE.webdir+'table.html')
TE.makeCSV(stuck,TE.webdir+'data.csv')
for basis in [-6,-5,-4,-3,-1,1,2]:
TE.makeJson(stuck... | sidnarayanan/TransferErrors | bin/write.py | Python | mit | 382 |
# coding: utf-8
#
# Copyright © 2017 weirdgiraffe <giraffe@cyberzoo.xyz>
#
# Distributed under terms of the MIT license.
#
import sys
try: # real kodi
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
except ImportError: # mocked kodi
from mock_kodi import xbmc
from mock_kodi imp... | weirdgiraffe/plugin.video.giraffe.seasonvar | resources/site-packages/kodi/__init__.py | Python | mit | 3,703 |
# Copyright (c) 2012 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 ... | eharney/nova | plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py | Python | apache-2.0 | 14,618 |
"""
Tinderbox target
"""
# NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
import os
from catalyst.support import cmd, list_bashify, CatalystError
from catalyst.base.stagebase import StageBase
class tinderbox(StageBase):
"""
Builder class for the tinderbox target
"""
def __init__(self... | elitak/catalyst | catalyst/targets/tinderbox.py | Python | gpl-2.0 | 1,379 |
from django.db import models
from django.urls import reverse
from djrichtextfield.models import RichTextField
class Post(models.Model):
title = models.CharField(max_length=50)
lead = RichTextField(field_settings='mini')
content = RichTextField()
def get_absolute_url(self):
return reverse('po... | jaap3/django-richtextfield | testproject/testapp/models.py | Python | mit | 835 |
## roster.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
## 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 2, or (at your option)
## any later version.
... | jjculber/xmpp-server-scanner | pybot/include/xmpp/roster.py | Python | gpl-2.0 | 10,808 |
'''
AnimeBot.py
Acts as the "main" file and ties all the other functionality together.
'''
import asyncio
import re
import traceback
import discord
import roboragi_old.CommentBuilder as CommentBuilder
import roboragi_old.Config as Config
import roboragi_old.DatabaseHandler as DatabaseHandler
import roboragi_old.Disc... | MaT1g3R/Roboragi | roboragi_old/AnimeBot.py | Python | mit | 17,947 |
import os
def rename_abf(fname):
fname = os.path.basename(fname)
path = os.path.dirname(os.path.abspath(fname))
path_file = os.path.join(path, fname)
fnoext = fname.split(os.extsep)[0]
## pull out the year, month and day from the fname
year = fnoext[0:2]
month = ... | matthewperkins/abf_reader | abf_rename.py | Python | mit | 1,161 |
"""Reusable testing components"""
from django.test import TestCase, Client
from django.urls import reverse
from rest_framework import status
from server.models import User
class AdminTestCase(TestCase):
"""Test the admin site is configured to have all expected views."""
admin_endpoints = {}
def app(s... | salopensource/sal | sal/test_utils.py | Python | apache-2.0 | 2,243 |
import hashlib
import json
import logging
import os
import re
import sys
import glob
from collections import defaultdict
from cStringIO import StringIO
from fs.osfs import OSFS
from importlib import import_module
from lxml import etree
from path import path
from xmodule.error_module import ErrorDescriptor
from xmodul... | wwj718/edx-video | common/lib/xmodule/xmodule/modulestore/xml.py | Python | agpl-3.0 | 26,947 |
#!/usr/bin/env python
import os, sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "july.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| julython/julython.org | manage.py | Python | mit | 245 |
#!/usr/bin/python
# File created on Nov 27 Jan 2012
from __future__ import division
__author__ = "Kishori M Konwar"
__copyright__ = "Copyright 2013, MetaPathways"
__credits__ = ["r"]
__version__ = "1.0"
__maintainer__ = "Kishori M Konwar"
__status__ = "Release"
try:
from os import makedirs, sys, remove, rename
... | wholebiome/MetaPathways_Python_Koonkie.3.0 | libs/python_scripts/MetaPathways_annotate_fast_threaded.py | Python | mit | 36,220 |
# -*- coding: utf-8 -*-
import sys
from OpenSSL import crypto
def generate_pem_file(string, filename):
with open(filename, "w") as fl:
fl.write(string)
def extract_pem_certificate():
path_file = sys.argv[1]
password = sys.argv[2]
try:
certificate = open(path_file, "r").read()
e... | adrianomargarin/extract-pems | extract.py | Python | gpl-3.0 | 1,032 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleads/google-ads-python | google/ads/googleads/v10/services/services/keyword_plan_service/transports/__init__.py | Python | apache-2.0 | 1,049 |
import urllib
import re
import bggBazaSQLite as baza
def WstawDoBazy(numer):
vNAZWA=""
stronaParti=urllib.urlopen('http://boardgamegeek.com/play/details/'+str(numer)).read()
plikParti=open('bggwwwParti','w')
plikParti.write(stronaParti)
plikParti.close()
plikParti=open('bggwwwParti')
imie=0
... | przemekwa/BoardGameUserGames | bggZapisPartiDoBazy.py | Python | mit | 2,286 |
"""The main world definition"""
import common
import zone
import serialize
import geometry
import events
import actor
import profiler
class UnknownActor(Exception): """Could not find the actor"""
class DuplicateActor(Exception): """The actor was already in the world"""
class DuplicateZone(Exception): """The zone was... | smmosquera/serge | world.py | Python | lgpl-3.0 | 11,910 |
"""
Machine learning module for Python
==================================
sklearn is a Python module integrating classical machine
learning algorithms in the tightly-knit world of scientific Python
packages (numpy, scipy, matplotlib).
It aims to provide simple and efficient solutions to learning problems
that are acc... | jereze/scikit-learn | sklearn/__init__.py | Python | bsd-3-clause | 3,038 |
#!/usr/bin/env python3
import pygame
import sys
import time
import os
from pygame.locals import *
from .button import Button
from .pygame_textinput import TextInput
from .globals import (screen_width, screen_height, FPS, fps_clock,
fontPath, assetsPath)
from .tool import (swap_c_is_chosing_color... | pleeplee-robot/interface | pleepleeapp/menu_init.py | Python | mit | 7,422 |
'''test pysftp.Connection.chdir - uses py.test'''
# pylint: disable = W0142
# pylint: disable=E1101
from common import *
def test_chdir_bad_dir(psftp):
'''try to chdir() to a non-existing remote dir'''
with pytest.raises(IOError):
psftp.chdir('i-dont-exist')
| Clean-Cole/pysftp | tests/test_chdir.py | Python | bsd-3-clause | 278 |
# Copyright 2020 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, ... | googleapis/python-talent | samples/snippets/job_search_histogram_search_test.py | Python | apache-2.0 | 903 |
# Copyright 2010-2012 RethinkDB, all rights reserved.
import query
import query_language_pb2 as p
import types
###################
# PRETTY PRINTING #
###################
# A note about pretty printing: The result of a pretty-print shouldn't contain
# newlines or tab characters. It may contain spaces.
PRETTY_PRINT_E... | jfriedly/rethinkdb | drivers/python/rethinkdb/internal.py | Python | agpl-3.0 | 35,796 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import StringIO
from datetime import datetime
from flask import url_for
from udata.frontend import csv
from udata.models import Badge, Site, PUBLIC_SERVICE
from udata.core.dataset.factories import DatasetFactory, ResourceFactory
from udata.core.organi... | jphnoel/udata | udata/tests/site/test_site_views.py | Python | agpl-3.0 | 13,868 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/ns/nssimpleacl6.py | Python | apache-2.0 | 12,674 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-10-16 00:41
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('anagrafica', '0041_auto_2016051... | CroceRossaItaliana/jorvik | formazione/migrations/0015_invitocorsobase.py | Python | gpl-3.0 | 1,528 |
import copy
from django.db import models
from django.db.models.fields import NOT_PROVIDED
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict
from django.utils.translation import get_language
from django.utils.functional import laz... | mcallistersean/django-transmeta | transmeta/__init__.py | Python | lgpl-3.0 | 6,437 |
# encoding: utf-8
import copy
from yast import import_module
import_module('UI')
from yast import *
class Table8MultiSelClient:
def main(self):
new_items = [
Item(Id(1), "Mercedes", 60000),
Item(Id(2), "Audi", 50000),
Item(Id(3), "VW", 40000),
Item(Id(4), "BMW", 60000),
... | yast/yast-python-bindings | examples/Table8-multiSel.py | Python | gpl-2.0 | 2,914 |
import urllib2
import json
import os
from fantasydota.lib.herodict import herodict
from fantasydota.lib.calibration import calibrate_all_hero_values, squeeze_values_together
from fantasydota.lib.constants import API_URL, DEFAULT_LEAGUE
def create_league(name, tournament_id, url):
FE_APIKEY = os.environ.get("FE... | ThePianoDentist/fantasy-dota-heroes | fantasydota/scripts/create_league.py | Python | apache-2.0 | 3,546 |
# ----------------------------------------------------------------------------
# Copyright 2014 Nervana Systems 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.o... | jfsantos/neon | neon/models/model.py | Python | apache-2.0 | 11,462 |
import contextlib
import os
import sys
import tracemalloc
import unittest
from unittest.mock import patch
from test.support.script_helper import (assert_python_ok, assert_python_failure,
interpreter_requires_environment)
from test import support
try:
import _testcapi
except ... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/test/test_tracemalloc.py | Python | gpl-2.0 | 37,313 |
import logging; logger = logging.getLogger("morse." + __name__)
import socket
import select
import json
import morse.core.middleware
from functools import partial
from morse.core import services
class MorseSocketServ:
def __init__(self, port, component_name):
# List of socket clients
self._client_s... | Arkapravo/morse-0.6 | src/morse/middleware/socket_mw.py | Python | bsd-3-clause | 6,797 |
import datetime
import re
from fractions import Fraction
BUILD_VERSION = '1.0.0'
SQLALCHEMY_DATABASE_PASSWORD = ''
SQLALCHEMY_DATABASE_URI = ''
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_POOL_RECYCLE = 540
SMTP_SERVER = ''
SMTP_USERNAME = ''
SMTP_PASSWORD = ''
SMTP_PORT = ''
SMTP_ADDRESS = ''
ES_HOSTS = ['es1']... | giubil/trackit | api/files/api/config.py | Python | apache-2.0 | 4,470 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | examples/pipeline/data_transform/pipeline-data-transform-dense.py | Python | apache-2.0 | 2,334 |
import os, sys
if sys.platform == 'darwin':
# Setup sys.path so we can build and test a built version without
# installing in the system site-packages, which reqire root access.
builddir = [os.path.join('build', name) for name in os.listdir('build')
if name.startswith('lib.%s' % sys.platfor... | nirs/pyfribidi | syspath.py | Python | gpl-2.0 | 360 |
#########################################################################
# Copyright (c) 2017, NVIDIA CORPORATION. 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 c... | NVlabs/sassifi | scripts/parse_results.py | Python | bsd-3-clause | 16,150 |
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2013, 2016. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, WHE... | pgbidkar/vsphere-automation-sdk-python | samples/vsphere/common/ssl_helper.py | Python | mit | 1,311 |
# -*- coding: utf-8 -*-
from ..config import ARGS_ALWAYS
from .logger import logger
def init_cmd(args):
cmd = [args.executor_path, args.subcommand] \
+ ARGS_ALWAYS.get(args.subcommand, [])
logger.debug("patch_through_args: %s", args.patch_through_args)
for pt_arg in args.patch_through_args:
... | joernhees/userdocker | userdocker/helpers/cmd.py | Python | mit | 393 |
# This file is part of cldoc. cldoc 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 even the ... | jessevdk/cldoc | cldoc/nodes/cstruct.py | Python | gpl-2.0 | 1,548 |
import Numeric
import visual
class wiresphere:
def __init__(self,density):
self.density=density
self.stack_increment = Numeric.pi /(density+1)
self.slice_increment = Numeric.pi /density
def getstacks(self):
stackAngle = self.stack_increment
wireStack=[0]*self.density
for i in... | eeue56/PyGeo2 | pygeo/base/wiresphere.py | Python | gpl-2.0 | 1,555 |
from qgis.PyQt.QtGui import QIcon
from qgis.core import QgsProcessingProvider
from .carbon import TCSummary
from .utilities import GenerateMask, ClipRaster
class Provider(QgsProcessingProvider):
def loadAlgorithms(self, *args, **kwargs):
self.addAlgorithm(TCSummary())
self.addAlgorithm(GenerateM... | ConservationInternational/ldmp-qgis-plugin | LDMP/processing_provider/provider.py | Python | gpl-2.0 | 720 |
from web3.utils.functional import compose
def test_composition_no_functions():
fn = compose()
assert fn(5) == 5
def test_composition_single_function():
def fn(x):
return x * 2
assert compose(fn)(5) == 10
def test_composition_multiple_function():
def fn(x):
return x + 1
as... | shravan-shandilya/web3.py | tests/utilities/test_functional_tools.py | Python | mit | 353 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'plasmoggl_config.ui'
#
# Created: Sun Mar 8 19:52:06 2015
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
exce... | FedericoVaga/plasmoggl | contents/code/config/plasmoggl_configui.py | Python | gpl-3.0 | 3,332 |
# polynom.py - Find the roots of polynomials using the Aberth method
# Copyright (C) 2017 Shiva Iyer <shiva.iyer AT g m a i l DOT c o m>
#
# 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 ... | Shiva-Iyer/euler | solver/polynom.py | Python | gpl-3.0 | 3,210 |
#静态类
class Lang:
"""语言包配置
>>Demo:
from lang import Lang
print Lang.getLang("ErrorCode")
"""
@staticmethod
def getLang(name):
"""获取语言包配置属性,参数name:属性名"""
return Lang.__langconfig[name]
__langconfig = {
"ErrorCode": 10000,
"ErrorInfo": "系统繁忙"
... | wenhulove333/ScutServer | Sample/GameRanking/Server/src/GameRanking.Web/Script/PyScript/Lib/lang.py | Python | mit | 382 |
"""Natural numbers, modularly.
This is aspirational -- a lot of the features used below haven't been implemented yet.
"""
from .. import *
from . import boolean, opt, num
@component
def Nats():
case_rules(+t, +a) == {
zero : +a,
succ : +t > +a
}
@interface
def INat():
t ... | cyrus-/tydy | tydy/experimental/nats.py | Python | mit | 1,938 |
# Copyright 2015 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... | keras-team/keras | keras/optimizers/optimizer_v2/nadam_test.py | Python | apache-2.0 | 6,798 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.