code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright (c) 2009-2010 Arista Networks, Inc. - James Lingard
# Copyright (c) 2004-2013 LOGILAB S.A. (Paris, FRANCE).
# Copyright 2012 Google Inc.
#
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Publ... | hkupty/python-mode | pymode/libs/pylama/lint/pylama_pylint/pylint/checkers/strings.py | Python | lgpl-3.0 | 13,864 |
# -*- coding: utf-8 -*-
r"""
===============================================================================
Submodule -- vapor_pressure
===============================================================================
Methods for predicing the vapor pressure of pure species
"""
import scipy as sp
def antoine(phase, ... | amdouglas/OpenPNM | OpenPNM/Phases/models/vapor_pressure.py | Python | mit | 2,624 |
#!/usr/bin/env python3
import os
import sys
from typing import Dict, List
from common.basedir import BASEDIR
# messages reserved for CAN based ignition (see can_ignition_hook function in panda/board/drivers/can)
# (addr, len)
CAN_IGNITION_MSGS = {
'gm': [(0x1F1, 8), (0x160, 5)],
#'tesla' : [(0x348, 8)],
}
def _g... | commaai/openpilot | selfdrive/test/test_fingerprints.py | Python | mit | 3,216 |
#!/usr/bin/env python
"""Handle records from /proc/self/stack data files"""
import regentest as RG
import ProcHandlers as PH
PFC = PH.ProcFieldConstants
# ---
def re_self_stack(inprecs):
"""Iterate through parsed records and re-generate data file"""
__template = "[<{addr:016x}>] {entry:s}"
for __hil... | cnamejj/PyProc | regentest/self_stack.py | Python | gpl-2.0 | 619 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2015 Bart de Waal <bart@waalamo.com>
##
## 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 Lic... | Entropy512/libsigrokdecode | decoders/modbus/pd.py | Python | gpl-3.0 | 37,104 |
#!/usr/bin/env python
from deter import topdl
subs = [ ]
elems = [ ]
for i in range(0,2):
print i
subs.append(topdl.Substrate(name='link'+str(i)))
print subs
clients = ('client1','client2')
for index,elem_name in enumerate(clients):
inf = topdl.Interface(name='inf000', substrate=['link'+str(index)])
elem... | deter-project/magi | atscale/Containerization/exp1.py | Python | gpl-2.0 | 1,474 |
from __future__ import absolute_import
from .webhooks import WebHooksTestCase, GitlabWebHooksTestCase
from .gitlab import GitlabTestCase
from .util import UtilTestCase
from .redis import RedisModelTestCase
| pipex/gitbot | tests/__init__.py | Python | apache-2.0 | 207 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', 'flag=ceph'],
[TestAction.create_volume, 'volume1', 'flag=ceph,scsi'],
[TestAction.attach_volume, 'vm1... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/xc_path47.py | Python | apache-2.0 | 1,580 |
def str_repr_demos():
from fractions import Fraction
half = Fraction(1, 2)
half
print(half)
str(half)
repr(half)
s = 'hello world'
str(s)
repr(s)
"'hello world'"
repr(repr(repr(s)))
eval(eval(eval(repr(repr(repr(s))))))
# Errors: eval('hello world')
# Implementing g... | tavaresdong/courses-notes | ucb_cs61A/lectures/16.py | Python | mit | 2,731 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListPhoneNumbers
# Returns a list of Twilio phone numbers purchased from Twilio or ported to Twilio.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Versi... | jordanemedlock/psychtruths | temboo/core/Library/Twilio/IncomingPhoneNumbers/ListPhoneNumbers.py | Python | apache-2.0 | 5,238 |
#!/bin/env python
# -*- coding: utf-8; -*-
#
# (c) 2016 FABtotum, http://www.fabtotum.com
#
# This file is part of FABUI.
#
# FABUI 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 Licen... | FABtotum/colibri-fabui | fabui/ext/py/fabtotum/fabui/macros/general.py | Python | gpl-2.0 | 8,809 |
#!/usr/bin/python
# 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 distributed... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/amazon/ecs_ecr.py | Python | bsd-3-clause | 11,534 |
from nltk.corpus import stopwords
import nltk, string
__author__ = 'Jasneet Sabharwal'
def pre_process(phrase):
#phrase = phrase.lower()
#phrase = phrase.translate(None, string.punctuation)
tokens = nltk.word_tokenize(phrase)
#clean_tokens = [token for token in tokens if not token in stopwords.words(... | KonceptGeek/KaggleSentimentAnalysis | src/preprocessing/preProcess.py | Python | gpl-2.0 | 359 |
from taichi._lib import core
class TaichiCompilationError(Exception):
"""Base class for all compilation exceptions.
"""
pass
class TaichiSyntaxError(TaichiCompilationError, SyntaxError):
"""Thrown when a syntax error is found during compilation.
"""
pass
class TaichiNameError(TaichiCompila... | yuanming-hu/taichi | python/taichi/lang/exception.py | Python | mit | 1,345 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Andrew Dunham <andrew@du.nham.ca>
# (c) 2013, Daniel Jaouen <dcj24@cornell.edu>
#
# Based on macports (Jimmy Tang <jcftang@gmail.com>)
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | mattbernst/polyhartree | support/ansible/modules/extras/packaging/os/homebrew.py | Python | gpl-3.0 | 26,616 |
#
# DBus interface for DNF payload.
#
# Copyright (C) 2019 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is dist... | jkonecny12/anaconda | pyanaconda/modules/payloads/payload/dnf/dnf_interface.py | Python | gpl-2.0 | 3,918 |
# Copyright 2011 OpenStack LLC.
# Copyright 2011 Justin Santa Barbara
# 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/license... | NetApp/manila | manila/api/extensions.py | Python | apache-2.0 | 12,101 |
from __future__ import unicode_literals
from django.db import models
class Company(models.Model):
user = models.ForeignKey('accounts.User',
related_name='companies')
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class Location(model... | dook/coworkok | cowork/models.py | Python | gpl-3.0 | 1,209 |
#-*- coding: utf-8 -*-
from database_email_backend.fields import Base64Field
from django.db import models
class Email(models.Model):
sent_at = models.DateTimeField(auto_now_add=True)
from_email = models.CharField(blank=True, default='', max_length=255)
to_emails = models.TextField(blank=True, default='')
... | jbinary/django-database-email-backend | database_email_backend/models.py | Python | mit | 1,478 |
import pytest
import queue
from iotile_transport_awsiot.mqtt_client import OrderedAWSIOTClient
import time
pytestmark = pytest.mark.skip("This distribution needs to be updated to work with asyncio gateway")
def test_gateway(gateway, local_broker, args):
"""Make sure we can connect to the gateway by sending pack... | iotile/coretools | transport_plugins/awsiot/test/test_agent.py | Python | gpl-3.0 | 5,635 |
import threading
import time
class ThreadSkeleton(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
print('a new thread---')
thread=ThreadSkeleton()
thread.start()
#time.sleep(2)
print ('hello,thread---')
| hushupei/PyCode | thread2.py | Python | gpl-3.0 | 247 |
#coding:utf-8
'''
Timeouts超时设置
requests.get('http://github.com', timeout=2)
'''
| qiyeboy/SpiderBook | ch03/3.2.3.7.py | Python | mit | 91 |
"""
This is the default template for our main set of AWS servers. This does NOT
cover the content machines, which use content.py
Common traits:
* Use memcached, and cache-backed sessions
* Use a MySQL 5.1 database
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables fro... | DefyVentures/edx-platform | lms/envs/aws.py | Python | agpl-3.0 | 27,732 |
from itertools import combinations
from math import pi, acos, hypot
def dist(a, b):
return hypot(a[0]-b[0], a[1]-b[1])
def area(r):
return pi*r**2
def checkio(data):
blackHoles = [list(bh) for bh in data]
while 1:
for bh in sorted(combinations(blackHoles, 2), key=lambda c: dist(*c)):
... | Pouf/CodingCompetition | CiO/black-holes.py | Python | mit | 1,087 |
#!/usr/bin/env python
import sys
for _ in range(101):
print "P\n."
sys.stdout.flush() | ethercrow/ai-challenger | game-rps/paper.py | Python | mit | 95 |
from flask import request, render_template
from ..models import picture_list
from flask.ext.login import current_user
def gallery():
return render_template('gallery.html', active_page='gallery',pictures=picture_list) | PhoenixRacing/PhoenixRacingWebApp-noregrets | application/controllers/gallery.py | Python | bsd-3-clause | 218 |
# Copyright 2022 The Flax Authors.
#
# 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 wri... | google/flax | flax/optim/base.py | Python | apache-2.0 | 20,558 |
# Django settings for seamless project.
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'data... | Phaiax/openscad-seamlesslib-server | src/seamless/settings.py | Python | gpl-2.0 | 5,710 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2014, Mario Vilas
# 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 ... | icchy/tracecorn | unitracer/lib/windows/amd64/context_amd64.py | Python | mit | 21,234 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################################################
# Previous silva handling code that served as a basis for this code was written by JAR and
# Jessica Grant as a part of the reference_taxonomy and OToL efforts.
from __futu... | mtholder/taxalotl | taxalotl/parsing/silva.py | Python | bsd-2-clause | 9,865 |
from dolfin import *
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
import CheckPetsc4py as CP
import splitCG as cg
n = 2**4
mesh = UnitSquareMesh(n,n)
V = FunctionSpace(mesh,"CG",1)
u = TestFunction(V)
v = TrialFunction(V)
A = assemble(inner(grad(u),grad(v))*dx)
M = assemble(inner... | wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitCG/test.py | Python | mit | 1,007 |
from FireGirlPathway import *
#create new Pathway, id=0, default policy, default as FireGirlPathway
ls = FireGirlPathway(0)
ls.generateNewPathway()
print '{0:6} {1:12} {2:12} {3:12} {4:12} {5:12} {6:12}'.format(
'Year', 'Choice', 'Cells Brnd', 'Timb Loss', 'Sup. Cost', 'Harvest Totl', 'Growth Totl')
... | smcgregor/gravity | test_script_pathway_models.py | Python | mpl-2.0 | 976 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2019 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""File serving helpers for Files REST API."""
import mimetypes
import hashlib
impo... | inveniosoftware/invenio-files-rest | invenio_files_rest/helpers.py | Python | mit | 10,805 |
from django.test import TestCase
from mock import patch
from news.backends.common import NewsletterException
from news.models import Newsletter
from news.tasks import confirm_user, mogrify_message_id, send_message
class TestSendMessage(TestCase):
@patch('news.tasks.ExactTarget')
def test_caching_bad_message... | pmclanahan/basket | news/tests/test_send_welcomes.py | Python | mpl-2.0 | 8,291 |
# Copyright (c) 2021 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 ap... | luotao1/Paddle | python/paddle/fluid/memory_analysis.py | Python | apache-2.0 | 2,753 |
#!/usr/bin/env python
#
# Copyright 2017 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | opencord/voltha | netconf/nc_rpc/base/lock.py | Python | apache-2.0 | 1,327 |
# this example uses a csv file with the datas for the classification
# we retreive the sample from the file sample.csv
path = os.path.abspath(os.path.dirname(__file__))
dataInOut = Sample().ImportFromCSVFile(path + "/sample.csv")
# we create dataIn and dataOut
dataIn = Sample(861, 2)
dataOut = Sample(861, 1)
# we bui... | openturns/otsvm | python/test/t_example2.py | Python | lgpl-3.0 | 1,095 |
import pytest
from click.testing import CliRunner
from coolcommands import cli
@pytest.fixture
def runner():
return CliRunner()
def test_cli(runner):
result = runner.invoke(cli.main)
assert result.exit_code == 0
assert not result.exception
assert result.output.strip() == 'Hello, world.'
def te... | bradleybossard/cool-cli-tool | tests/test_cli.py | Python | apache-2.0 | 721 |
from __future__ import unicode_literals
import frappe
from frappe.utils.verified_command import verify_request
from frappe.email.doctype.newsletter.newsletter import confirmed_unsubscribe
no_cache = True
def get_context(context):
frappe.flags.ignore_permissions = True
# Called for confirmation.
if "email" in frapp... | vjFaLk/frappe | frappe/www/unsubscribe.py | Python | mit | 1,462 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# al... | plumps/google-python-exercises | basic/list2.py | Python | apache-2.0 | 2,165 |
"""Unit tests for the Paver server tasks."""
import ddt
from paver.easy import call_task
from .utils import PaverTestCase
EXPECTED_COFFEE_COMMAND = (
u"node_modules/.bin/coffee --compile `find {platform_root}/lms "
u"{platform_root}/cms {platform_root}/common -type f -name \"*.coffee\"`"
)
EXPECTED_SASS_COMM... | devs1991/test_edx_docmode | pavelib/paver_tests/test_servers.py | Python | agpl-3.0 | 11,855 |
import sys
import os
import traceback
from django import db
sys.path.append('/root/wisely/wisely_project/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'wisely_project.settings.production'
from django.db.models import F, Q
from django.utils import timezone
from users.tasks import get_coursera_courses, get_edx_courses, ge... | TejasM/wisely | wisely_project/get_courses_file.py | Python | mit | 1,721 |
__author__ = 'Yuvv'
class MyRect(object):
"""my rect object, which sames as pygame.rect.Rect,
but its value is float.
"""
def __init__(self, x, y, w, h):
self.x = x
self.y = y
self.w = w
self.h = h
@property
def top(self):
return self.y
@property
... | Yuvv/LearnTestDemoTempMini | py-pygame/Plain/util.py | Python | mit | 987 |
"""Test suite for module pyntrest_pil"""
from PIL import Image
from os import path, remove
import unittest
from pyntrest.pyntrest_pil import PILHandler
class PilTestSuite(unittest.TestCase):
base_path = path.abspath(path.dirname(__file__))
def test_rescale_image_dimensions_to_desired_... | BastiTee/pyntrest | pyntrest_tests/test_pyntrest_pil.py | Python | gpl-3.0 | 4,056 |
"""
This package a pyqt distutils hook to replace PyQt5 by our own (
qregexeditor.qt).
"""
def fix_qt_imports(path):
with open(path, 'r') as f_script:
lines = f_script.read().splitlines()
new_lines = []
for l in lines:
if l.startswith("import "):
l = "from . " + l
if "f... | ColinDuquesnoy/QRegexEditor | qregexeditor/_hooks.py | Python | mit | 533 |
# Copyright (c) 2014 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 law or agreed to ... | swiftstack/swift3-stackforge | swift3/test/unit/test_obj.py | Python | apache-2.0 | 47,051 |
import sys
from argparse import ArgumentParser
from typing import IO, Any
import orjson
from django.core.management.base import BaseCommand
from zerver.lib.queue import queue_json_publish
def error(*args: Any) -> None:
raise Exception('We cannot enqueue because settings.USING_RABBITMQ is False.')
class Command... | brainwane/zulip | zerver/management/commands/enqueue_file.py | Python | apache-2.0 | 1,916 |
#! /usr/bin/env python
from __future__ import print_function, division
import os
import sys
import pandas as pd
time_split = 786239 - 10 * 7 * 24 * 60 # use last 10 weeks for validation
# split up grid by making horizontal slices
num_slices = 32
slice_height = 10.0 / num_slices + 1e-6
slice_overlap = 0.1
def gen... | mkliegl/kaggle-Facebook-V | create_slices.py | Python | mit | 2,280 |
import time
from datetime import datetime, date
from dateutil.parser import parse as dateFromString
__all__ = ['todate',
'date2timestamp',
'timestamp2date',
'yyyymmdd2date',
'date2yyyymmdd',
'juldate2date',
'date2juldate',
'dateFromString',... | artisavotins/ccy | ccy/dates/converters.py | Python | bsd-3-clause | 3,457 |
pa<caret>th | siosio/intellij-community | python/testData/completion/className/orderingLocalBeforeStdlib/orderingLocalBeforeStdlib.py | Python | apache-2.0 | 11 |
import heapq
class StreamMedian(object):
"""mediana unui sir de numere"""
def __init__(self):
self.minHeap, self.maxHeap = [], []
self.N = 0
def insert(self, num):
if self.N % 2 == 0:
heapq.heappush(self.maxHeap, -1*num)
self.N += 1
if len(self.minHeap) == 0:
return
if -1 * self.maxHeap[0] > ... | kitz99/misc | some_algorithms/StreamMedian/mediana_nou.py | Python | mit | 908 |
# Django & Python
from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.http import QueryDict
from django.test import TestCase
from django.test import Client
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.contrib... | AcademicsToday/py-academicstoday | academicstoday_project/teacher/tests/test_assignment.py | Python | apache-2.0 | 26,573 |
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | harry-7/Plinth | plinth/modules/transmission/__init__.py | Python | agpl-3.0 | 3,811 |
# -*- coding: utf-8 -*-
import asyncio
import os
import ssl
import slixmpp
from slixmpp.xmlstream.handler import Callback
from slixmpp.xmlstream.matcher import MatchXPath
from ..base.chat_bot import ChatBot
class XMPP(ChatBot):
__name__ = "XMPP"
__type__ = "addon"
__version__ = "0.23"
__status__ = ... | vuolter/pyload | src/pyload/plugins/addons/XMPP.py | Python | agpl-3.0 | 9,928 |
##########################################
# WftpdExpPro_HeapPoC.py #
# Discovered by r4x (Kamil Szczerba) #
# [r4xks@o2.pl] #
##########################################
# Soft : WFTPD Explorer Pro 1.0 #
# Vendor : Texas Imperial Software #
# Vuln : Heap Ov... | knightmare2600/d4rkc0de | exploits/071218.py | Python | gpl-2.0 | 2,884 |
# Copyright (C) 2015 Jan Blechta
#
# This file is part of dolfin-tape.
#
# dolfin-tape 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 the License, or
# (at your option) any later ve... | blechta/dolfin-tape | dolfintape/demo_problems/exact_solutions.py | Python | gpl-3.0 | 5,383 |
"""
Create Annalist/Django site data.
Note: uses data in `sampledata/empty/annalist_site`
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2014, G. Klyne"
__license__ = "MIT (htt... | gklyne/annalist | src/annalist_root/annalist_manager/am_createsite.py | Python | mit | 12,192 |
#!/usr/bin/env python
#
#title :llilc_runtest.py
#description :
#
# This script runs CoreCLR test with specified LLILC JIT and pre-built
# CoreCLR runtime. If verbose level is specified, either summary or
# verbose, a result will be created in default location or a place
# that is specified. In verbose c... | dkorolev/llilc | test/llilc_runtest.py | Python | mit | 11,351 |
#!/usr/bin/env python
# MARTINIZE
# A simple, versatile tool for coarse-graining molecular systems
# Copyright (C) 2017 Tsjerk A. Wassenaar and contributors
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Softwar... | Tsjerk/Martinize | tests/test_regression.py | Python | gpl-2.0 | 19,858 |
#!/usr/bin/python
#Authors: Gaetano Carlucci
# Giuseppe Cofano
import time
import json
import matplotlib.pyplot as plt
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + '/../utils')
from Monitor import MonitorThread
from openLoopActuator import openLoopActuator
if __nam... | GaetanoCarlucci/CPULoadGenerator | tests/Identification2.py | Python | mit | 2,038 |
# encoding: utf-8
import os
import shutil
import tempfile
import unittest
import pdefc
from pdefc import lang, objc
class TestGenerator(unittest.TestCase):
def setUp(self):
self.generator = objc.Generator(prefix='PD')
def package(self):
path = os.path.join(os.path.dirname(__file__), 'tes... | pdef/pdef | compiler/pdefc/objc/test.py | Python | apache-2.0 | 1,863 |
"""
pygments.lexers.configs
~~~~~~~~~~~~~~~~~~~~~~~
Lexers for configuration file formats.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, default, words, bygroups, include, using
from... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/pygments/lexers/configs.py | Python | apache-2.0 | 37,927 |
#
# Copyright 2012 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 in th... | kvaps/vdsm | tests/permutationTests.py | Python | gpl-2.0 | 1,636 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. Yo... | affo/nova | nova/virt/vmwareapi/driver.py | Python | apache-2.0 | 27,905 |
# Copyright (C) 2011 Equinor ASA, Norway.
#
# The file 'job_queue.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 Licen... | joakim-hove/ert | res/job_queue/queue.py | Python | gpl-3.0 | 20,103 |
def makeflat(lista):
# print "LOGX:: Entering `makeflat` method/function in %(__file__)s" %
# globals()
flat = ''
import datetime
import glob
import os
import ntt
from ntt.util import readhdr, readkey3, delete, name_duplicate, updateheader, correctcard
from pyraf import iraf
iraf... | svalenti/pessto | trunk/src/ntt/soficalibdef.py | Python | mit | 18,166 |
# -*- coding: utf-8 -*-
"""
################################################################################
# #
# media_editing #
# ... | wdbm/media_editing | media_editing.py | Python | gpl-3.0 | 2,382 |
import pytest
from tests.plugins.upload_to_s3 import upload_file_to_s3_by_job_id
pytest_plugins = (
"tests.examples.examples_report_plugin",
"tests.integration.integration_tests_plugin",
"tests.plugins.bokeh_server",
"tests.plugins.image_diff",
"tests.plugins.jupyter_notebook",
"tests.plugins.... | philippjfr/bokeh | tests/conftest.py | Python | bsd-3-clause | 1,395 |
# -*- coding: utf-8 -*-
# Copyright © 2012 Peter Schnebel <pschnebel@gmx.de>
# This file is part of python-ads.
#
# python-ads 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,... | pscn/ads | src/log.py | Python | gpl-3.0 | 1,254 |
def max_rectangle(heights):
res = 0
heights.append(0)
stack = [0]
for i in range(1, len(heights)):
while stack and heights[i] < heights[stack[-1]]:
h = heights[stack.pop()]
w = i if not stack else i - stack[-1] - 1
res = max(res, h * w)
stack.append(i... | shenfei/oj_codes | leetcode/python/n85_Maximal_Rectangle.py | Python | mit | 1,123 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
SLEEP = 0.5
# Complex Parts
class TC1:
def run(self):
print("###### In Test 1 ######")
time.sleep(SLEEP)
print("Setting up")
time.sleep(SLEEP)
print("Running test")
time.sleep(SLEEP)
print("Tearing... | NicovincX2/Python-3.5 | Génie logiciel/Architecture logicielle/Patron de conception/Patron de structure/facade.py | Python | gpl-3.0 | 1,596 |
# (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> and others
#
# 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 Foun... | fdupoux/ansible | lib/ansible/plugins/__init__.py | Python | gpl-3.0 | 15,547 |
def itemTemplate():
return ['object/tangible/loot/creature_loot/collections/shared_housing_improvement_04.iff']
def lootDescriptor():
return 'customattributes'
def customizationAttributes():
return ['/private/index_color_1']
def customizationValues():
return [9]
def STFparams():
r... | agry/NGECore2 | scripts/loot/lootItems/collections/housing_improvements/cabinetry_techniques/cabinetry_techniques_9.py | Python | lgpl-3.0 | 600 |
#
# pGRAPH
# Copyright (C) 2006 Pedram Amini <pedram.amini@gmail.com>
#
# 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.
#
... | pmquang/FuzzLabs | modules/jobshandler/sulley/pgraph/graph.py | Python | gpl-2.0 | 21,677 |
import telepot
from keys import telegram_api_key, telegram_bot_url
bot = telepot.Bot(telegram_api_key)
bot.setWebhook(telegram_bot_url) | timokoola/timoechobot | telegramsetup.py | Python | apache-2.0 | 136 |
#!/usr/bin/python
#
# 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 distribut... | bmanojlovic/ansible | lib/ansible/modules/network/eos/eos_user.py | Python | gpl-3.0 | 11,924 |
import django
from functools import partial
from sys import version_info
from django.shortcuts import render
from django.template.loader import render_to_string
from django.template.response import TemplateResponse as BaseTemplateResponse
if django.VERSION < (1, 6):
from django.conf.urls.defaults import include... | 5monkeys/djedi-cms | djedi/compat.py | Python | bsd-3-clause | 3,464 |
import os
from autotest.client.shared import error
from autotest.client.shared import utils
from virttest import virsh
from provider import libvirt_version
def run(test, params, env):
"""
Test command: virsh net-dumpxml.
This command can output the network information as an XML dump to stdout.
1.G... | svirt/tp-libvirt | libvirt/tests/src/virsh_cmd/network/virsh_net_dumpxml.py | Python | gpl-2.0 | 4,174 |
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render
from django.utils.encoding import ... | dadasoz/dj-translate | autotranslate/views.py | Python | mit | 22,363 |
# coding=utf-8
from django.contrib.auth.models import User, Group
from django.test.testcases import TestCase
from grading.models import *
from grading.autograding import get_autograders
class StudentTest(TestCase):
def test_user_creation_creates_student(self):
u = User.objects.create(username = "test1", ... | jbzdak/data-base-checker | grading/tests/test_models.py | Python | gpl-3.0 | 7,167 |
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2015-2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import odoo.tests.common as common
from odoo import fields
class TestPurchaseOrder(common.SavepointCase):
@classmethod
def setUpClass(cls):
... | OCA/purchase-workflow | purchase_discount/tests/test_purchase_discount.py | Python | agpl-3.0 | 6,834 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, an open source suite of business apps
# This module copyright (C) 2015 bloopark systems (<http://bloopark.de>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | blooparksystems/website | website_compress_html/models/res_config.py | Python | agpl-3.0 | 1,280 |
# coding=utf-8
import unittest
"""114. Flatten Binary Tree to Linked List
https://leetcode.com/problems/flatten-binary-tree-to-linked-list/description/
Given a binary tree, flatten it to a linked list in-place.
For example, given the following tree:
1
/ \
2 5
/ \ \
3... | openqt/algorithms | leetcode/python/lc114-flatten-binary-tree-to-linked-list.py | Python | gpl-3.0 | 1,001 |
__author__ = 'Leonardo De Macedo'
| macedoleonardo/WebTesting-Python-Behave | pages/__init__.py | Python | gpl-2.0 | 35 |
"""
Provides queries against the FTS API, fetching JSON and translating it into pandas dataframes.
It unfortunately doesn't show the structure of the returned data explicitly, that's all handled by pandas.
At some point we may want to create dedicated classes for each type of data returned by the API, to do validation ... | luiscape/fts-collector | ckan_loading/fts_queries.py | Python | unlicense | 5,501 |
#!/usr/bin/python
import unittest as u
import re, fnmatch, os
rootDir = '../src/'
javaBlacklistFile = '../src/javaswig_blacklist'
pythonBlacklistFile = '../src/pythonswig_blacklist'
nodeBlacklistFile = '../src/nodeswig_blacklist'
class BlacklistConsistency(u.TestCase):
def test_java_blacklist(self):
w... | pylbert/upm | tests/check_consistency.py | Python | mit | 2,086 |
"""SCons.Tool.g++
Tool-specific initialization for g++.
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, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# Permission is... | makinacorpus/mapnik2 | scons/scons-local-1.2.0/SCons/Tool/g++.py | Python | lgpl-2.1 | 3,111 |
#! /usr/bin/env python
from skool.utils import *
restore_db()
| daeatel/skool | bin/import_data_backup.py | Python | mit | 63 |
import os
os.environ['DJANGO_SETTINGS_MODULE']='solalim.settings'
import sys
sys.path += ["."]
from django import setup
setup()
import json
from floreal.models import *
from collections import defaultdict
FILE_NAME="./floreal-dump-2020-07-21.json"
x = defaultdict(list)
# Sort model elements by model class name
fo... | fab13n/caracole | floreal/migrate-floreal.py | Python | mit | 4,586 |
# -*- coding: utf-8 -*-
#
# Copyright 2014, Carlos Rodrigues
#
# Redistribution and use of this source code is licensed under
# the BSD license. See COPYING file for license description.
#
import socket
import struct
import time
from .kt_error import KyotoTycoonException
MB_REPL = 0xb1
MB_SYNC = 0xb0
OP_SET = 0xa1
... | sapo/python-kyototycoon | kyototycoon/kyotoslave.py | Python | bsd-3-clause | 3,487 |
# Copyright 2011 Akretion Sébastien BEAU <sebastien.beau@akretion.com>
# Copyright 2013 Camptocamp SA (author: Guewen Baconnier)
# Copyright 2016 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class StockMove(models.Model):
_inherit = "stock.move"
def _get_ne... | OCA/sale-workflow | sale_automatic_workflow/models/stock_move.py | Python | agpl-3.0 | 544 |
from django.test import TransactionTestCase
from django.test.utils import override_settings
from addict import Dict
from . import models
from .testutils import make_datetime
import copy
from pykeg.backend import get_kegbot_backend
@override_settings(KEGBOT_BACKEND="pykeg.core.testutils.TestBackend")
class StatsTes... | Kegbot/kegbot-server | pykeg/core/stats_test.py | Python | gpl-2.0 | 8,332 |
# coding=utf-8
import boto3
from pxl.sports_apis import form_mlb_string, form_nhl_string, form_nfl_string
from pxl.weather_api import form_weather_string
from pxl.headline_api import form_headline_string
# https://aqy9q7jfavde2.iot.us-west-2.amazonaws.com/things/PXL-CF2016/shadow
def generate_display(params):
"... | PXL-CF2016/pxl-master-server | pxl/board_iot.py | Python | mit | 1,345 |
import base64
import botocore.client
import boto3
import io
import json
import pytest
import sure # noqa # pylint: disable=unused-import
import zipfile
from moto import (
mock_lambda,
mock_ec2,
settings,
)
from uuid import uuid4
from unittest import SkipTest
from .utilities import (
get_role_name,
... | spulec/moto | tests/test_awslambda/test_lambda_invoke.py | Python | apache-2.0 | 12,840 |
for x in range(1, 10):
print x | caot/intellij-community | python/testData/console/indent1.after.py | Python | apache-2.0 | 33 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('naf_autoticket', '0037_auto_20161230_0136'),
]
operations = [
migrations.RenameField(
model_name='incidentqueue'... | kevinnguyeneng/django-uwsgi-nginx | app/naf_autoticket/migrations/0038_auto_20161230_0136.py | Python | gpl-3.0 | 418 |
#!/usr/bin/env python
from __future__ import division
from optparse import OptionParser
from optparse import OptionGroup
from multiprocessing.dummy import Pool as ThreadPool
import numpy as np
import sys
import math
import os
import re
usage = "usage: python %prog <SAM formatted data with MD field present f... | BoyanZhou/AntCaller | AntCaller-1.1.py | Python | gpl-3.0 | 19,523 |
__author__ = 'Andy'
from whirlybird.protocols import pilot_input_pb2
class InputDriverBase(object):
def __init__(self, transport):
self.transport = transport
def _to_integer(self, value):
return int(value * 255 + 255)
def emit(self,
left_stick_x,
left_stick_y,
... | levisaya/whirlybird | whirlybird/client/input_drivers/input_driver_base.py | Python | mit | 1,271 |
from sqlalchemy import Column, String, Integer
from BusTrack.repository import Base, session
from BusTrack.repository.models import STRING_LEN_SMALL
class UserType(Base):
__tablename__ = 'user_type'
id = Column(Integer, primary_key=True)
role_name = Column(String(STRING_LEN_SMALL))
@staticmethod
... | Rjtsahu/School-Bus-Tracking | BusTrack/repository/models/UserType.py | Python | gpl-3.0 | 743 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/clusterfuzz | src/clusterfuzz/_internal/chrome/crash_uploader.py | Python | apache-2.0 | 21,137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.