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 |
|---|---|---|---|---|---|
#! /usr/bin/env python
# -*- coding: utf-8 -*-
sbox = [
[1, 1, 1, 0],
[0, 1, 0, 0],
[1, 1, 0, 1],
[0, 0, 0, 1],
[0, 0, 1, 0],
[1, 1, 1, 1],
[1, 0, 1, 1],
[1, 0, 0, 0],
[0, 0, 1, 1],
[1, 0, 1, 0],
[0, 1, 1, 0],
[1, 1, 0, 0],
[0, 1, 0, 1],
[1, 0, 0, 1],
[0, 0, 0, 0],
[0, 1, 1, 1],
]
invsbox = [
[1, 1... | archoad/PythonAES | miniaes.py | Python | gpl-3.0 | 7,116 |
#
# (c) 2016 Red Hat Inc.
#
# 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 d... | mheap/ansible | lib/ansible/plugins/action/eos.py | Python | gpl-3.0 | 5,886 |
from functools import wraps
from flask import request, redirect, session, url_for
from models.documents import User
def login():
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if 'username' not in session:
return redirect(url_for('base.login', next... | kailashbuki/predator | installed/webserver/views/access/requires.py | Python | mit | 890 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext = Extension("objs", sources = ["objs.py"])
setup(ext_modules = [ext], cmdclass = {'build_ext': build_ext})
| pedrohforli/InfoRectMaker | Setups/topyd.py | Python | gpl-2.0 | 228 |
"""Utilities for testing"""
import itertools
from gameanalysis import rsgame
def basic_games():
"""Small basic games for testing"""
yield rsgame.empty(1, 2)
yield rsgame.empty(2, 2)
yield rsgame.empty(2, 3)
yield rsgame.empty(3, 2)
yield rsgame.empty(3, 3)
yield rsgame.empty([2, 3], [3, 2... | egtaonline/GameAnalysis | test/utils.py | Python | apache-2.0 | 1,170 |
import pandas as pd
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from parsl.monitoring.web_app.app import app, get_db, close_db
from parsl.monitoring.web_app.utils import dropdown
from parsl.monitoring.web_app.apps import workflow_details, tasks_deta... | swift-lang/swift-e-lab | parsl/monitoring/web_app/apps/tabs.py | Python | apache-2.0 | 1,307 |
# _ __ _ _ ____________
# | '__| | | |_ /_ /_ /
# | | | |_| |/ / / / / /
# |_| \__,_/___/___/___|
#
__author__ = "Ruslan Zaporojets"
__email__ = "ruzzzua@gmail.com"
__license__ = "MIT"
__version__ = "1.0.0"
# Date: = "2016.10.28"
import os, sys
from difflib import SequenceMatcher
from Re... | Ruzzz/OneFileTools | script/cameyo_regdiff2.py | Python | mit | 2,779 |
# @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
from unittest import TestCase
from muntjac.data.util.indexed_container import IndexedContainer
from muntjac.data.util.hierarchical_container import HierarchicalContainer
class TestContainerSorting(TestCase):
_ITEM_DATA_MINUS2_NULL = 'Data -2 null'
_ITEM_DATA_MINUS2 ... | rwl/muntjac | muntjac/test/server/data/util/container_sorting_test.py | Python | apache-2.0 | 8,193 |
import frappe
def execute():
if frappe.db.exists("DocType", "Guardian"):
frappe.reload_doc("schools", "doctype", "student")
frappe.reload_doc("schools", "doctype", "student_guardian")
frappe.reload_doc("schools", "doctype", "student_sibling")
if "student" not in frappe.db.get_table_columns("Guardian"):
ret... | shreyasp/erpnext | erpnext/patches/v7_1/set_student_guardian.py | Python | gpl-3.0 | 572 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 07 22:00:12 2016
@author: ryandrewjones
"""
import unittest
import pandas as pd
import numpy as np
import numpy.testing as npt
from energyPATHWAYS import util
class TestDfOperation(unittest.TestCase):
# indicies to play with
GEOGRAPHIES = range(1, 10)
ENERG... | energyPATHWAYS/energyPATHWAYS | energyPATHWAYS/tests/test_df_operation.py | Python | mit | 6,085 |
# Copyright (c) 2018 PaddlePaddle 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 app... | luotao1/Paddle | python/paddle/fluid/tests/unittests/dygraph_to_static/test_ptb_lm_v2.py | Python | apache-2.0 | 11,601 |
# -*- coding: utf-8 -*-
from openerp import models, fields
class ProductTemplate(models.Model):
_inherit = "product.template"
analyzer_id = fields.Char(string='Analyzer ID' , related='product_variant_ids.product_tmpl_id.analyzer_id')
| ichi23de5/ichi_Repo | code_training/models/product.py | Python | gpl-3.0 | 245 |
import pandas as pd
from atmPy.aerosols.size_distribution import diameter_binning
from atmPy.aerosols.size_distribution import sizedistribution
from atmPy.data_archives.arm._netCDF import ArmDataset
class ArmDatasetSub(ArmDataset):
def __init__(self,*args, **kwargs):
self._data_period = 2700.
self... | hagne/atm-py | atmPy/data_archives/arm/file_io/products/_tdmasize.py | Python | mit | 2,013 |
#-*- coding:utf-8 -*-
from builtins import range
from functools import total_ordering
@total_ordering
class moduint(object):
def __init__(self, arg):
self.arg = int(arg) % self.__class__.limit
assert(self.arg >= 0 and self.arg < self.__class__.limit)
def __repr__(self):
return self._... | mrphrazer/miasm | miasm/expression/modint.py | Python | gpl-2.0 | 6,503 |
from hitchnode.node_service import NpmService
from hitchnode.node_package import NodePackage
from hitchnode.node_service import StaticNodeServer
UNIXPACKAGES = []
| hitchtest/hitchnode | hitchnode/__init__.py | Python | agpl-3.0 | 164 |
# 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 u... | dmlc/tvm | python/tvm/relay/transform/fake_quantization_to_integer.py | Python | apache-2.0 | 15,868 |
import pylab
import numpy
import ardustat_library_simple as ard
import time
import sys
from glob import glob
import os
def get_latest():
data_files = glob("*.dat")
high_time = 0
recent_file = "foo"
for d in data_files:
if os.path.getmtime(d) > high_time:
high_time = os.path.getmtime(d)
recent_file = d
re... | kjiang8/Ardustat | Deprecated_Unsupported/Python_Client/plot_cv.py | Python | bsd-2-clause | 1,246 |
"""engine.SCons.Tool.icc
Tool-specific initialization for the OS/2 icc compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2017 The SCons Foundation
#
# Permission is hereby gr... | mapycz/mapnik | scons/scons-local-3.0.1/SCons/Tool/icc.py | Python | lgpl-2.1 | 2,190 |
import os
DEBUG = True
SITE_ID = 1
APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ''))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
STATIC_URL = '/static/'
# STATIC_ROOT = os.path.join(APP_ROOT, '../app_static')
STATICFILE... | kitsunde/jack-bower | bower/tests/test_settings.py | Python | mit | 783 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | jairideout/q2-types | q2_types/feature_table/tests/test_type.py | Python | bsd-3-clause | 1,406 |
import sys
from ReadFile import ReadAdjacentList
from Degree import Degree
def MaximalNonBranchingPaths(graph):
paths = []
degree = Degree(graph)
visited = [] # stores all the visited 1-in-1-out nodes
for v in graph:
if degree[v][0] != 1 or degree[v][1] != 1: # if v is not a 1-in-1-out node... | Shenmolu/rosalind | MaximalNonBranchingPaths.py | Python | gpl-3.0 | 1,395 |
import add_code_to_python_process
print add_code_to_python_process.run_python_code(3736, "print(20)", connect_debugger_tracing=False) | dannyperry571/theapprentice | script.module.pydevd/lib/pydevd_attach_to_process/_check.py | Python | gpl-2.0 | 133 |
# This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2015 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See LICENSE.txt in the main project ... | jobsafran/mediadrop | mediadrop/model/tests/group_example_test.py | Python | gpl-3.0 | 1,298 |
#!/usr/bin/env python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
import argparse
import json
imp... | chromium/chromium | third_party/android_deps/libs/android_arch_lifecycle_livedata/3pp/fetch.py | Python | bsd-3-clause | 2,496 |
import logging
from django.db import migrations
from django.apps import apps
class CreateView(migrations.CreateModel):
def database_forwards(self, app_label, schema_editor, from_state, to_state):
fake_model = to_state.apps.get_model(app_label, self.name)
if not self.allow_migrate_model(
... | manuelnaranjo/django-database-view | dbview/helpers.py | Python | mit | 2,533 |
import glob
from datetime import datetime
import re
from operator import itemgetter
from netCDF4 import Dataset
import numpy
import click
from pyproj import Proj
import rasterio
from rasterio.crs import CRS
from rasterio.windows import get_data_window, union
from trefoil.cli import cli
from trefoil.netcdf.variable i... | consbio/clover | trefoil/cli/convert.py | Python | bsd-3-clause | 7,787 |
_is_init = 0
def init():
global list_cameras, Camera, colorspace, _is_init
import os,sys
use_opencv = False
use_vidcapture = False
use__camera = True
if sys.platform == 'win32':
use_vidcapture = True
elif "linux" in sys.platform:
use__camera = True
else:
... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pygame/camera.py | Python | gpl-2.0 | 2,738 |
import re
import pytest
from user_sync.certgen import *
from user_sync.error import AssertionException
@pytest.fixture()
def random_subject():
return get_subject_fields(randomize=True)
@pytest.fixture()
def key():
return create_key()
def test_get_subject_fields(random_subject):
assert len(random_sub... | adobe-apiplatform/user-sync.py | tests/test_certgen.py | Python | mit | 1,689 |
# -*- coding: cp1252 -*-
# This file is part of pyTSEB for estimating the resistances to momentum and heat transport
# Copyright 2016 Hector Nieto and contributors listed in the README.md file.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public... | bucricket/projectMAS | pydisalexi/resistances.py | Python | bsd-3-clause | 25,740 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014, 2015 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 optio... | jmartinm/invenio-workflows | invenio_workflows/__init__.py | Python | gpl-2.0 | 14,050 |
"""
Unit test script for mongodb 2.0 driver.
This script is designed to be run from engage.tests.test_drivers.
"""
# Id for the resource to be tested.
# An instance with this id must be present
# in the install script.
resource_id = "mongodb"
# The install script should be a json string
# containing a list which in... | quaddra/engage | python_pkg/engage/drivers/standard/mongodb__2_4/drivertest.py | Python | apache-2.0 | 1,962 |
from django.core.management.base import NoArgsCommand
from django.db import transaction
import os.path
import askbot
from askbot.search.postgresql import setup_full_text_search
class Command(NoArgsCommand):
@transaction.commit_on_success
def handle_noargs(self, **options):
script_path = os.path.join(
... | afdelgado/askbot | askbot/management/commands/init_postgresql_full_text_search.py | Python | gpl-3.0 | 597 |
import six
try:
from collections.abc import Iterable
except ImportError: # FIXME: Remove if Python2 support is removed
from collections import Iterable
def make_tuple(value):
""" Converts the value into a tuple if the value is an iterable with the following exceptions:
* a `None` value will retu... | conan-io/conan | conans/util/misc.py | Python | mit | 626 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/generic/static/tatooine/staticstorm.py | Python | lgpl-3.0 | 1,106 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import yandex_kassa.utils
def create_items(apps, schema_editor):
Item = apps.get_model('app', 'Item')
Item.objects.bulk_create([
Item(name='HTC Desire', price=5),
Item(name='iPhone 4', p... | VladimirFilonov/django-yandex-kassa | demo/app/migrations/0001_initial.py | Python | mit | 2,393 |
print "Find output of below algebraic expression"
print "a x b-c x d"
print "5 x 10 - 15 x 3"
print "5 * 10 = 50"
print "15 * 3 = 45"
print "50 - 45 = 5"
print "5 x 10 - 15 x 3 = ", 5 * 10 - 15 * 3
| mrniranjan/python-scripts | reboot/math8.py | Python | gpl-2.0 | 199 |
#!/usr/bin/python
import os
os.system('python runTrainer.py --agent=KerasDDPGAgent --env=Detached2DCartPolev0Env --train-for=0 --test-for=10000000 --delay=0.005 --gui --show-test --load-file=checkpoints/KerasDDPG-D2DCartPolev0-chkpt-1.h5')
| benelot/bullet-gym | bullet-gym-primitive/showKerasDDPGDetached2DCartPoleExample.py | Python | mit | 242 |
# -*- coding: utf-8 -*-
"""
Flask extensions instances, for access outside app.factory
"""
from flask_security import SQLAlchemyUserDatastore
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import MetaData, event
from sqlalchemy.engine import Engine
from sqlite3 import Connection as SQLite3Connection
from lib... | crossgovernmentservices/csd-notes | app/extensions.py | Python | mit | 1,087 |
from django.db import migrations
from django.contrib.postgres.operations import UnaccentExtension
# Adiciona a extensão UnaccentExtension para tratar pesquisas na API
# em strings que tenham acento
class Migration(migrations.Migration):
dependencies = [
]
operations = [
UnaccentExtension()
... | culturagovbr/sistema-nacional-cultura | apiv2/migrations/0001_initial.py | Python | agpl-3.0 | 322 |
import datetime
import os
from flask import Flask, g, request, render_template, redirect, url_for, abort
from sqlalchemy import and_
from sqlalchemy.orm.exc import NoResultFound
from webhelpers import paginate
from lib.messages import parse_line
from lib.model import Log, LogPage
from lib.requests import connect_mysql... | MSPARP/MSPARP | main.py | Python | mit | 3,649 |
namespace SeriesNamer
{
partial class UpdateTool
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <p... | madeso/prettygood | dotnet/SeriesNamer/UpdateTool.Designer.py | Python | mit | 4,446 |
import sys
import json
def create_new_json():
data = {
'wins': 0,
'loses': 0,
'winrate': 0,
'goals': 0,
'goalsOnYou': 0,
'wins1v1': 0,
'loses1v1': 0,
'winrate1v1': 0,
'wins2v2': 0,
'loses2v2': 0,... | Killmat/RLStatTracker | main.py | Python | lgpl-3.0 | 557 |
import sys
import re
import os
def processOBJ(path, npath):
f = open(path, 'r')
fo = open(npath, 'w')
for line in f:
vertex = "v -?\d\.\d+ -?\d\.\d+ -?\d\.\d+"
face = "f \d+ \d+ \d+$"
tri = "f \d+ \d+ \d+ \d+$"
line = re.sub(r'(?P<num>\d+)\/\d+', r'\1', line)
if... | kyleconroy/starfighter | processOBJ.py | Python | mit | 764 |
import numpy
from chainer import function_node
from chainer.utils import type_check
class Transpose(function_node.FunctionNode):
"""Permute the dimensions of an array."""
def __init__(self, axes=None):
self.axes = axes
def check_type_forward(self, in_types):
type_check.expect(in_types.s... | rezoo/chainer | chainer/functions/array/transpose.py | Python | mit | 2,002 |
'''
Python program to do number representation conversion:
1. from decimal integer to hexadecimal string
2. from hexadecimal string to decimal integer
'''
print("""Lab 03
From decimal to hexadecimal
---------------------------""")
# Get the decimal value
# Initialize an empty string
# Make one temporary variable for ... | giovanism/TarungLab | lab/03/lab03_f.py | Python | mit | 2,013 |
# 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 by applicable law or a... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/neural_gpu/program_utils.py | Python | bsd-2-clause | 13,451 |
'''Export MISP event to VirusTotal Graph.'''
import base64
import json
from vt_graph_parser.importers.pymisp_response import from_pymisp_response
misperrors = {
'error': 'Error'
}
moduleinfo = {
'version': '0.1',
'author': 'VirusTotal',
'description': 'Send event to VirusTotal Graph',
'module-ty... | MISP/misp-modules | misp_modules/modules/export_mod/vt_graph.py | Python | agpl-3.0 | 2,930 |
import pypyodbc
from group_plugin import GroupPlugin, Group
class ODBCGroupPlugin(GroupPlugin):
def __init__(self):
super(ODBCGroupPlugin, self).__init__()
self.connection_str = self.get_conf_option('connection_str')
self.groups_sql = self.get_conf_option('groups_sql')
self.change... | stillinsecure/acl_audit | plugins/odbc_group_plugin.py | Python | mit | 1,239 |
#ChipBag.py
#Implements a container for chips
#Created by: Andrew Davis
#Created on: 1/9/2016
#Open source (MIT license)
#import statements
from Chip import *
#class definition
class ChipBag(object):
#constructor
def __init__(self, init_value):
self.__chips = [] #the array that stores the chips
... | techgineer/casino-sim | src/ChipBag.py | Python | mit | 4,560 |
a = int(input())
b = int(input())
s = 0
c = 0
for step in range (a,b+1):
if step % 3 == 0:
s = s+step #42
c = c+1
step+=1
print(s / c)
| maisilex/Lets-Begin-Python | forAB.py | Python | mit | 159 |
# -*- coding: utf-8 -*-
# (C) 2015 Muthiah Annamalai
#
# This file is part of 'open-tamil' package tests
#
from __future__ import print_function
from opentamiltests import *
from solthiruthi.suggestions import norvig_suggestor
class WordsSuggestor(unittest.TestCase):
def test_Norvig_suggestor(self):
wor... | Ezhil-Language-Foundation/open-tamil | tests/word_suggestor.py | Python | mit | 628 |
import os
from peewee import MySQLDatabase, Model, CharField, ForeignKeyField, DateTimeField, TextField, PrimaryKeyField
db = MySQLDatabase(os.environ.get('DB_NAME'), user=os.environ.get('DB_USERNAME'), password=os.environ.get('DB_PASSWORD'),
host=os.environ.get('DB_HOST'))
class BaseModel(Model... | arundhaj/prod-api | chalicelib/models.py | Python | mit | 1,912 |
from . import constants
class RestUpError(Exception):
pass
class HttpError(RestUpError):
status = constants.ERROR
msg = "Application Error."
def __init__(self, msg=None):
if not msg:
msg = self.__class__.msg
super(HttpError, self).__init__(msg)
class BadRequest(HttpE... | FFX01/django-restup | restup/exceptions.py | Python | bsd-2-clause | 862 |
# -*- coding: utf-8 -*-
#
# Copyright 2014 - 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 requir... | dmitryilyin/mistral | mistral/actions/action_factory.py | Python | apache-2.0 | 4,643 |
# 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 u... | mufaddalq/cloudstack-datera-driver | test/integration/smoke/test_global_settings.py | Python | apache-2.0 | 3,382 |
import os
from autotest.client import utils
from autotest.client.shared import error
def run_unittest_kvmctl(test, params, env):
"""
This is kvm userspace unit test, use kvm test harness kvmctl load binary
test case file to test various functions of the kvm kernel module.
The output of all unit tests ... | ehabkost/virt-test | qemu/tests/unittest_kvmctl.py | Python | gpl-2.0 | 1,048 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2... | alxgu/ansible | test/units/modules/network/f5/test_bigip_gtm_monitor_tcp.py | Python | gpl-3.0 | 6,969 |
#
# Copyright 2015-2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | nirs/vdsm | lib/vdsm/taskset.py | Python | gpl-2.0 | 3,779 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('comercial', '0007_auto_20141006_1852'),
]
operations = [
migrations.AlterField(
model_name='contratofechado',
... | dudanogueira/microerp | microerp/comercial/migrations/0008_auto_20141023_1202.py | Python | lgpl-3.0 | 495 |
#!/usr/bin/env python
# Copyright (c) 2007 ActiveState Software Inc.
"""The doit test suite entry point."""
import os
from os.path import dirname, abspath
import sys
import logging
import testlib
testdir_from_ns = {
None: os.curdir,
}
def setup():
sys.path.insert(0, dirname(dirname(abspath(__file__))))
i... | ActiveState/mk | test/test.py | Python | mit | 477 |
from .client import Client, HTTPError
from .publisher import Publisher, DebugPublisher
| RealGeeks/lead_router.py | leadrouter/__init__.py | Python | mit | 88 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_records = frappe.get_test_records('POS Setting')
class TestPOSSetting(unittest.TestCase):
pass
| gangadhar-kadam/verve_erp | erpnext/accounts/doctype/pos_setting/test_pos_setting.py | Python | agpl-3.0 | 278 |
## Copyright (C) 2017 Oscar Diaz Barriga
## This file is part of Comp-Process-STPatterns.
## 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 op... | oscardbpucp/Comp-Process-STPatterns | clean_and_pretreatment/datos_total_fase1v3-mod.py | Python | gpl-3.0 | 13,307 |
def GravarRegistro(prmCodigo,prmNome,prmValor):
ponteiro = open('BancoDados.db','a')
ponteiro.write(prmCodigo+'|'+prmNome+'|'+prmValor+'\n')
ponteiro.close()
return | ronas/PythonGNF | Artur/bancodadoslib.py | Python | gpl-3.0 | 195 |
"""Student API tests."""
from rest_framework import status
from profiles.factory import StudentFactory
from profiles.serializers import StudentSerializer
from tests.utils.api import HyperlinkedAPITestCase
class StudentEndpointsTest(HyperlinkedAPITestCase):
"""Test access to the students endpoints."""
factor... | oser-cs/oser-website | tests/test_profiles/test_student_api.py | Python | gpl-3.0 | 989 |
'''
Created by auto_sdk on 2014-12-17 17:22:51
'''
from top.api.base import RestApi
class HotelSoldOrdersIncrementGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.end_modified = None
self.need_guest = None
self.need_message = None
... | CooperLuan/devops.notes | taobao/top/api/rest/HotelSoldOrdersIncrementGetRequest.py | Python | mit | 523 |
#!/usr/bin/env python
# Dogtail demo script
from dogtail.config import config
#config.debugSleep = True
#config.debugSearching = True
#config.debugTranslation = True
import dogtail.tc
from dogtail.procedural import *
from dogtail.utils import screenshot
from dogtail.predicate import GenericPredicate
# These next two... | vrutkovs/dogtail | examples/gedit-test-utf8-procedural-api.py | Python | gpl-2.0 | 3,778 |
import pytest
from fibo import fib
def test_fib_ok_small():
assert fib(0) == 0
assert fib(1) == 1
assert fib(2) == 1
assert fib(3) == 2
def test_fib_raise_if_string():
with pytest.raises(TypeError):
fib("a")
fib("1")
def test_fib_raises_lt_zero():
with pytest.raises(ValueE... | feroda/lessons-python4beginners | src/fib/test_fib.py | Python | agpl-3.0 | 343 |
#!/usr/bin/env python3
# -*- 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | google/google-ctf | 2021/quals/rev-polymorph/healthcheck/healthcheck.py | Python | apache-2.0 | 1,149 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_11_01/aio/operations/_nat_gateways_operations.py | Python | mit | 26,847 |
#!/usr/bin/env python
traindat = '../data/fm_train_real.dat'
testdat = '../data/fm_test_real.dat'
parameter_list = [[traindat,testdat],[traindat,testdat]]
def distance_normsquared (train_fname=traindat,test_fname=testdat):
from shogun import RealFeatures, EuclideanDistance, CSVFile
feats_train=RealFeatures(CSVFile... | MikeLing/shogun | examples/undocumented/python/distance_normsquared.py | Python | gpl-3.0 | 737 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: Brian Cherinka, José Sánchez-Gallego, and Brett Andrews
# @Date: 2018-07-24
# @Filename: test_rss.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
#
# @Last modified by: José Sánchez-Gallego (gallegoj@uw.edu)
# @Last modified time: ... | sdss/marvin | tests/tools/test_rss.py | Python | bsd-3-clause | 8,275 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 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 ... | nkalodimas/invenio | modules/miscutil/lib/textutils.py | Python | gpl-2.0 | 27,512 |
"""Copyright 2008 Orbitz WorldWide
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, software... | obfuscurity/graphite-web | webapp/graphite/whitelist/views.py | Python | apache-2.0 | 1,997 |
# 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... | pavelchristof/gomoku-ai | tensorflow/contrib/keras/python/keras/layers/wrappers.py | Python | apache-2.0 | 14,145 |
from datetime import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from djblets.util.db import ConcurrencyManager
from reviewboard.reviews.models import Group, ReviewRequest
class ReviewRequestVisit(models.Model):
"""
... | asutherland/opc-reviewboard | reviewboard/accounts/models.py | Python | mit | 3,945 |
import argparse
from pokersim.Table import Table
from pokersim.Player import Player
from pokersim.Recorder import Recorder
rec = Recorder()
parser = argparse.ArgumentParser(description='Set up a poker game')
#parser.add_argument('-n', '--numplayers', type=int, nargs='?', default=10, help='Number of players')
parser... | adamlincoln/pokersim | src/pokersim/__init__.py | Python | gpl-3.0 | 1,480 |
'''
A logistic regression learning algorithm example using TensorFlow library.
This example is using the MNIST database of handwritten digits
(http://yann.lecun.com/exdb/mnist/)
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
from __future__ import print_function
import tens... | trhongbinwang/data_science_journey | deep_learning/tensorflow/tutorials/tutorial3/examples/2_BasicModels/logistic_regression.py | Python | apache-2.0 | 3,004 |
"""
Message Queue wrapper
"""
__RCSID__ = "$Id$"
from DIRAC.FrameworkSystem.private.standardLogging.Handler.MessageQueueHandler import MessageQueueHandler
from DIRAC.Resources.LogBackends.AbstractBackend import AbstractBackend
from DIRAC.FrameworkSystem.private.standardLogging.Formatter.JsonFormatter import JsonForma... | arrabito/DIRAC | Resources/LogBackends/MessageQueueBackend.py | Python | gpl-3.0 | 1,639 |
# Copyright (c) MetaCommunications, Inc. 2003-2007
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import xml.sax.saxutils
import zipfile
import ftplib
import time
import stat
import xml.dom.minidom
import xml... | scs/uclinux | lib/boost/boost_1_38_0/tools/regression/src/collect_and_upload_logs.py | Python | gpl-2.0 | 17,570 |
from gensim import models
with open("D:\\Kuangyichen\\PythonRepository\\MedicineSCI\\d2017.bin", "r") as readMH:
w =open('C:\\Users\\xmu\\Desktop\\MH.txt','w')
MH_List = []
cor1 = set()
for line in readMH:
term = str(line).strip().split(" = ")
if term[0] == "MH":
cor1.add(te... | EachenKuang/PythonRepository | MedicineSCI/Tools/getMH.py | Python | apache-2.0 | 1,560 |
#!/usr/bin/env python
from road import Road
import time
# impacts default behavior for most states
SPEED_LIMIT = 10
# all traffic in lane (besides ego) follow these speeds
LANE_SPEEDS = [6,7,8,9]
# LANE_SPEEDS = [5,6,7,8]
# Number of available "cells" which should have traffic
TRA... | mlandry1/CarND | Labs/Term3/Lesson 4 - 16/python3/CarND - Behavior Planner/simulate_behavior.py | Python | mit | 1,446 |
#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as AppIndicator
import signal
## Gtk
## https://lazka.github.io/pgi-docs/index.html#Gtk-3.0
## https://lazka.github.io/pgi-docs/index.ht... | foreachsam/book-lang-python | example/subject/gtk/appindicator/composite/demo-daemon/main.py | Python | mit | 4,595 |
import pymorphy2
def mrph(lemmas):
"""
Guesses lemmas for unknown words, using pymorphy analyzer, returns list of lemmas.
"""
morph = pymorphy2.MorphAnalyzer()
lemma = []
for elem in lemmas:
tag_token = morph.parse(elem)[0].normal_form
lem = [tag_token]
lemma... | azilya/Zaliznyak-s-grammatical-dictionary | gdictionary/morph.py | Python | lgpl-3.0 | 350 |
# FusionPBX Plugin for the Media Server api
import psycopg2
import psycopg2.extras
import json
import uuid
# Defining a dialplan object, which allows you to define how the
# dialplan within a domain behaves
class cos_dialplan():
name = None
dialplan_xml = None
def __init__(self):
self.dialplan_x... | dOpensource/dsiprouter | gui/modules/api/mediaserver/plugin/fusion/interface.py | Python | apache-2.0 | 15,668 |
from django import template
from django.template import Library, Node
from django.core.urlresolvers import reverse
from reporting import site
register = Library()
class ReportUrlNode(template.Node):
report_path = None
def __init__(self, report_path):
self.report_path = template.Variable(report_path)... | marcydoty/geraldo | reporting/templatetags/reporting_tags.py | Python | lgpl-3.0 | 957 |
# -*- coding: utf-8 -*-
"""
Magic Reload Library
Luke Campagnola 2010
Python reload function that actually works (the way you expect it to)
- No re-importing necessary
- Modules can be reloaded in any order
- Replaces functions and methods with their updated code
- Changes instances to use updated classes
- Aut... | andrewpaulreeves/soapy | soapy/pyqtgraph/reload.py | Python | gpl-3.0 | 16,989 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-08-04 20:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend_citizen', '0006_profile_is_organization'),
]
operations = [
migratio... | ciudadanointeligente/votainteligente-portal-electoral | backend_citizen/migrations/0007_profile_is_journalist.py | Python | gpl-3.0 | 472 |
from django.conf.urls import include, url
from django.views.generic.base import RedirectView
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
from . import views
from projects.views import screenshot, upload, diff, diffPage, tease
urlpatterns = [
url(r'^$', teas... | deckar01/narcis | narcis/urls.py | Python | mit | 952 |
# Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | prodromou87/gem5 | tests/configs/realview-simple-atomic-dual.py | Python | bsd-3-clause | 2,345 |
# ################################################################################
# ##
# ## https://github.com/NetASM/NetASM-python
# ##
# ## File:
# ## __init__.py
# ##
# ## Project:
# ## NetASM: A Network Assembly Language for Programmable Dataplanes
# ##
# ## Author:
# ## Muhammad Shahbaz
#... | 8l/NetASM-python | netasm/examples/controllers/pox/__init__.py | Python | gpl-2.0 | 1,280 |
import json
from idpproxy.social.oauth import OAuth
import oauth2 as oauth
#from xml.etree import ElementTree as ET
import logging
logger = logging.getLogger(__name__)
__author__ = 'rohe0002'
class LinkedIn(OAuth):
def __init__(self, client_id, client_secret, **kwargs):
OAuth.__init__(self, client_id, cli... | rohe/IdPproxy | src/idpproxy/social/linkedin/__init__.py | Python | bsd-2-clause | 1,002 |
#!/usr/bin/env python
from gimpfu import *
import random
# create an output function that redirects to gimp's Error Console
def gprint(text):
pdb.gimp_message(text)
return
# our script
def origami_fill(image, drawable, text_value, int_value) :
image.undo_group_start()
# Determine colors from imag... | shetharp/Origami-Fill | origamifill.py | Python | mit | 9,519 |
"""
Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>
Dr. Nathalie.bartoli <nathalie@onera.fr>
This package is distributed under New BSD license.
TO DO:
- define outputs['sol'] = self.sol
"""
import numpy as np
from sklearn import linear_model
from smt.surrogate_models.surrogate_model import Surrog... | SMTorg/smt | smt/surrogate_models/ls.py | Python | bsd-3-clause | 2,766 |
from optparse import OptionParser
import pandas
# import matplotlib.pyplot as plt
from simulate import simulate
parser = OptionParser()
parser.add_option("--max-d", type="int", default=4)
options, _ = parser.parse_args()
res = pandas.DataFrame()
for d in range(1, options.max_d + 1):
print "\n\nd=", d, "\n"
df... | aravart/speech-games | theory/exp_prob_found.py | Python | mit | 565 |
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from django.template.loader import render_to_string
from tinymce import models as tinymce_models
from getyourdata.models import BaseModel
class HomePageManager(models.Manager):
def create_default(self):
... | sakset/getyourdata | getyourdata/home/models.py | Python | mit | 1,332 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_simple09.py | Python | bsd-2-clause | 1,048 |
import phantom.rules as phantom
import json
#
# F5 firewall
#
# Copyright (c) 2016 World Wide Technology, Inc.
# All rights reserved.
#
# author: Joel W. King, World Wide Technology
#
# revisions:
# 16 June 2016 | Changes to parameters, create rule name base on the source IP
#
def blo... | joelwking/Phantom-Cyber | f5_firewall/f5_firewall_playbook.py | Python | mit | 1,240 |
# -*- coding: utf-8 -*-
from . import communication, account_invoice, account
| linkitspa/l10n-italy | l10n_it_invoices_data_communication/models/__init__.py | Python | agpl-3.0 | 79 |
#!/usr/bin/env python
"""encode/decode base58 in the same way that Bitcoin does"""
import hashlib
import math
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)
getNewRIPEMD160 = None
getNewSHA256 = None
def b58encode(v):
""" encode v, which is a string of bytes... | Unthinkingbit/bitcointools | base58.py | Python | mit | 3,506 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.