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 |
|---|---|---|---|---|---|
class Node(object):
def __init__(self, obj):
self._obj = obj
self._next = None
@property
def object(self):
return self._obj
@property
def next(self):
return self._next
@next.setter
def next(self, value):
self._next = value
def __repr__(self):
... | pesh1983/exercises | python/structures/singly_linked_list/singly_linked_list.py | Python | mit | 2,320 |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def ll_to_list(self, ll):
output = []
while ll:
output.append(ll.val)
ll = ll.next
return output
... | 1337/yesterday-i-learned | leetcode/2m (2).py | Python | gpl-3.0 | 1,333 |
#! /usr/bin/env python
""" Simple test script for cmathmodule.c
Roger E. Masse
"""
import cmath
import unittest
from test import test_support
from test.test_support import verbose
p = cmath.pi
e = cmath.e
if verbose:
print 'PI = ', abs(p)
print 'E = ', abs(e)
class CmathTestCase(unittest.TestCase):
d... | babble/babble | include/jython/Lib/test/test_cmath_jy.py | Python | apache-2.0 | 3,591 |
def dawn_slots_table():
return { 1: 'Main Hand',
2: 'Off Hand',
3: 'Helm',
4: 'Chest',
5: 'Gloves',
6: 'Pants',
7: 'Boots',
8: 'Ring',
9: 'Shield',
10: 'Neck' }
# 11: 'Familiar'... | tsunam/dotd_parser | models/slots.py | Python | mit | 682 |
import abc
import functools
import inspect
import logging
from typing import TYPE_CHECKING, Any, Tuple, Dict, Callable
import uuid
import json
import weakref
import ray
from ray.util.inspect import is_function_or_method, is_class_method, is_static_method
from ray._private import signature
from ray.workflow.common impo... | ray-project/ray | python/ray/workflow/virtual_actor_class.py | Python | apache-2.0 | 20,978 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Spyder terminal default configuration."""
import os
import sys
WINDOWS = os.name == 'nt'
LINUX = sys.platform.startswith('linux')
CONF_SECTION = 'terminal'
CON... | spyder-ide/spyder-terminal | spyder_terminal/config.py | Python | mit | 1,346 |
from setuptools import setup, find_packages
setup(
name='django_serialize',
version='1.3.2',
description='Serialization utilities for django models',
author='Mirus Research',
author_email='frank@mirusresearch.com',
packages=find_packages(),
url='https://github.com/mirusresearch/django_seria... | mirusresearch/django_serialize | setup.py | Python | mit | 513 |
# Copyright 2021 The FedLearner 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... | bytedance/fedlearner | web_console_v2/api/fedlearner_webconsole/utils/fake_k8s_client.py | Python | apache-2.0 | 9,839 |
#!/usr/bin/env python
from setuptools import setup
setup(
name="django-auth-ldap",
version="1.2.14",
description="Django LDAP authentication backend",
long_description=open('README').read(),
url="http://bitbucket.org/psagers/django-auth-ldap/",
author="Peter Sagerson",
author_email="psage... | theatlantic/django-auth-ldap | setup.py | Python | bsd-2-clause | 1,528 |
# Copyright 2014 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.
import os
import re
import shutil
import tempfile
import time
import unittest
from telemetry.core import util
from telemetry import decorators
from telemetr... | benschmaus/catapult | telemetry/telemetry/internal/platform/profiler/android_profiling_helper_unittest.py | Python | bsd-3-clause | 6,086 |
# coding: utf-8
import sys
import numpy as np # linear algebra
subset = sys.argv[1]
crop_window_len = np.int(sys.argv[2])
saving_mm_name = str(crop_window_len * 2 +1) + 'mm'
import cv2
from skimage import segmentation
from sklearn.cluster import DBSCAN
import pandas as pd # data processing, CSV file I/O (e.g. pd.r... | RodenLuo/LSolver | augment_nodule.py | Python | mit | 3,169 |
# Copyright (c) 2015 Xilinx Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | Xilinx/hopper | hopper/utils/Collections.py | Python | mit | 1,431 |
# 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... | wchan/tensorflow | tensorflow/g3doc/how_tos/adding_an_op/zero_out_op_2.py | Python | apache-2.0 | 1,120 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup file for risklearning.
This file was generated with PyScaffold 2.5.6, a tool that easily
puts up a scaffold for your new Python project. Learn more under:
http://pyscaffold.readthedocs.org/
"""
import sys
from setuptools import setup
def setup_... | munichpavel/risklearning | setup.py | Python | mit | 604 |
__author__ = "dhruv, Sidd Karamcheti"
from grt.core import GRTMacro, Constants
import wpilib
constants = Constants()
class TurnMacro(GRTMacro):
"""
Macro that turns a set distance.
"""
TP = constants['TP']
TI = constants['TI']
TD = constants['TD']
TOLERANCE = constants['TMtol']
class... | grt192/2012rebound-rumble | py/grt/macro/turn_macro.py | Python | mit | 2,642 |
# Copyright 2017 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... | allenlavoie/tensorflow | tensorflow/contrib/autograph/impl/conversion_test.py | Python | apache-2.0 | 2,715 |
from psychopy.tools import filetools
import inspect
import numpy as np
import psychopy_ext.stats
import psychopy_ext.plot
import pandas
from calcUnderOvercorrect import calcOverCorrected
from plotHelpers import agrestiCoull95CI
#grab some data outputted from my program, so I can test some analysis code
##The psydat fi... | alexholcombe/spatiotopic-motion | analyzeDataTestingVersion.py | Python | mit | 6,964 |
import conedy as co
N = co.network()
newNodeNumber = N.addNode( co.roessler() )
N.observeTime("output/evolve3.py.series")
N.observe(newNodeNumber, "output/evolve3.py.series")
N.evolve(0.0,3.0)
N.evolve(5.0,13.0)
N.evolve (-0.1, 0.0)
| Conedy/Conedy | testing/dynNetwork/evolve3.py | Python | gpl-2.0 | 241 |
# coding: utf-8
import sys
sys.path.append(".")
from workshop.en.b import *
DISCLOSE_SECRET_WORD = TRUE
"""
- 'suggestion'; the content of the secrete word text box;
used only in 'dev' mode.
Return 'suggestion', if not empty, otherwise some word.
"""
def pickWord(suggestion):
if suggestion:
... | epeios-q37/epeios | other/exercises/Hangman/en/b.py | Python | agpl-3.0 | 387 |
#!/usr/bin/env python
import unittest
import sys
sys.path.insert(0, '..')
import bitstring
from bitstring import ConstBitStream as CBS
class All(unittest.TestCase):
def testFromFile(self):
s = CBS(filename='test.m1v')
self.assertEqual(s[0:32].hex, '000001b3')
self.assertEqual(s.read(8 * 4)... | cstipkovic/spidermonkey-research | python/bitstring/test/test_constbitstream.py | Python | mpl-2.0 | 3,788 |
import json
from indy import IndyError
from indy import signus
from indy.error import ErrorCode
import base58
import pytest
seed = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
expected_verkey = 'CnEDk9HrMnmiHXEV1WFgbVCRteYnPqsJwrTdcZaNhFVW'
crypto_type = 'ed25519'
expected_did = 'NcYxiDXkpYi6ov5FcYDi1e'
@pytest.mark.asyncio... | korsimoro/indy-sdk | wrappers/python/tests/signus/test_create_and_store_my_did.py | Python | apache-2.0 | 2,485 |
# -*- coding: utf-8 -*-
{
'name': 'test-import-export',
'version': '0.1',
'category': 'Tests',
'description': """A module to test import/export.""",
'author': 'OpenERP SA',
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'data': ['ir.model.access... | addition-it-solutions/project-all | openerp/addons/test_impex/__openerp__.py | Python | agpl-3.0 | 382 |
import logging
from functools import wraps
from flask import request, Response
from kalliope import Utils
from kalliope.core.ConfigurationManager import SettingLoader
logging.basicConfig()
logger = logging.getLogger("kalliope")
def check_auth(username, password):
"""This function is called to check if a usernam... | kalliope-project/kalliope | kalliope/core/RestAPI/utils.py | Python | gpl-3.0 | 2,573 |
__author__ = 'civa'
from hubs.vo.concurrency.threadpool import ThreadPool
from ..providers import ned, simbad, vizier
class Search():
pool = ThreadPool(3)
ned_search = ned.NedSearch()
simbad_search = simbad.SimbadSearch()
vizier_search = vizier.VizierSearch()
def __init__(self):
self.ne... | Civa/Zenith | src/Backend/Distributed/hubs/vo/concurrency/search.py | Python | gpl-3.0 | 687 |
# 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/layers/reshaping/repeat_vector.py | Python | apache-2.0 | 2,198 |
# Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Stenography translation.
This module handles translating streams of strokes in translations. Two classes
compose this module:
Translation -- A data model class that encapsulates a sequence of Stroke objects
in the context of a particular dictionary.... | morinted/plover | plover/translation.py | Python | gpl-2.0 | 15,045 |
# This file is part of Merlin.
# Merlin is the Copyright (C)2008,2009,2010 of Robin K. Hansen, Elliot Rosemarine, Andreas Jacobsen.
# Individual portions may be copyright by individual contributors, and
# are included in this collective work with permission of the copyright
# owners.
# This program is free software; ... | d7415/merlin | Hooks/lookup.py | Python | gpl-2.0 | 3,044 |
# -*- coding: utf-8 -*-
from src.bamboo import EqualityMixin
class Plan(EqualityMixin):
def __init__(self, plan_key, project_key, name, description, link, is_favourite, enabled):
self.plan_key = plan_key
self.project_key = project_key
self.name = name
self.description = descriptio... | mibexsoftware/alfred-bamboo-workflow | workflow/src/bamboo/plan.py | Python | mit | 1,781 |
# -*- coding: utf-8 -*-
from model.contact import Contact
import pytest
def test_add_contact_data(app, db, data_contacts, check_ui):
contact = data_contacts
with pytest.allure.step('Given a contact list'):
old_contacts = db.get_contact_list()
with pytest.allure.step('When I add the contact to the ... | ruslankl9/python_training | test/test_add_contact.py | Python | apache-2.0 | 2,541 |
strings = [
"""Deep Thoughts
- by Jack Handy
===============""",
"It takes a big man to cry, but it takes a bigger man to laugh at that man.",
"When you're riding in a time machine way far into the future, don't stick your elbow out the window, or it'll turn into a fossil.",
"I wish I had a Kryptonite cross, beca... | ActiveState/code | recipes/Python/286129_Word_wrapping_generator/recipe-286129.py | Python | mit | 1,455 |
"""Main module that parses command line arguments."""
import os
import io
import bz2
import gzip
import sys
import codecs
import argparse
import subprocess
import mw.xml_dump
import mwxml
import pathlib
from typing import IO, Optional, Union
from . import processors, utils
def open_xml_file(path: Union[str, IO]):
... | CristianCantoro/wikidump | wikidump/__main__.py | Python | mit | 4,667 |
# -*- coding: utf-8 -*-
'''
mycroft.models.scheduled_jobs persists metadata regarding each scheduled job
ScheduledJobs is a collection of ScheduledJob. ScheduledJobs implements iterable protocol.
ScheduledJob contains metadata of a scheduled job.
Example::
>>> scheduled_jobs = ScheduledJobs(dynamo_table_object)... | Yelp/mycroft | mycroft/mycroft/models/scheduled_jobs.py | Python | mit | 12,258 |
# -*- coding: utf-8; -*-
# Contains compatibility functions extracted from the 'six' project.
from six import PY3
if PY3:
def iteritems(d, **kw):
return iter(d.items(**kw))
else:
def iteritems(d, **kw):
return iter(d.iteritems(**kw))
| mrname/haralyzer | haralyzer/compat.py | Python | mit | 260 |
# coding:utf-8
"""
DCRM - Darwin Cydia Repository Manager
Copyright (C) 2017 WU Zheng <i.82@me.com>
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 yo... | 82Flex/DCRM | WEIPDCRM/manage/admin/device_type.py | Python | agpl-3.0 | 1,510 |
# This file is part of VoltDB.
# Copyright (C) 2008-2016 VoltDB Inc.
#
# 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 ver... | paulmartel/voltdb | lib/python/voltcli/future.d/show.py | Python | agpl-3.0 | 1,567 |
from braces.views import LoginRequiredMixin # django.contrib.auth.mixins lack of redirect_unauthenticated_users
from guardian.mixins import PermissionRequiredMixin
class RaisePermissionRequiredMixin(LoginRequiredMixin, PermissionRequiredMixin):
"""Mixin to verify object permission with preserve correct status co... | ad-m/django-atom | atom/ext/guardian/views.py | Python | bsd-3-clause | 1,466 |
# https://www.hackerrank.com/challenges/bon-appetit
n, k = input().strip().split(' ')
n, k = [int(n), int(k)]
c = [int(a_temp) for a_temp in input().strip().split(' ')]
b = int(input().strip())
total_owed = sum(c)
total_owed -= c[k]
total_owed /= 2
if (b == total_owed):
print("Bon Appetit")
else:
print(int(b... | rivergillis/hackerrank-practice | algo/implementation/easy/bon-appetit.py | Python | mit | 336 |
# -*- coding: utf-8 -*-
'''module to support compatability between Python 2 and Python 3 and to handle
default and optional packages'''
import sys
py3 = sys.version_info[0] >= 3
if py3:
basestring = str
unicode_type = str
bytes_type = bytes
def iteritems(d):
return iter(d.items())
def i... | UW-Hydro/RVIC | rvic/core/pycompat.py | Python | gpl-3.0 | 946 |
"""Module providing remote play features for Coders in Space.
Sockets are used to transmit orders on local or remote machines.
Firewalls or restrictive networks settings can block them.
More details on sockets: https://docs.python.org/2/library/socket.html.
Author: Benoit Frenay (benoit.frenay@unamur.be)
"""
i... | Groupe24/CodeInSpace | game/remote_play.py | Python | mit | 6,024 |
# coding:utf-8
import sys
import hashlib
import json
import urllib
try:
import urllib.parse
except:
pass
import abc
class Core():
app_secret = None
receive_text = None
receive_event = None
receive_default = None
receive_position = None
receive_follow = None
receive_unfollow = Non... | meowtec/fanserve.py | fanserve/core.py | Python | mit | 3,515 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2019-2020 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the ... | ubuntu-core/snapcraft | tests/unit/commands/test_promote.py | Python | gpl-3.0 | 4,706 |
import re
from regparser.layer.layer import Layer
from regparser.tree import struct
from regparser.tree.priority_stack import PriorityStack
from regparser.tree.xml_parser import tree_utils
class HeaderStack(PriorityStack):
"""Used to determine Table Headers -- indeed, they are complicated
enough to warrant t... | EricSchles/regulations-parser | regparser/layer/formatting.py | Python | cc0-1.0 | 5,046 |
import HeeksCNC
index_map = {} # maps object_index to object
next_object_index = 1
class Object:
def __init__(self):
self.parent_index = None
self.children = []
# set the index
global next_object_index
self.index = next_object_index
next_object_index = nex... | JohnyEngine/CNC | heekscnc/pycnc/Object.py | Python | apache-2.0 | 1,716 |
# -*- coding: utf-8 -*-
import json
from django.core import mail
from django.core.checks import Info
from django.test import TestCase, override_settings
from wagtail.contrib.forms.models import FormSubmission
from wagtail.contrib.forms.tests.utils import (
make_form_page, make_form_page_with_custom_submission, ma... | kaedroho/wagtail | wagtail/contrib/forms/tests/test_models.py | Python | bsd-3-clause | 28,509 |
from subprocess import check_call, call, Popen, PIPE
import os
import textwrap
import glob
os.putenv("DEBIAN_FRONTEND", "noninteractive")
#######
## Plumbing
#######
def get_output(cmd, **kwargs):
check = kwargs.pop("check", True)
kwargs["stdout"] = PIPE
p = Popen(cmd, **kwargs)
stdout, stderr = p.c... | akx/requiem | requiem.py | Python | mit | 2,960 |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | crossroadchurch/paul | openlp/plugins/images/__init__.py | Python | gpl-2.0 | 1,677 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "emi.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mherrmann/ExcludeMyIP | manage.py | Python | mit | 246 |
from datetime import datetime, timedelta
import json
import uuid
import mock
import pytz
from rest_framework.request import Request
from rest_framework.test import APIClient, APITestCase, APIRequestFactory, force_authenticate
from rest_framework import status
from django.contrib.auth.models import User
from django.c... | fungjj92/DRIVER | app/data/tests/test_views.py | Python | gpl-3.0 | 13,392 |
import pytest
from cfme.middleware import get_random_list
from cfme.middleware.datasource import MiddlewareDatasource
from utils import testgen
from utils.version import current_version
from server_methods import get_eap_server, get_hawkular_server
from jdbc_driver_methods import download_jdbc_driver, deploy_jdbc_driv... | kzvyahin/cfme_tests | cfme/tests/middleware/test_middleware_datasource.py | Python | gpl-2.0 | 8,214 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import time_diff_in_seconds, now, now_datetime, DATETIME_FORMAT
from dateutil.relativedelta import relativedelta
from six import string_types
@fr... | chdecultot/frappe | frappe/desk/notifications.py | Python | mit | 8,641 |
from unittest inport TestCase
import pym6
class TestPym6(TestCase):
pass
| suyashbire1/pym6 | pym6/tests/test_pym6.py | Python | mit | 78 |
# Copyright 2014 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 ag... | flgiordano/netcash | +/google-cloud-sdk/lib/surface/logging/__init__.py | Python | bsd-3-clause | 2,025 |
#!/usr/bin/env python3
import os, re, sys, subprocess
from io import open
# When passed `--release`, this script sets up Coq to support three
# `-compat` flag arguments. If executed manually, this would consist
# of doing the following steps:
#
# - Delete the file `theories/Compat/CoqUU.v`, where U.U is four
# vers... | coq/coq | dev/tools/update-compat.py | Python | lgpl-2.1 | 21,109 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2008, 2009, 2010, 2011 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 ... | fjorba/invenio | modules/bibcirculation/lib/bibcirculation_daemon.py | Python | gpl-2.0 | 8,394 |
#
# The Python Imaging Library
# $Id$
#
# simple postscript graphics interface
#
# History:
# 1996-04-20 fl Created
# 1999-01-10 fl Added gsave/grestore to image method
# 2005-05-04 fl Fixed floating point issue in image (from Eric Etheridge)
#
# Copyright (c) 1997-2005 by Secret Labs AB. All rights reserved.
# ... | richardnpaul/FWL-Website | lib/python2.7/site-packages/PIL/PSDraw.py | Python | gpl-3.0 | 5,704 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from SpiffyWorld import UnitType
class UnitTypeCollection:
"""
A whole mess of unit types
"""
def __init__(self, **kwargs):
self.unit_types = []
def add(self, unit_type):
if not isinstance(unit_type, UnitType):
raise Valu... | butterscotchstallion/SpiffyRPG | SpiffyRPG/SpiffyWorld/collections/unit_type_collection.py | Python | mit | 946 |
from lib2to3 import fixer_base, pytree, patcomp
from lib2to3.pgen2 import token
from lib2to3.fixer_util import Call, Comma, Name
"""
Fixes:
for file in args: ...
into:
for file in map(unicode, args): ...
"""
class FixFileinargs(fixer_base.BaseFix):
PATTERN = """
for_stmt< 'for' 'file' 'in' arg='ar... | tailhook/pyzza | backport/fix_fileinargs.py | Python | mit | 590 |
class Timers:
def __init__(self):
self.transitions = {
1: {2,4},
2: {3,5},
3: {6},
4: {5,7},
5: {6,8},
6: {9},
7: {8},
8: {9,0},
9: set(),
0: set()
}
self.all = self._gener... | JonSteinn/Kattis-Solutions | src/Good Morning!/Python 3/main.py | Python | gpl-3.0 | 1,952 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('agentex', '0003_auto_20150622_1101'),
]
operations = [
migrations.CreateModel(
name='LastLogins',
fi... | tomasjames/citsciportal | app/agentex/migrations/0004_lastlogins.py | Python | gpl-3.0 | 591 |
#@help:cheat {program} [arguments] - A script full of cheaty debug tools.
from game.pythonapi import PyDisplay
from game.pythonapi import PyNetworking
from connection import Port
def help():
PyDisplay.write(terminal, 'Programs available:' +
'\n open_port {target IP} {program} {port} - opens a port on the device' +... | Rsgm/Hakd | core/assets/python/programs/rsgm/debug/cheat.py | Python | mit | 1,178 |
import logging
import os
import base64
try:
from io import BytesIO
except ImportError:
try:
from cStringIO import StringIO as BytesIO
except ImportError:
from StringIO import StringIO as BytesIO
import tornado.web
import cairocffi as cairo
from lib.config.tomorrow import Config
from lib.too... | TylerTemp/tomorrow | lib/ui/error.py | Python | gpl-3.0 | 4,288 |
import nose.tools
from unittest import TestCase
from nose import SkipTest
from nose.plugins.attrib import attr
from tests.common import prepare_env, TESTDATA
prepare_env()
import os
import tempfile
from netCDF4 import Dataset
from flyingpigeon import indices
from flyingpigeon.utils import local_path
class IndicesCa... | sradanov/flyingpigeon | tests/test_indices.py | Python | apache-2.0 | 1,366 |
# -*- coding: UTF-8 -*-
__revision__ = '$Id$'
# Copyright (c) 2006-2012
#
# 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 versi... | FiloSottile/Griffith-mirror | lib/plugins/movie/PluginMovieAmazon.py | Python | gpl-2.0 | 19,948 |
import logging
import requests
from sentry.utils import json
from sentry.utils.cache import cache
from simplejson.decoder import JSONDecodeError
from BeautifulSoup import BeautifulStoneSoup
from django.utils.datastructures import SortedDict
log = logging.getLogger(__name__)
CACHE_KEY = "SENTRY-JIRA-%s-%s"
class JIR... | amathewhearsay/sentry-jira | sentry_jira/jira.py | Python | bsd-3-clause | 3,990 |
import os
import tempfile
def Temp(tmp):
cls = PathTemp if isinstance(tmp, str) else StringIOTemp
return cls(tmp)
class TempBase(object):
@property
def file(self):
return open(self.path, 'rb')
class PathTemp(TempBase):
def __init__(self, path):
self.path = path
@property... | dimagi/commcare-hq | corehq/ex-submodules/couchexport/files.py | Python | bsd-3-clause | 1,314 |
import os
import sys
#from ftplib import FTP
import ftputil
NCBI_SERVER = 'ftp.ncbi.nlm.nih.gov'
PLANTS_DIR = 'genomes/genbank/plant'
REP_DIR = 'representative'
REF_DIR = 'reference'
LATEST_DIR = 'latest_assembly_versions'
def matchup(items, ordered_matches):
return [match for match in ordered_matches if match i... | mmacpherson/plant-metagenomic-sims | generate_plant_genomes_download_script.py | Python | gpl-2.0 | 2,589 |
import sublime, sublime_plugin
class SnakeCommand(sublime_plugin.TextCommand):
def run(self, edit):
sels = self.view.sel()
for sel in sels:
string = self.view.substr(sel)
if string.find('_') != -1:
string = self.__toCamel(string)
else:
... | xxvholic/snake_camel_switch | SnakeManager.py | Python | gpl-2.0 | 680 |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Check RPC argument consistency."""
from collections import defaultdict
import glob
import os
import re... | ftrader-bitcoinabc/bitcoin-abc | test/lint/check-rpc-mappings.py | Python | mit | 6,394 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/dts/v20180330/errorcodes.py | Python | mit | 3,353 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Photobooth - a flexible photo booth software
# Copyright (C) 2018 Balthasar Reuter <photobooth at re - web dot eu>
#
# 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
# t... | reuterbal/photobooth | photobooth/gui/GuiSkeleton.py | Python | agpl-3.0 | 3,013 |
# 1st Activation Function: sigmoid
# 2nd Activation Function: softmax
# Loss Function: Cross Entropy Loss
# Train Algorithm: Mini-batch Gradient Descent
# Bias terms are used.
# force the result of divisions to be float numbers
from __future__ import division
from pandas import DataFrame
import pandas as pd
# I/O Li... | Iptamenos/NeuralNetworksInPython | NeuralNetworksForSpamHamClassification/NN_SpamHam_CrossEntropy_minibatch_gradient_descent.py | Python | mit | 11,193 |
#!/usr/bin/python
#
# Copyright (C) 2010 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of... | apyrgio/ganeti | test/py/ganeti.compat_unittest.py | Python | bsd-2-clause | 4,604 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "snowday.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jarbaugh5/snowdayprice | manage.py | Python | mit | 250 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
numero = 0b1001
print numero
# El número 1001 en binario es equivalente al 9 en base decimal
| psicobyte/ejemplos-python | cap5/p56.py | Python | gpl-3.0 | 137 |
import unittest
from .. import normalize_reference, scripture_re, reference_to_string
def f(txt):
"""
accept a string containing a scripture reference, normalize it, and then
return the reformatted string
"""
return reference_to_string(
*normalize_reference(*scripture_re.match(txt).gro... | davisd/python-scriptures | scriptures/tests/test_protestant_booknames.py | Python | bsd-3-clause | 14,893 |
# Copyright 2011 VMware, 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 ... | suneeth51/neutron | neutron/agent/common/ovs_lib.py | Python | apache-2.0 | 22,837 |
import sched, time
s = sched.scheduler(time.time, time.sleep)
def print_time():
print ("From print_time", time.time())
def print_some_times():
print (time.time())
s.enter(5, 1, print_time, ())
s.enter(10, 1, print_time, ())
s.run()
print (time.time())
print_some_times() | selfbus/software-arm-incubation | sensors/misc/raincenter-bim112/Phyton Raincenter Tests/test.py | Python | gpl-3.0 | 309 |
class DomainHelper(object):
pass
class NullDomainHelper(DomainHelper):
pass
class CppDomainHelper(DomainHelper):
def __init__(self, definition_parser, substitute):
self.definition_parser = definition_parser
self.substitute = substitute
self.duplicates = {}
def check_cache... | Kupoman/yggdrasil | docs/ext/breathe/renderer/rst/doxygen/domain.py | Python | apache-2.0 | 6,928 |
#! /usr/bin/env python3
class LazyProperty(property):
"""
A `descriptor`_ wrapping a class method and exposing it as a lazily
evaluated and cached property. It is intended to be used as a decorator.
The wrapped method is evaluated once on the first access and its return
value is cached for fast su... | lahwaacz/wiki-scripts | ws/utils/lazy.py | Python | gpl-3.0 | 1,735 |
"""
WSGI config for footballpicks project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
o... | mkokotovich/footballpicks | footballpicks/wsgi.py | Python | mit | 444 |
from fontTools.misc.py23 import strjoin, tobytes, tostr
from . import asciiTable
class table_T_S_I_V_(asciiTable.asciiTable):
def toXML(self, writer, ttFont):
data = tostr(self.data)
# removing null bytes. XXX needed??
data = data.split('\0')
data = strjoin(data)
writer.begintag("source")
writer.newline(... | google/material-design-icons | update/venv/lib/python3.9/site-packages/fontTools/ttLib/tables/T_S_I_V_.py | Python | apache-2.0 | 572 |
#Embedded file name: ACEStream\Core\BuddyCast\buddycast.pyo
__fool_epydoc = 481
import sys
from random import sample, randint, shuffle
from time import time, gmtime, strftime
from traceback import print_exc, print_stack
from array import array
from bisect import insort
from copy import deepcopy
import gc
import socket
... | GrandPaRPi/p2ptv-pi | acestream/ACEStream/Core/BuddyCast/buddycast.py | Python | mit | 80,049 |
import cmodule
def multiply(a, b):
print "Will compute", a, "times", b
c = 0
for i in range(0, a):
c = c + b
cmodule.callback(c)
| wagamama/embedding_python | func-module.py | Python | mit | 155 |
#!/usr/bin/env python
# Copyright (c) 2013, Carnegie Mellon University
# All rights reserved.
# Authors: Michael Koval <mkoval@cs.cmu.edu>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of sourc... | personalrobotics/prpy | src/prpy/rave.py | Python | bsd-3-clause | 8,253 |
from __future__ import unicode_literals
import warnings
from django import forms
from django.contrib import admin
from django.core import checks
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from .models import Song, Book, Album, TwoAlbumFKAndAnE, City, State
class SongFo... | archen/django | tests/admin_checks/tests.py | Python | bsd-3-clause | 15,516 |
import falcon
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from ..models import Base
from .resources.entries import EntryCollection
from .resources.entries import EntryInstance
from .resources.results import ResultCollection
def make_app(db_engine=None, transport=None):
if trans... | rackerlabs/PyPerf | pyperf/wsgi/app.py | Python | apache-2.0 | 847 |
import unittest
import logging
from config_test import build_client_from_configuration
_logger = logging.getLogger(__name__)
class TestLoggregator(unittest.TestCase):
def test_recent(self):
client = build_client_from_configuration()
cpt = 0
for log_message in client.loggregator.get_recent... | antechrestos/cf-python-client | integration/v2/test_loggregator.py | Python | apache-2.0 | 457 |
#!/usr/bin/env python
import os
from app import app, db
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy_utils import ScalarListType
from datetime import datetime
from flask import Flask
import hashlib
from itsdangerous import (TimedJSONWebSignatureSerializer
as Serializer, BadSignature, SignatureExpire... | cmput404wi16/metablog-project | app/models.py | Python | mit | 8,847 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2020-02-28 20:27
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
FIELDS = (
('trek', 'nom', 'name'),
('trek', 'depart', 'departure'),
('trek', 'arrivee', 'arrival'),
('trek', 'chapeau', ... | makinacorpus/Geotrek | geotrek/trekking/migrations/0014_auto_20200228_2127.py | Python | bsd-2-clause | 1,733 |
import copy
import functools
import importlib
import itertools
import json
import logging
import os
import os.path
import re
import socket
import sys
import time
from collections import UserDict
from contextlib import ContextDecorator
from functools import wraps
from urllib.request import urlopen
import click
from gw... | gwforg/gwf | src/gwf/utils.py | Python | gpl-3.0 | 7,508 |
"""Tests for band structure calculation."""
from phonopy.phonon.band_structure import get_band_qpoints
def test_band_structure(ph_nacl):
"""Test band structure calculation by NaCl."""
ph_nacl.run_band_structure(
_get_band_qpoints(), with_group_velocities=False, is_band_connection=False
)
ph_na... | atztogo/phonopy | test/phonon/test_band_structure.py | Python | bsd-3-clause | 1,105 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser 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 distributed in the hope that it will ... | USGM/suds | suds/sax/__init__.py | Python | lgpl-3.0 | 3,246 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tox.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| thomec/tox | manage.py | Python | gpl-2.0 | 246 |
#!/usr/bin/env python
# encoding: utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2013-2015 CNRS
#
# 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 li... | tvd-dataset/tvd | tvd/rip/__init__.py | Python | mit | 1,474 |
from documents.models import Document
from annotationsets.models import ConceptSet, Concept, Property, LinkedConcept, LinkedProperty
from rest_framework import viewsets, status
from accounts.models import User, WorkingGroup, Membership
from rest_framework.decorators import detail_route, list_route
from rest_framework.r... | FUB-HCC/neonion | api/viewsets.py | Python | gpl-2.0 | 3,948 |
"""Test the TcEx Batch Module."""
# standard library
import threading
import time
# third-party
import pytest
# first-party
from tcex.backports import cached_property
from tcex.input.field_types import Sensitive
from tcex.pleb.scoped_property import scoped_property
def await_token_barrier_enabled(token_service, tim... | ThreatConnect-Inc/tcex | tests/tokens/test_token.py | Python | apache-2.0 | 16,180 |
# Written by Stephen Fromm <stephenf nero net>
# Copyright (C) 2015-2017 University of Oregon
# This file is part of netspryte
#
# netspryte 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... | sfromm/snmpryte | lib/netspryte/errors.py | Python | gpl-3.0 | 1,152 |
# -*- coding: utf-8 -*-
"""Basic Model Interface (BMI) for the Diffusion model."""
import numpy
from typing import Tuple
from bmipy import Bmi
from .diffusion import Diffusion
class BmiDiffusion(Bmi):
_name = 'Diffusion model'
_input_var_names = ('plate_surface__temperature',)
_output_var_names = ('plat... | csdms/bmi-live | bmi_live/bmi_diffusion.template.py | Python | mit | 20,287 |
from __future__ import annotations # Needed for Python 4.0 type annotations
from typing import Any, Dict
from flask_login import current_user
from flask_wtf import FlaskForm
from openatlas import app
from openatlas.database.overlay import Overlay as Db
from openatlas.models.entity import Entity
from openatlas.util.... | craws/OpenAtlas-Python | openatlas/models/overlay.py | Python | gpl-2.0 | 3,072 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis_louvain | webservices/tests/helper.py | Python | agpl-3.0 | 2,060 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.