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 |
|---|---|---|---|---|---|
AZURE_STORAGE_NAME = 'mirisimagestorage'
AZURE_STORAGE_KEY = '2F2hCPXsmhGBFUUBFoFfTF1mlavK3YYdkX+tlAauYv6mly621fXYQSLckqEZfHR+XVBBI3PgV0spOed+JLrlKg=='
COGNITIVE_URL = 'https://westus.api.cognitive.microsoft.com/vision/v1.0/ocr'
COGNITIVE_KEY = '8ae1ba5adb144e69aa1016f66ff00b97' | KimBoWoon/Cognitive-API | config.py | Python | mit | 279 |
"""
Copyright (c) 2017 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
import unittest
import ClimatologySpark2
class CCMPTest(unittest.TestCase):
def cmmp_test(self):
dsName = 'CCMPWind'
nEpochs = '1'
nWindow = '1'
averager = 'pixelMean'
... | dataplumber/nexus | climatology/clim/test/ccmpTest.py | Python | apache-2.0 | 487 |
# -*- coding: latin1 -*-
################################################################################################
#
#
import snap, datetime, sys, time, json, os, os.path, shutil, time, random, math
import numpy as np
from math import*
# Script auxiliar para cálculos matemáticos que deve estar no mesmo diretóri... | amaurywalbert/twitter | net_structure/old/hashmap_plot_network_structure_with_betweenness.py | Python | gpl-3.0 | 5,411 |
# -*- coding: utf-8 -*-
from .constants import *
from threading import Lock
from . import soundqueue
from . import messages
class Users(dict):
"""Object that stores and update all connected users"""
def __init__(self, mumble_object, callbacks):
self.mumble_object = mumble_object
self.callback... | robozman/pymumblegui | pymumble/pymumble_py3/users.py | Python | gpl-3.0 | 7,133 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | nebril/fuel-web | nailgun/nailgun/test/integration/test_node_allocation_stats_handler.py | Python | apache-2.0 | 1,552 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Must satisfy the signature
# [t,X,D,P] = sim_function(T,X0,D0,P0,I0);
"""Uses Assimulo solvers"""
import numpy as np
from assimulo.problem import Explicit_Problem
from assimulo.solvers.sundials import CVode
from assimulo.solvers import LSODAR
from assimulo.solvers import Ru... | zutshi/S3CAMR | examples/bball/bball.py | Python | bsd-2-clause | 4,193 |
from setuptools import setup
fn = 'lino_xl/setup_info.py'
with open(fn, "rb") as fd:
exec(compile(fd.read(), fn, 'exec'))
if __name__ == '__main__':
setup(**SETUP_INFO)
| lino-framework/xl | setup.py | Python | bsd-2-clause | 177 |
from __future__ import division
from collections import Counter, defaultdict
from itertools import groupby, combinations
from functools import partial
from datetime import datetime, timedelta
from bandicoot.utils import all
def _round_half_hour(record):
"""
Round a time DOWN to half nearest half-hour.
""... | econandrew/bandicoot | bandicoot/network.py | Python | mit | 9,664 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from webapi_tests.wifi.wifi_test import WifiTestCommon
from webapi_tests.wifi.test_wifi_basic import TestWifiBasic
| cr/fxos-certsuite | webapi_tests/wifi/__init__.py | Python | mpl-2.0 | 315 |
# 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
# d... | tbachman/group-based-policy | gbpservice/neutron/services/grouppolicy/common/exceptions.py | Python | apache-2.0 | 10,587 |
"""Basic plugin
This plugin defines two simple features by calculating them in the
`compute_some_new_features` function and setting the plugin metadata in the
`info` dictionary. It is used for testing in dclab.
"""
def compute_some_new_features(rtdc_ds):
"""The function that does the heavy-lifting"""
circ_pe... | ZellMechanik-Dresden/dclab | tests/data/feat_anc_plugin_creative.py | Python | gpl-2.0 | 1,077 |
# -*- coding: utf-8 -*-
# Copyright 2015 Holger Brunn <hbrunn@therp.nl>
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "2D matrix for x2many fields",
"version": "9.0.1.0.0",
"author": "Therp BV, "
"Tecnativ... | be-cloud-be/horizon-addons | web/web_widget_x2many_2d_matrix/__openerp__.py | Python | agpl-3.0 | 680 |
#!/usr/bin/env python
# encoding: utf-8
import re
import os
try:
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
except ImportError:
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext as _build_ext
de... | timothydmorton/transit | setup.py | Python | mit | 4,320 |
from functools import partial
from django.contrib.admin.sites import AdminSite
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.test import TestCase
from mock import patch
from opendebates.admin import SubmissionAdmin
from opendebates.models import Submission
from ... | caktus/django-opendebates | opendebates/tests/test_admin.py | Python | apache-2.0 | 4,608 |
from JumpScale import j
import argparse
import sys
class ArgumentParser(argparse.ArgumentParser):
def exit(self, status=0, message=None):
if message:
self._print_message(message, sys.stderr)
if j.application.state == "RUNNING":
j.application.stop(status)
else:
... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/cmdutils/__init__.py | Python | apache-2.0 | 1,433 |
import json
def getConfig():
with open('config.json', 'r') as f:
return json.load(f) | UTD-CSLLC/Door-Karma-Server | src/config.py | Python | mit | 88 |
import calendar
from datetime import timedelta
import json
import os
import random
import traceback
from django.core import management
from django.utils import timezone
from silk import models
from silk.models import SQLQuery, Profile
class MockSuite(object):
"""
Provides some fake data to play around with.... | CloudNcodeInc/silk | tests/tests/test_lib/mock_suite.py | Python | mit | 6,446 |
import unittest
from PySide.QtGui import QLayout, QWidget, QGraphicsLayout, QGraphicsLayoutItem, QTextCursor, QPrinter
from helper import UsesQApplication
class Layout(QLayout):
def __init__(self):
QLayout.__init__(self)
class GraphicsLayout(QGraphicsLayout):
def __init__(self):
QGraphicsLayo... | M4rtinK/pyside-android | tests/QtGui/returnquadruplesofnumbers_test.py | Python | lgpl-2.1 | 1,993 |
import unittest
class Solution:
def __init__(self):
self.result = []
def readBinaryWatch(self, num):
"""
:type num: int
:rtype: List[str]
"""
self._read(num, 0, 0, 0)
return self.result
def _read(self, num, hour, minute, start_index):
if n... | chrisxue815/leetcode_python | problems/test_0401_backtrack.py | Python | unlicense | 1,495 |
from .crf_model_wrapper import CrfModelWrapper
from .requisition_model_wrapper import RequisitionModelWrapper
| botswana-harvard/edc-visit-schedule | edc_visit_schedule/model_wrappers/__init__.py | Python | gpl-2.0 | 110 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2019-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | forkbong/qutebrowser | qutebrowser/misc/debugcachestats.py | Python | gpl-3.0 | 1,694 |
from gffutils import parser, feature, helpers, constants
def test_feature_from_line():
# spaces and tabs should give identical results
line1 = "chr2L FlyBase exon 7529 8116 . + . Name=CG11023:1;Parent=FBtr0300689,FBtr0300690"
line2 = "chr2L FlyBase exon 7529 8116 . + . Name=CG11023:1;Parent=FBtr0300689,FBt... | daler/gffutils | gffutils/test/feature_test.py | Python | mit | 5,714 |
import logging.config
import structlog
timestamper = structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M:%S")
pre_chain = [
# Add the log level and a timestamp to the event_dict if the log entry
# is not from structlog.
structlog.stdlib.add_log_level,
timestamper,
]
logging.config.dictConfig({
"version": 1,
"d... | semanticbits/survey_stats | src/survey_stats/log.py | Python | bsd-2-clause | 1,619 |
from model.group import Group
from random import randrange
def test_delete_some_group(app):
if app.group.count() == 0:
app.group.create(Group(name="test"))
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
app.group.delete_group_by_index(index)
new_groups = app.grou... | fiore24/python_training | test/test_del_group.py | Python | apache-2.0 | 460 |
from __future__ import with_statement
"""
An RPython implementation of sockets based on rffi.
Note that the interface has to be slightly different - this is not
a drop-in replacement for the 'socket' module.
"""
# XXX this does not support yet the least common AF_xxx address families
# supported by CPython. See http:... | oblique-labs/pyVM | rpython/rlib/rsocket.py | Python | mit | 55,435 |
#!/usr/bin/python
"""
This is a unittest for qemu_qtree library.
:author: Lukas Doktor <ldoktor@redhat.com>
:copyright: 2012 Red Hat, Inc.
"""
__author__ = """Lukas Doktor (ldoktor@redhat.com)"""
import unittest
import common
from autotest.client.shared.test_utils import mock
import qemu_qtree
OFFSET_PER_LEVEL = qe... | ypu/virt-test | virttest/qemu_qtree_unittest.py | Python | gpl-2.0 | 10,740 |
# -*- 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/ape/v20200513/errorcodes.py | Python | mit | 1,570 |
'''
Copyright (c) 2017 Vanessa Sochat
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, distribute... | vsoch/docfish | docfish/apps/pubmed/views.py | Python | mit | 3,474 |
# SPDX-License-Identifier: GPL-2.0
"""
Built-in function tests.
"""
def test(conf):
assert conf.oldaskconfig() == 0
assert conf.stdout_contains('expected_stdout')
assert conf.stderr_matches('expected_stderr')
| koct9i/linux | scripts/kconfig/tests/preprocess/builtin_func/__init__.py | Python | gpl-2.0 | 222 |
import datetime
from typing import Optional, Union
import dateutil.parser
import h5py
import numpy as np
import scipy.constants
from ... import classes2
from ...misc.errorvalue import ErrorValue
# noinspection PyMethodOverriding
class Header(classes2.Header):
_data = None
@classmethod
def new_from_file... | awacha/sastool | sastool/io/credo_cpth5/header.py | Python | bsd-3-clause | 12,984 |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon Pinpoint"
prefix = "mobiletargeting"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
... | cloudtools/awacs | awacs/mobiletargeting.py | Python | bsd-2-clause | 6,372 |
# -*- coding: utf-8 -*-
from module.plugins.internal.SimpleCrypter import SimpleCrypter
class ShareRapidComFolder(SimpleCrypter):
__name__ = "ShareRapidComFolder"
__type__ = "crypter"
__pattern__ = r"http://(?:www\.)?((share(-?rapid\.(biz|com|cz|info|eu|net|org|pl|sk)|-(central|credit|free|net)\.cz|-ms\.... | chaosmaker/pyload | module/plugins/crypter/ShareRapidComFolder.py | Python | gpl-3.0 | 730 |
# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
from lp.services.webapp.publisher import canonical_url
from lp.testing.breadcrumbs import BaseBreadcrumbTestCase
class TestHasSpecificationsBreadcrumbO... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/blueprints/browser/tests/test_breadcrumbs.py | Python | agpl-3.0 | 2,264 |
import io
import factory
import datetime
from PIL import Image
from django.conf import settings
from factory.django import DjangoModelFactory, ImageField
from django.utils import timezone
from allauth.account.models import EmailAddress
from manopozicija import models
from manopozicija import services
class EmailA... | sirex/manopozicija.lt | manopozicija/factories.py | Python | agpl-3.0 | 10,988 |
#!/usr/bin/env python2.7
import sys
import csv
import pprint
import re
import gnupg
import os
gpg = gnupg.GPG(gnupghome=os.environ['CONTACTDB_HOME'] + '/.gnupg/')
#def get_pgpkey(key_id):
#
def extract_workinghours(field):
# input format:
# 09:00 to 17:00 Monday to Friday except public holidays.
... | certtools/contactdb | old2/old/contrib/TI-import.py | Python | agpl-3.0 | 5,623 |
import sys
sys.path.append('..')
from src.sim import Sim
from src.node import Node
from src.link import Link
from src.transport import Transport
from tcp import TCP
from networks.network import Network
import optparse
import os
import subprocess
class AppHandler(object):
def __init__(self,filename):
sel... | freedomflyer/test | lab2/transfer.py | Python | gpl-2.0 | 3,031 |
import talon
import encoder
# setting up the ciphertext
ciphertext = ''
keyphrase = 'CARDCIPHERCARDCIPHER'
plaintext = "ABAB"*25
plaintext *= 5200
deck = [i for i in xrange(1,53)]
c = talon.Cipher()
#c.prepare_deck(deck)
for char in keyphrase:
c.mix_deck(deck)
deck = c.count_cut(deck, encoder.plist.index(cha... | atoponce/cardciphers | talon/coincidences.py | Python | gpl-3.0 | 1,121 |
import sys
import os
from collections import defaultdict
from omim import OMIM
class Labels:
def __init__(self, labels_dir=None, gmt=None, pos_label='1', neg_label='-1'):
self._standards = {}
if labels_dir:
for labels_file in os.listdir(labels_dir):
pos_genes, neg_gen... | FunctionLab/function | flib/core/labels.py | Python | gpl-3.0 | 2,468 |
'''
Picker class for Panda3d.
Created on Oct 31, 2017
@author: consultit
'''
from panda3d.core import CollisionTraverser, CollisionHandlerQueue, CollisionNode, CollisionRay, \
BitMask32, LPoint3f, NodePath, CardMaker
from direct.showbase.ShowBase import ShowBase
class Picker(object):
'''
A class for pi... | consultit/Ely | test/direct/picker.py | Python | lgpl-3.0 | 7,225 |
"""
Tahoma library
~~~~~~~~~~~~~~
:copyright: (c) 2016 by Benjamin Pannier.
:license: Apache 2.0, see LICENSE for more details.
"""
from .action import Action, Command
from .actionGroup import ActionGroup
from .device import Device
from .event import Event, DeviceStateChangedEvent, ExecutionStateChangedEvent, Command... | bpannier/TahomaProtocol | tahoma/__init__.py | Python | apache-2.0 | 599 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
#将uninx转换为date的时间格式
def timestamp_datetime(value):
format = '%Y-%m-%d %H:%M:%S'
value = time.localtime(value)
dt = time.strftime(format,value)
return dt
def datetime_timestamp(value):
time.strptime(value, '%m/%d/%Y:%H:%M:%S')
#将字符串转化为指定... | zhangyage/Python-oldboy | log-an/change_time.py | Python | apache-2.0 | 552 |
# Copyright (c) 2020 DDN. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
from chroma_core.services import log_register
from chroma_core.services.power_control.rpc import PowerControlRpc
log = log_register(__name__)
class PowerControlClien... | intel-hpdd/intel-manager-for-lustre | chroma_core/services/power_control/client.py | Python | mit | 1,015 |
from lis.specimen.lab_aliquot_list.models import BaseAliquotCondition
from lis.specimen.lab_aliquot_list.managers import AliquotConditionManager
class AliquotCondition(BaseAliquotCondition):
objects = AliquotConditionManager()
class Meta:
app_label = 'lab_clinic_api'
| botswana-harvard/edc-lab | old/lab_clinic_api/models/aliquot_condition.py | Python | gpl-2.0 | 288 |
from django.template import Library
from browser.models import *
from collections import defaultdict
register = Library()
@register.filter(name="get_range")
def get_range(value, offset=0):
return range(offset, value+offset)
@register.filter
def get_years(coursegroup):
years = [ p.year for p in coursegroup... | erickpeirson/mbl-browser | browser/templatetags/app_filters.py | Python | gpl-3.0 | 4,343 |
########################################################################
# Rancho - Open Source Group/Project Management Tool
# Copyright (C) 2008 The Rancho Team
#
# 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... | joaquimrocha/Rancho | rancho/message/management.py | Python | agpl-3.0 | 1,442 |
from pytest import mark
import sqlalchemy as sa
from sqlalchemy_continuum import version_class
from tests import TestCase, create_test_cases
class ColumnAliasesBaseTestCase(TestCase):
def create_models(self):
class TextItem(self.Model):
__tablename__ = 'text_item'
__versioned__ = ... | avilaton/sqlalchemy-continuum | tests/test_column_aliases.py | Python | bsd-3-clause | 1,935 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | differentiable_data_selection/common_utils.py | Python | apache-2.0 | 22,272 |
'''
DoctorSpaceBot by MadScotty
BEGIN LICENSE
By existing on the same mortal coil as the author of this software you hereby
allow the author, henceforth known as Dr. Awesomeweiner, to sleep on your couch,
watch your television, and use your microwave. By reading this license you agree
that Lord Satan isn't as bad ... | MadScotty/DoctorSpaceBot | ship_lookup.py | Python | gpl-3.0 | 10,342 |
from dft import common
def define():
l = common(dim=3, n_eigs=7)
return l
def fun_v( ts, coor, region, ig, mode = None, vhxc = None ):
import numpy as nm
if vhxc is None:
vhxc = 0.0
out = {}
C = 0.5
r = nm.sqrt( coor[:,0]**2 + coor[:,1]**2 + coor[:,2]**2 )
vc = - C * 5.0 / r
... | certik/sfepy | input/quantum/dft3d.py | Python | bsd-3-clause | 371 |
# 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
# d... | gandelman-a/neutron-lbaas | neutron_lbaas/tests/tempest/lib/services/volume/v2/json/snapshots_client.py | Python | apache-2.0 | 833 |
#
# spyne - Copyright (C) Spyne contributors.
#
# This library 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 2.1 of the License, or (at your option) any later version.
#
# This libra... | arskom/spyne | spyne/client/http.py | Python | lgpl-2.1 | 2,536 |
"""Undocumented Module"""
__all__ = ['DirectObject']
from direct.directnotify.DirectNotifyGlobal import directNotify
from .MessengerGlobal import messenger
class DirectObject:
"""
This is the class that all Direct/SAL classes should inherit from
"""
def __init__(self):
pass
#def __del__... | tobspr/panda3d | direct/src/showbase/DirectObject.py | Python | bsd-3-clause | 3,514 |
var_3 = var_3
var_4 = 1
<weak_warning descr="Assignment can be replaced with augmented assignment">var_6 = var_6 + var_4</weak_warning>
#PY-2482
<weak_warning descr="Assignment can be replaced with augmented assignment">var = 2 + var</weak_warning>
| asedunov/intellij-community | python/testData/inspections/PyAugmentAssignmentInspection/numeric.py | Python | apache-2.0 | 252 |
"""
"""
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.Utilities.CFG import CFG
from DIRAC.Core.Utilities import List
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
from DIRAC.Core.Utilities.JDL import loadJDLAsCFG, dumpCFGAsJDL
from DIRAC.WorkloadManagementSystem.Agent.SiteDirector import... | andresailer/DIRAC | WorkloadManagementSystem/Client/JobState/JobManifest.py | Python | gpl-3.0 | 8,502 |
#(C) 2018 Muthiah Annamalai
# This file is part of Open-Tamil project
# You may use or distribute this file under terms of MIT license
class Tree:
"""
Implement binary Huffman codes
Ref: https://www2.cs.duke.edu/csed/poop/huff/info/
"""
def __init__(self,val,prob):
self.value = val
... | Ezhil-Language-Foundation/open-tamil | tamilmorse/huffman.py | Python | mit | 2,966 |
# -*- coding: UTF-8 -*-
"""
Package-wide constants.
"""
CALL = 'C'
PUT = 'P'
| zzzoidberg/landscape | finance/consts.py | Python | mit | 78 |
# -*- coding: utf-8 -*-
""" S3 Synchronization
@copyright: 2011-15 (c) Sahana Software Foundation
@license: MIT
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
re... | flavour/Turkey | modules/s3/s3sync.py | Python | mit | 29,149 |
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard 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 th... | xtiankisutsa/MARA_Framework | tools/androwarn/androguard/core/bytecodes/apk.py | Python | lgpl-3.0 | 30,879 |
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
# License: GPL2 or later see COPYING
import os.path
from mockbuild.trace_decorator import traceLog, getLog
from mockbuild import util
requires_api_version = "1.1"
class CompressLogsPlugin(object):
"""Compress logs in resultdir."""
... | heysion/mock_clone | py/mockbuild/plugins/compress_logs.py | Python | gpl-2.0 | 1,192 |
# Greg Suner and Alex Ciarmella
# Concrete Player Class
import Player
import Message
class GSACPlayer(Player.Player):
def __init__(self):
# Call super class constructor
Player.Player.__init__(self)
self.reset()
self.name = "Alex and Greg"
def play(self):
return R... | geebzter/game-framework | GSACPlayer.py | Python | apache-2.0 | 3,258 |
import unittest
from typing import List
import utils
# O(V+E) time. O(V) space. Graph, DFS, backtracking.
class Solution:
def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]:
visited = [False] * len(graph)
path = [0]
paths = []
def dfs(i):
if i =... | chrisxue815/leetcode_python | problems/test_0797_dfs.py | Python | unlicense | 831 |
from TM1py.Services.AnnotationService import AnnotationService
from TM1py.Services.ApplicationService import ApplicationService
from TM1py.Services.CellService import CellService
from TM1py.Services.ChoreService import ChoreService
from TM1py.Services.CubeService import CubeService
from TM1py.Services.DimensionService ... | OLAPLINE/TM1py | TM1py/Services/__init__.py | Python | mit | 1,114 |
# Copyright 2013 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.
"""Finds desktop browsers that can be controlled by telemetry."""
import logging
import os
import subprocess
import sys
from telemetry.core import exception... | Chilledheart/chromium | tools/telemetry/telemetry/internal/backends/chrome/desktop_browser_finder.py | Python | bsd-3-clause | 11,222 |
# -*- coding: utf-8 -*-
"""
ast
~~~
The `ast` module helps Python applications to process trees of the Python
abstract syntax grammar. The abstract syntax itself might change with
each Python release; this module helps to find out programmatically what
the current grammar looks like and allows... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/ast.py | Python | epl-1.0 | 11,347 |
import rospy
import smach
import smach_ros
from std_msgs.msg import Float32, String
import time
from Robosub.msg import ModuleEnableMsg
from SubImageRecognition.msg import ImgRecObject
from utils import dive, turn, forward, strafe, ScanNarrow, move
class NewBuoyTask(smach.State):
def __init__(self):... | USU-Robosub/Gilligan | rosWorkspace/Brain/src/tasks/NewBuoyTask.py | Python | apache-2.0 | 3,363 |
# Any git command can check for the upconvert from bloom -> config_branch
from bloom.config import upconvert_bloom_to_config_branch
upconvert_bloom_to_config_branch()
| 130s/bloom | bloom/commands/git/__init__.py | Python | bsd-3-clause | 169 |
import datetime
import tables
from sapphire import esd
DATAFILE = 'data.h5'
START = datetime.datetime(2016, 1, 1)
END = datetime.datetime(2016, 1, 2)
if 'data' not in globals():
data = tables.open_file(DATAFILE, 'a')
if '/s501' not in data:
esd.download_data(data, '/s501', 501, START, END)
| HiSPARC/sapphire | doc/scripts/simple-download-with-checks.py | Python | gpl-3.0 | 305 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
i... | onshape-public/onshape-clients | python/onshape_client/oas/api/drawings_api.py | Python | mit | 23,491 |
import os,sys
import numpy as np
import mne
from jumeg.jumeg_base import JuMEG_Base_IO
#print "########## Refchan geo data:"
# This is just for info to locate special 4D-refs.
#for iref in refpick:
# print raw.info['chs'][iref]['ch_name'],
#raw.info['chs'][iref]['loc'][0:3]
#fname=opt.fname,path=opt.path,verbose... | fboers/jumegX | tsvgl/io/jumeg_tsv_io_data.py | Python | bsd-3-clause | 3,441 |
# coding: utf-8
import os
import time
# 父进程
ret = os.fork()
if ret == 0:
print('---process-1---')
else:
print('---process-2---')
# 父子进程
ret = os.fork()
if ret == 0:
print('---process-11---')
else:
print('---process-22---')
# fork 炸弹,不能执行
# while 1:
# os.fork() | kaideyi/KDYSample | kYPython/FluentPython/BasicLearn/OOP/Fork3.py | Python | mit | 301 |
import inspect
import time
from functools import wraps
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.python import log
def profile(func):
"""
Simple profile decorator, monitors method execution time
"""
@inlineCallbacks
def callme(*args, **kwargs):
start = t... | eallik/spinoff | spinoff/util/meta.py | Python | bsd-2-clause | 864 |
import json
from geo.models import *
from geo.forms import *
from hgl.settings.local import GOOGLE_API
from django.contrib.gis.geos import Point, MultiPoint, LineString, MultiPolygon
from django.contrib.gis.geos import GEOSGeometry, GeometryCollection
from django.template import RequestContext
from django.shortcuts im... | kingsdigitallab/hgl-django | geo/views.py | Python | gpl-2.0 | 9,473 |
# -*- coding: utf-8 -*-
'''Deprecated np_extractors module. Import ``textblob.np_extractors`` instead.
'''
from textblob.np_extractors import *
| bbengfort/TextBlob | text/np_extractors.py | Python | mit | 145 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# mdflush Trace md flush events.
# For Linux, uses BCC, eBPF.
#
# Todo: add more details of the flush (latency, I/O count).
#
# Copyright 2016 Netflix, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
#
# 13-Feb-2015 Brend... | brendangregg/bcc | tools/mdflush.py | Python | apache-2.0 | 2,074 |
"""Declare basic string types unambiguously for various Python versions.
Authors
-------
* MinRK
"""
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import sys
if sys.version_info[0] >= 3:
bytes = bytes
unicode = str
basestring = (bytes, unicode)
else:
uni... | yyt030/pyzmq | zmq/utils/strtypes.py | Python | bsd-3-clause | 1,202 |
from boiler import *
class TestRadialResolution(unittest.TestCase):
def test_cylinder_radial_resolution_scad(self):
c = Cylinder(h=10, r=20, fn=10, fa=1)
answer = "cylinder(r=20.0, h=10.0, center=false, $fn=10.0);"
code_compare(c.render_scad(), answer)
c.fn = 0
answer = "cyl... | vishnubob/pyscad | tests/test_radial_resolution.py | Python | mit | 692 |
import numpy as np
from netCDF4 import Dataset
f = Dataset("../data/ocean_avg_0014.nc")
i, j = 66, 92
k = 28 # near surface
n = 3 # time step
print("i,j,k,n = ", i, j, k, n)
H = f.variables["h"]
M = f.variables["mask_rho"]
print("H = ", H[j, i])
print("M = ", M[j, i])
U = f.variables["u"]
V = f.variables["v"]
p... | bjornaa/ladim | examples/outline/sjekk.py | Python | mit | 415 |
import os
from buildings.models import BuildingFloor, Campus
from django.contrib.gis.db import models as gis_model
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.db.models.signals import post_delete
from django.dispatch.dispatcher import receiver
from django.utils.transl... | indrz/indrz | indrz/poi_manager/models.py | Python | gpl-3.0 | 5,972 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 t... | ai-se/SPL | ProductLine/dimacs_parser.py | Python | mit | 3,083 |
import sys
from itertools import ifilter
from requests_oauthlib import OAuth1Session
from requests.exceptions import ChunkedEncodingError
import json
import time
import datetime
from DataSource import DataSource
def isVideo(tweet):
"""Returns True if a tweet had a video uploaded with it, false otherwise."""
if '... | abessou/w251-FinalProject | code/sources/TwitterDataIngestSource.py | Python | mit | 9,958 |
"""SCons.Conftest
Autoconf-like configuration support; low level implementation of tests.
"""
#
# Copyright (c) 2003 Stichting NLnet Labs
# Copyright (c) 2001, 2002, 2003 Steven Knight
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation file... | stonekyx/binary | vendor/scons-local-2.3.4/SCons/Conftest.py | Python | gpl-3.0 | 27,721 |
"""Implementation of RootOf class and related tools. """
from __future__ import print_function, division
from sympy.core import (S, Expr, Integer, Float, I, Add, Lambda, symbols,
sympify, Rational, Dummy)
from sympy.core.cache import cacheit
from sympy.core.function import AppliedUndef
from sympy.functions.el... | AunShiLord/sympy | sympy/polys/rootoftools.py | Python | bsd-3-clause | 30,338 |
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# 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,... | kiniou/qtile | libqtile/sh.py | Python | mit | 8,873 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the MacKeeper Cache event formatter."""
import unittest
from plaso.formatters import mackeeper_cache
from tests.formatters import test_lib
class MacKeeperCacheFormatterTest(test_lib.EventFormatterTestCase):
"""Tests for the MacKeeper Cache event formatter.""... | ostree/plaso | tests/formatters/mackeeper_cache.py | Python | apache-2.0 | 1,008 |
#/usr/bin/python2.7
import json, urllib2
# API Endpoints
BASE_URL = "http://a.4cdn.org/"
ALL_BOARDS_URL = BASE_URL + "boards.json"
BOARD_URL = BASE_URL + "%s/threads.json"
THREAD_URL = BASE_URL + "%s/thread/%s.json"
class Post:
def __init__(self, data, b):
self.board = b
self.id = data["no"]
... | DW3B/pychan | pychan/__init__.py | Python | mit | 4,785 |
# Copyright 2021, 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-research/mint | mint/ctl/single_task_trainer_test.py | Python | apache-2.0 | 2,020 |
#!/usr/bin/python2
'''
This is an example of how to build a simple generator
'''
def my_reverse(data):
for index in range(len(data) - 1, -1, -1):
yield data[index]
for char in my_reverse('golf'):
print(char)
'''
Notice that 'my_reverse' is still recognized as a plain function and not
'generator' or... | nonZero/demos-python | src/examples/short/iteration/iterator_generator.py | Python | gpl-3.0 | 652 |
from django.contrib import admin
# Register your models here.
from tardis import models
admin.site.register(models.Trip, admin.ModelAdmin)
| ptevans/django-tardis | tardis/admin.py | Python | mit | 142 |
#!/usr/bin/env python
#
# Copyright (c) Vicent Marti. All rights reserved.
#
# This file is part of clar, distributed under the ISC license.
# For full terms see the included COPYING file.
#
from __future__ import with_statement
from string import Template
import re, fnmatch, os, codecs, pickle
class Module(object):
... | duralog/node-sencillo | deps/libgit2/tests-clar/generate.py | Python | mit | 6,148 |
"""Support for ANEL PwrCtrl switches."""
from datetime import timedelta
import logging
from anel_pwrctrl import DeviceMaster
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
import homeassistant.h... | tboyce021/home-assistant | homeassistant/components/anel_pwrctrl/switch.py | Python | apache-2.0 | 3,005 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-18 00:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reports', '0025_auto_20170518_0955'),
]
operations = [
migrations.AlterField(... | MartinPaulo/ReportsAlpha | reports/migrations/0026_auto_20170518_1001.py | Python | gpl-3.0 | 1,755 |
#coding:utf-8
bind = 'unix:/var/run/gunicorn.sock'
workers = 4
# you should change this
user = 'root'
# maybe you like error
loglevel = 'debug'
errorlog = '-'
logfile = '/var/log/gunicorn/debug.log'
timeout = 300
secure_scheme_headers = {
'X-SCHEME': 'https',
}
x_forwarded_for_header = 'X-FORWARDED-FOR'
| chenke91/ckPermission | settings.py | Python | mit | 313 |
from sys import stderr
from urlparse import urlparse, urljoin
from urllib import urlencode
from itertools import count
from hashlib import sha1
import json
from socket import getaddrinfo, AF_INET, SOCK_STREAM
from xml.etree.ElementTree import fromstring as parse_xml
from requests import get, post
api_defaults = dict... | codeforamerica/DNS-Service | cfa_dns/api.py | Python | isc | 4,496 |
# -*- coding: utf-8 -*-
# Copyright (C) 2007-2018, Raffaele Salmaso <raffaele@salmaso.org>
#
# 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... | rsalmaso/django-babeljs | babeljs/version.py | Python | mit | 1,758 |
'''
Copyright (C) 2013 Rasmus Eneman <rasmus@eneman.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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is... | Pajn/RAXA-Django | automation/plugin_mounts.py | Python | agpl-3.0 | 3,296 |
# -*- coding: utf-8 -*-
import gnupg
import shutil
import yaml
from humanfriendly import parse_size
from jinja2 import Environment, PackageLoader
from json import load, dumps
from os import makedirs, mkdir, chmod, environ, listdir, remove, stat
from os.path import exists, isdir, join, splitext, getmtime, split
from dat... | tomster/briefkasten | application/briefkasten/dropbox.py | Python | bsd-3-clause | 19,173 |
"""
Django settings for demo project.
Generated by 'django-admin startproject' using Django 3.0.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Bu... | williamlagos/django-shipping | demo/demo/settings.py | Python | lgpl-3.0 | 3,082 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | xuleiboy1234/autoTitle | tensorflow/tensorflow/python/profiler/model_analyzer.py | Python | mit | 12,780 |
import os
import pathlib
import time
import traceback
import Ice
import IceStorm
from rich.console import Console, Text
console = Console()
class Publishes:
def __init__(self, ice_connector, topic_manager):
self.ice_connector = ice_connector
self.mprx={}
self.topic_manager = topic_man... | Kmayankkr/robocomp | tools/robocompdsl/test/resources/reference_components/test_subStatesTestPython/src/interfaces.py | Python | gpl-3.0 | 5,349 |
# 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... | kevin-coder/tensorflow-fork | tensorflow/python/autograph/impl/conversion_test.py | Python | apache-2.0 | 6,484 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.