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 |
|---|---|---|---|---|---|
__source__ = 'https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/populating-next-right-pointers-in-each-node-ii.py
# Time: O(n)
# Space: O(1)
# BFS
#
# Description: Leetcode # 117. Populating Next Right Pointers in Each Node II
#
# F... | JulyKikuAkita/PythonPrac | cs15211/PopulatingNextRightPointersinEachNodeII.py | Python | apache-2.0 | 4,795 |
import mechanize
br = mechanize.Browser()
br.set_handle_equiv(True)
br.set_handle_gzip(True)
br.set_handle_redirect(True)
br.set_handle_referer(True)
br.set_handle_robots(False)
# Follows refresh 0 but not hangs on refresh > 0
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
#br.set_debug_ht... | exedre/webscraping-course-2014 | esempi/mechanize1.py | Python | gpl-2.0 | 1,386 |
###
# Copyright 2008-2011 Diamond Light Source Ltd.
# This file is part of Diffcalc.
#
# Diffcalc 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 late... | DiamondLightSource/diffcalc | test/diffcalc/gdasupport/scannable/test_parameter.py | Python | gpl-3.0 | 1,337 |
#!/usr/bin/python2.7
import sys
import csv
import yaml
import codecs
TO_BE_TRANSLATED_MARK = "***TO BE TRANSLATED***"
def collect(result, node, prefix=None):
for key,value in node.items():
new_prefix = (key if prefix == None else prefix + "." + key)
if isinstance(value, dict):
collect(... | shimarin/discourse-ja-translation | yaml2csv.py | Python | gpl-2.0 | 1,474 |
#~ import sensors
import time
HAS_REAL_ROBOT = True
HAS_RAZOR = False
#############
# PARAMATERS
#############
### Robot config ###
FULL_POPPY_HUMANOID = True
robot_configuration_file = "/home/poppy/poppy.json" #Needed only if FULL_POPPY_HUMANOID is False
###
#TODO: when we have several functions of that type, c... | HumaRobotics/poppy-walk | main.py | Python | gpl-2.0 | 1,936 |
"""
Module contains class needed for adding and compressing data from directory.
"""
import os
import os.path as op
import re
class VersionsProcessor(object):
def __init__(self, directory_processor):
self._directory_processor = directory_processor
def setDirectoryProcessor(self, directory_processor... | zpp-2014-15/deltacompression | deltacompression/backend/versions_processor.py | Python | mit | 1,968 |
#!/usr/bin/env python3
import sys
def main(args):
#cnt = 2017
cnt = 50000000
n = 3
n = 345
size = 0
buf = [0]
pos = 0
at_1 = None
for i in range(cnt):
pos = (pos + n) % (i+1)
if pos == 0:
at_1 = i+1
pos += 1
print(at_1)
if __name__ == '__... | msullivan/advent-of-code | 2017/17b.py | Python | mit | 358 |
from parseJSONdata import parseData
# Edit Here
negativeFileName = 'md_neg_'
postiveFileName = 'md_pos_'
neutralFileName = 'md_neu_'
numNegativ = 20
numPositive = 1
numNeutral = 3
parseData(negativeFileName, postiveFileName, neutralFileName, numNegativ, numPositive, numNeutral) | cs591B1-Project/Social-Media-Impact-on-Stock-Market-and-Price | data/17 mcdonalds/mddataParse.py | Python | mit | 280 |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
服务器4进程,开4个端口
客户端8进程,每进程40000次echo请求
real 0m19.643s
user 0m24.450s
sys 0m6.231s
QPS=32w/20s=1.6w
"""
import socket
import time
from threading import Thread
from multiprocessing import Process
import sys
sys.path.append('../../src/util/')
from pys_define import *... | dungeonsnd/test-code | dev_examples/pyserver/test/client/client_procedure.py | Python | gpl-3.0 | 2,598 |
#!/usr/bin/python2
import unittest
from ipapython.dn import *
def expected_class(klass, component):
if klass is AVA:
if component == 'self':
return AVA
elif klass is RDN:
if component == 'self':
return RDN
elif component == 'AVA':
return AVA
e... | msimacek/freeipa | ipatests/test_ipapython/test_dn.py | Python | gpl-3.0 | 45,314 |
from __future__ import absolute_import
"""
The actual record-keeping part of Cirdan.
"""
import inspect
import itertools
import re
from collections import OrderedDict
class Resource:
def __init__(self, cls):
self.title = cls.__name__
self.path = "???"
self.description = None
self... | forana/python-cirdan | cirdan/registry.py | Python | mit | 2,823 |
# coding: utf-8
# Copyright (c) Henniggroup.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals, print_function
"""
Organism Creators module:
This module contains the classes used to create organisms for the initial
population.
1. RandomOrganismCreator: creates rand... | henniggroup/GASP-python | gasp/organism_creators.py | Python | mit | 28,520 |
## INFO ########################################################################
## ##
## plastey ##
## ======= ... | kitchenbudapest/vr | hud.py | Python | gpl-3.0 | 4,413 |
from kivy.vector import Vector
from cobiv.modules.core.entity import Entity
class GestureManager(Entity):
__touches = []
strategies = {}
current_strategy = None
strategy_candidates = []
stroke_list = {}
last_tick = None
first_tick = None
stroke_error_margin = 20
stroke_tick_time... | gokudomatic/cobiv | cobiv/modules/core/gestures/gesture_manager.py | Python | mit | 4,701 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# serialize.py
#
# Copyright 2013 tusharmakkar08 <tusharmakkar08@tusharmakkar08-Satellite-C660>
#
# 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 Fou... | tusharmakkar08/TRIE_Data_Structure | serialize.py | Python | mit | 1,972 |
#!/usr/bin/env python
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# gst-python
# Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; ... | freedesktop-unofficial-mirror/gstreamer__gst-python | old_examples/vumeter.py | Python | lgpl-2.1 | 3,454 |
#!/usr/bin/env python
#
# Copyright 2021 Malte Lenhart
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest
from gnuradio import blocks
import pmt
import time
# this test tests message strobe and message debug blocks against each other
# similar tes... | dl1ksv/gnuradio | gr-blocks/python/blocks/qa_message_strobe.py | Python | gpl-3.0 | 2,087 |
#**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. *
#* Contributors ... | ppribeli/AliPhysics | PWGJE/EMCALJetTasks/Tracks/analysis/util/TriggerTurnonCurve.py | Python | bsd-3-clause | 2,682 |
''' config module: various singleton configuration modules for PyHeron '''
__all__ = ['system_config']
| lewiskan/heron | heron/common/src/python/config/__init__.py | Python | apache-2.0 | 103 |
# -*- coding: utf-8 -*-
import os
import shutil
import unittest
import six
import pytest
import eyed3
from eyed3 import main, id3, core, compat
from . import DATA_D, RedirectStdStreams
def testPluginOption():
for arg in ["--help", "-h"]:
# When help is requested and no plugin is specified, use default
... | gaetano-guerriero/eyeD3-debian | src/test/test_classic_plugin.py | Python | gpl-3.0 | 34,165 |
from tree import *
if __name__ == '__main__':
root_node = Node(
5,
left=Node(3, left=Node(1, right=Node(2))),
right=Node(7, left=Node(6), right=Node(8))
)
tree = Tree(root_node)
print(tree)
print(tree.mirror())
| y-usuzumi/survive-the-course | random_questions/二叉树镜像/python/main.py | Python | bsd-3-clause | 257 |
'''
Sample custom functions plugin for formula XML Element, Attribute creation functions
>>> note that this function has been renamed xfi:create-element and moved to FunctionXfi.py <<<
(c) Copyright 2012 Mark V Systems Limited, All rights reserved.
'''
from arelle import XPathContext, XbrlUtil
from arelle.ModelValue ... | sternshus/arelle2.7 | svr-2.7/arelle/plugin/functionsXmlCreation.py | Python | apache-2.0 | 4,852 |
from mailsnake import MailSnake
from mailsnake.exceptions import *
import settings
import logging
ms = MailSnake(settings.MAILCHIMP_API_KEY)
lists = ms.lists()
logger = logging.getLogger(__name__)
def subscribe_user(user):
try:
ms.listSubscribe(
id=lists['data'][0]['id'],
email_... | reverie/jotleaf.com | jotleaf/marketing/email_marketing.py | Python | mit | 760 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import codecs
import fnmatch
import inspect
import io
import locale
import logging
import os
import re
import tarfile
import tempfile
import threading
from collections import defaultdict
from datetime import datetime
from... | t3dev/odoo | odoo/tools/translate.py | Python | gpl-3.0 | 48,503 |
__author__ = 'nash.xiejun'
import logging
import traceback
import os
from oslo.config import cfg
from common import config
from common.engineering_logging import log_for_func_of_class
import utils
from utils import AllInOneUsedCMD, print_log, ELog
from common.config import ConfigCommon
from services import RefServi... | Hybrid-Cloud/badam | engineering/engineering_factory.py | Python | apache-2.0 | 22,280 |
# This python script contains functions and classes used in the
# two synthetic galaxy model notebooks in this directory.
import astropy.io.ascii as asciitable
from scipy import interpolate
import numpy as np
def LoadData(galaxy_datafile, HIrad, ddensdR):
# Read the galaxy description file which contains rotatio... | JuanCab/synthetic_HI_models | galaxyparam.py | Python | gpl-3.0 | 3,144 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2012 smallevilbeast
#
# Author: smallevilbeast <houshao55@gmail.com>
# Maintainer: smallevilbeast <houshao55@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 ... | lovesnow/weido | src/ui/login.py | Python | gpl-3.0 | 5,368 |
# Copyright 2015, Thales Services SAS
# 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 requ... | openstack/horizon | openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py | Python | apache-2.0 | 2,639 |
from __future__ import absolute_import
import sys
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy.dialects.mysql import TINYINT, SMALLINT
from sqlalchemy.orm import subqueryload
from .base import BetterBase, session_scope
from .drop import DropAssociation
class Relic(BetterBase):
__tabl... | rEtSaMfF/ffrk-bottle | models/relic.py | Python | gpl-3.0 | 9,640 |
#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1beta1 import firestore_pb2
from google.firestore.v1be... | GoogleCloudPlatform/grpc-gcp-python | firestore/examples/end2end/src/Write.py | Python | apache-2.0 | 2,967 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from setuptools import setup, find_packages
setup(
name='PTestCase',
description='Parametrized tests support for python builtin unitest framework',
long_description=(
'Isolated test cases generated from a template met... | canni/ptestcase | setup.py | Python | bsd-2-clause | 1,385 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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,
... | Distrotech/scons | test/Configure/custom-tests.py | Python | mit | 4,466 |
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | xunxunzgq/open-hackathon-bak_01 | open-hackathon-client/src/client/database/db_adapters.py | Python | mit | 5,627 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("enhydris", "0028_remove_old_time_step")]
operations = [
migrations.RemoveField(model_name="timeseries", name="interval_type"),
migrations.DeleteModel(name="IntervalType"),
]
| openmeteo/enhydris | enhydris/migrations/0029_remove_interval_type.py | Python | agpl-3.0 | 296 |
'''
Copyright (c) <2012> Tarek Galal <tare2.galal@gmail.com>
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,
merg... | albert-chin/yowsup | yowsup/common/http/httpproxy.py | Python | gpl-3.0 | 3,283 |
# Timed mute: !tm <player> <seconds> <reason>
# default time 5 minutes, default reason None
# by topologist June 30th 2012
from scheduler import Scheduler
from commands import add, admin, get_player, join_arguments, name
@name('tm')
@admin
def timed_mute(connection, *args):
protocol = connection.protocol
... | Architektor/PySnip | contrib/scripts/timedmute.py | Python | gpl-3.0 | 1,733 |
import numpy
import six
from chainer.backends import cuda
from chainer.functions.array import permutate
from chainer.functions.array import transpose_sequence
from chainer.functions.connection import n_step_rnn as rnn
from chainer.initializers import normal
from chainer import link
from chainer.utils import argument
f... | rezoo/chainer | chainer/links/connection/n_step_rnn.py | Python | mit | 13,081 |
from corehq.apps.hqcase.dbaccessors import get_case_properties
from corehq.apps.users.cases import get_owner_id
from soil import DownloadBase
def export_cases(domain, cases, workbook, filter_group=None, users=None, all_groups=None, process=None):
by_user_id = dict([(user.user_id, user) for user in users]) if user... | qedsoftware/commcare-hq | corehq/apps/hqcase/export.py | Python | bsd-3-clause | 3,280 |
from fabric.contrib.files import exists
from fabric.api import run, cd
from .packages import ensure_package
from .utils import program_exists
def ensure_git_repo(path, url, pushurl=None, submodules=False):
if not exists(path):
if not program_exists('git'):
ensure_package('git')
run('git clone %s %s' % (url, pa... | yejianye/toolbox | fablibs/vcs.py | Python | apache-2.0 | 513 |
# -*- coding: utf8 -*-
from phystricks import *
def Grapheunsurunmoinsx():
pspict,fig = SinglePicture("Grapheunsurunmoinsx")
x=var('x')
f=phyFunction(1/(1-x))
eps=0.21
l=5
f1=f.graph(1-l,1-eps)
f2=f.graph(1+eps,1+l)
f1.parameters.color="red"
Ass=Segment( Point(1,f(1+eps)),Point(1,f(1-eps)) )
Ass.parameters... | Naereen/mazhe | phystricksGrapheunsurunmoinsx.py | Python | gpl-3.0 | 453 |
#!/usr/bin/python
"""
Program that parses standard format results,
compute and check regression bug.
:copyright: Red Hat 2011-2012
:author: Amos Kong <akong@redhat.com>
"""
from __future__ import division
import os
import sys
import re
import warnings
try:
import configparser as ConfigParser
except ImportError:
... | sathnaga/avocado-vt | scripts/regression.py | Python | gpl-2.0 | 21,208 |
from __future__ import absolute_import
from datetime import datetime
import time
import uuid
import json
from tzlocal import get_localzone
class RemindersService(object):
def __init__(self, service_root, session, params):
self.session = session
self.params = params
self._service_root = se... | b-jesch/service.fritzbox.callmonitor | resources/lib/PhoneBooks/pyicloud/services/reminders.py | Python | gpl-2.0 | 3,587 |
'''
.. _motionevent:
Motion Event
============
The :class:`MotionEvent` is the base class used for every touch and no-touch
event. This class define all the properties and methods needed to handle 2D and
3D position, but may have more capabilities.
.. note::
You never create the :class:`MotionEvent` yourself, t... | happy56/kivy | kivy/input/motionevent.py | Python | lgpl-3.0 | 15,062 |
from django.db import connection
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import (no_mysql, oracle, postgis,
spatialite, HAS_SPATIALREFSYS, SpatialRefSys)
from django.utils import unittest
test_srs = ({'srid' : 4326,
'auth_name' : ('EPSG', True),
'... | rebost/django | django/contrib/gis/tests/test_spatialrefsys.py | Python | bsd-3-clause | 6,715 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ipviking_django.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| norsecorp/ipviking-django | ipviking_django/manage.py | Python | bsd-2-clause | 258 |
#!/usr/bin/python
#
# 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 b... | wubr2000/googleads-python-lib | examples/adwords/v201502/campaign_management/set_criterion_bid_modifier.py | Python | apache-2.0 | 2,408 |
from django.db import models
class Snippet(models.Model):
"""A text snippet. Not meant for use by anyone other than a designer"""
name = models.CharField(max_length=255)
snippet = models.TextField(blank=True)
class Meta:
pass
def __unicode__(self):
return self.snippet... | callowayproject/django-snippets | snippets/models.py | Python | apache-2.0 | 321 |
"""Defines the Transcript object, which represents a row in a UCSC table.
"""
import itertools
from probe_generator import probe
from probe_generator.sequence_range import SequenceRange
_REQUIRED_FIELDS = (
# Fields which are assumed to exist by Transcript methods.
'name',
'exonStarts',
'exonEnds',
... | bcgsc/ProbeGenerator | probe_generator/transcript.py | Python | gpl-3.0 | 8,753 |
# -*- coding: utf-8 -*-
# Copyright 2015 Metaswitch Networks
#
# 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... | anortef/calico | calico/felix/test/test_fiptables.py | Python | apache-2.0 | 30,589 |
#!/usr/bin/env python3
# import cgitb
# cgitb.enable()
from arthash import fileappend
from arthash.experimental import hash_distributions
HEADER = """Content-Type: text/plain
"""
printer = print # noqa T001
def run_cgi(filename, hash_code):
printer(HEADER)
try:
fileappend.append_hash(filename, h... | arthash/arthash | arthash/old/cgi.py | Python | artistic-2.0 | 900 |
import os
import sys
import subprocess
import tempfile
from time import sleep
from os.path import exists, join, abspath
from shutil import rmtree, copytree
from tempfile import mkdtemp
from contextlib import contextmanager
from twisted.trial import unittest
from twisted.internet import defer
import scrapy
from scrapy... | umrashrf/scrapy | tests/test_commands.py | Python | bsd-3-clause | 11,211 |
"""Models for serialization of tests."""
from client.sources.common import core
class Test(core.Serializable):
name = core.String()
points = core.Float()
partner = core.String(optional=True)
def run(self, env):
"""Subclasses should override this method to run tests.
NOTE: env is inte... | Cal-CS-61A-Staff/ok-client | client/sources/common/models.py | Python | apache-2.0 | 2,352 |
# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | torufuru/oolhackathon | ryu/services/protocols/bgp/api/core.py | Python | apache-2.0 | 3,160 |
# -*- coding: utf-8 -*-
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from cms.api import copy_plugins_to_language
from cms.models import Title, Page
from cms.utils.i18n import get_language_list
class CopyLangCommand(BaseCommand)... | SinnerSchraderMobileMirrors/django-cms | cms/management/commands/subcommands/copy_lang.py | Python | bsd-3-clause | 2,406 |
# coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.... | angadpc/Alexa-Project- | twilio/rest/ip_messaging/v1/service/channel/member.py | Python | mit | 16,156 |
from moto import mock_cloudformation_deprecated, mock_ec2_deprecated
from moto import mock_cloudformation, mock_ec2
from tests import EXAMPLE_AMI_ID
from tests.test_cloudformation.fixtures import vpc_eni
import boto
import boto.ec2
import boto.cloudformation
import boto.vpc
import boto3
import json
import sure # noqa
... | william-richard/moto | tests/test_ec2/test_ec2_cloudformation.py | Python | apache-2.0 | 3,624 |
# Copyright (c) 2009-2010, Cloud Matrix Pty. Ltd.
# All rights reserved; available under the terms of the BSD License.
"""
esky.bdist_esky: distutils command to freeze apps in esky format
Importing this module makes "bdist_esky" available as a distutils command.
This command will freeze the given scripts and pac... | Darkman/esky | esky/bdist_esky/__init__.py | Python | bsd-3-clause | 34,079 |
import sys
if "../.." not in sys.path: sys.path.insert(0,"../..")
from gSLLexer import *
import ply.lex as lex
code = """0
1.0
5.25
1024e2
1024E2
1024e+2
1024E+2
512e5
512E5
10000e-2
10000E-2
3.14e2
3.14E2
25.00e-2
25.00E-2
"""
gLexer = gSLLexer()
lex.runmain(data = code)
| roskoff/gSL | tests/token_tests/lex_06_numbers.py | Python | gpl-2.0 | 274 |
from .warning_window import WarningWindow
from .monitor_window import MonitorWindowBase
from .text_entry import TextEntry
from .text_entry import Colors
| aserebryakov/godville-monitor-console | monitor/core/__init__.py | Python | gpl-2.0 | 154 |
import weakref
from python2.shared.codec import BaseDecodingSession, BaseEncodingSession
class ServerCodec():
def __init__(self, server):
self.server = weakref.proxy(server)
def encoding_session(self):
return ServerEncodingSession(self.server)
def encode(self, obj, depth):
retur... | nickgaya/python2 | python2/server/codec.py | Python | mit | 1,188 |
'''
Local File Publisher
Abstract:
The class contained within this module allows python programs to
publish weather conditions to a local text file. The format of the file is:
field value [value ...]
field value [value ...]
field value [value ...]
...
...
Each 'field' will begin on a separate line. Th... | cmcginty/PyWeather | weather/services/file.py | Python | gpl-3.0 | 2,266 |
#===============================================================================
# Copyright 2014 NetApp, Inc. All Rights Reserved,
# contribution by Jorge Mora <mora@netapp.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 ... | kofemann/nfstest | packet/application/dns_const.py | Python | gpl-2.0 | 10,472 |
# -*- coding: utf-8 -*-
import tempfile
import os
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.contrib import admin
from django.core.mail import EmailMessage
class Section(models.Model):
"""
A simple section that links to articles, to test linking to related ... | iguzu/gae-django | tests/regressiontests/admin_views/models.py | Python | bsd-3-clause | 13,438 |
from django import forms
from django.utils.translation import gettext_lazy as _
from TWLight.resources.models import Partner
from .models import Application
from ..users.helpers.authorizations import get_valid_partner_authorizations
"""
Lists and characterizes the types of information that partners can require as
pa... | WikipediaLibrary/TWLight | TWLight/applications/helpers.py | Python | mit | 11,898 |
#
# 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
# ... | redixin/rally-ci | tests/integrated/test_services_status.py | Python | apache-2.0 | 1,144 |
# Snapshot Example
#
# Note: You will need an SD card to run this example.
#
# You can use your OpenMV Cam to save image files.
import sensor, image, pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
sensor.set_framesize(sens... | openmv/openmv | scripts/examples/OpenMV/05-Snapshot/snapshot.py | Python | mit | 754 |
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial License Usage
## Licensees holding valid commercial ... | qtproject/pyside-pyside | tests/QtCore/bug_931.py | Python | lgpl-2.1 | 1,913 |
#!/usr/bin/env python
#The MIT License (MIT)
#Copyright (c) 2020 Massimiliano Patacchiola
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ... | mpatacchiola/deepgaze | examples/ex_corner_detection_video/ex_corner_detection.py | Python | mit | 5,486 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""Use blog post test to test user permissions logic"""
import frappe
import frappe.defaults
import unittest
import json
from frappe.desk.doctype.event.event import get_events
f... | ESS-LLP/frappe | frappe/desk/doctype/event/test_event.py | Python | mit | 4,053 |
"""scan URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | phat-plats/backend | scan/scan/urls.py | Python | mit | 984 |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.fbthrift as fbthrift
import specs.fmt as fmt
import specs.folly as folly
import spec... | nodakai/watchman | build/fbcode_builder/specs/fbzmq.py | Python | apache-2.0 | 1,473 |
"""Test the Emulated Hue component."""
from unittest.mock import MagicMock, Mock, patch
from homeassistant.components.emulated_hue import Config
def test_config_google_home_entity_id_to_number():
"""Test config adheres to the type."""
mock_hass = Mock()
mock_hass.config.path = MagicMock("path", return_va... | leppa/home-assistant | tests/components/emulated_hue/test_init.py | Python | apache-2.0 | 4,112 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4c2vhic | SHH_WT_models_highres/SHH_WT_models_highres_final_output_0.1_-0.1_5000/SHH_WT_models_highres40612.py | Python | gpl-3.0 | 88,200 |
import fontaine
import os
import os.path
import re
import unicodedata
from fontaine.ext.base import BaseExt
UNICODE_VALUE_REGEX = re.compile('^(?P<bx>0x)?(?P<begr>[0-9a-f]+)(\-(?!0x)(?P<endr>[0-9a-f]+))?', re.I)
INCLUDE_REGEX = re.compile('include ([\w]+.orth)', re.I | re.U | re.S)
dirname = os.path.dirname(fonta... | davelab6/pyfontaine | fontaine/ext/fontconfig.py | Python | gpl-3.0 | 3,314 |
#!/usr/bin/python
"""
PDU
"""
import re
import socket
import struct
try:
import netifaces
except ImportError:
netifaces = None
from .settings import settings
from .debugging import ModuleLogger, bacpypes_debugging, btox, xtob
from .comm import PCI as _PCI, PDUData
# pack/unpack constants
_short_mask = 0xFF... | JoelBender/bacpypes | py34/bacpypes/pdu.py | Python | mit | 24,712 |
# Copyright Alexander Baranin 2016
Logging = None
def onLoad(core):
global Logging
Logging = core.loaded_modules['engine.Logging']
Logging.logMessage('testmodules.TestBootstrap.onLoad()')
def onUnload():
Logging.logMessage('testmodules.TestBootstrap.onUnload()') | Boris-Barboris/PySubs | engine/testmodules/TestBootstrap.py | Python | apache-2.0 | 283 |
# Written by Patricia Suriana, MIT ca. 2013
import tasks
import ground
__all__ = ["ParseError", "parse"]
class ParseError(Exception):
pass
def parse(domain_file, problem_file):
domain_line = parse_nested_list(file(domain_file))
problem_line = parse_nested_list(file(problem_file))
domain = tasks.parse_doma... | LYZhelloworld/Courses | 50.021/02/code/planner/pddl_parser.py | Python | mit | 2,404 |
#!/usr/bin/python
import logging
from logging.handlers import RotatingFileHandler
from app import app
# Configuration
HOST = '0.0.0.0'
PORT = 5000
LOG_FILENAME = "dylansawesome.log"
# Logger
formatter = logging.Formatter(
"[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
handler = RotatingFil... | zinglax/SPA-BoilerPlate2017 | testing/watchdog/examplefiles/dylansawesome/run.py | Python | mit | 517 |
# Copyright 2021 The Kubeflow 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... | kubeflow/pipelines | sdk/python/kfp/components/structures_test.py | Python | apache-2.0 | 14,973 |
#!/usr/bin/python
from pycbc.scheme import *
from pycbc.types import *
from pycbc.waveform import *
import pycbc
from optparse import OptionParser
from math import sin, log
import gc
parser = OptionParser()
parser.add_option('--scheme','-s', type = 'choice',
choices = ('cpu','cuda','opencl'),
... | stevereyes01/pycbc | tools/timing/wav_perf.py | Python | gpl-3.0 | 2,498 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# 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 Li... | hyperized/ansible | lib/ansible/modules/network/eos/eos_vrf.py | Python | gpl-3.0 | 10,723 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from optparse import make_option
import sys
class GenericCommand(BaseCommand):
''' paloma postfix management
'''
args = ''
help = ''
model = None
option_list = BaseCommand.option_list + (
make_option(
... | hdknr/paloma | src/paloma/management/commands/__init__.py | Python | bsd-2-clause | 2,692 |
# 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... | kobejean/tensorflow | tensorflow/contrib/compiler/jit_test.py | Python | apache-2.0 | 12,205 |
# encoding: utf-8
def _unicode_truncate(ustr, length, encoding="UTF-8"):
"Truncate @ustr to specific encoded byte length"
bstr = ustr.encode(encoding)[:length]
return bstr.decode(encoding, 'ignore')
def extract_title_body(text, maxtitlelen=60):
"""Prepare @text: Return a (title, body) tuple
@text... | engla/kupfer | kupfer/textutils.py | Python | gpl-3.0 | 2,681 |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 l... | mo-g/iris | lib/iris/unit.py | Python | gpl-3.0 | 62,925 |
from unittest import TestCase
from settings import settings
from office365.outlookservices.outlook_client import OutlookClient
from office365.runtime.auth.authentication_context import AuthenticationContext
class OutlookClientTestCase(TestCase):
"""SharePoint specific test case base class"""
@classmethod
... | vgrem/SharePointOnline-REST-Python-Client | tests/outlook_case.py | Python | mit | 1,082 |
# Copyright 2014-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | nichung/wwwflaskBlogrevA | venv/lib/python2.7/site-packages/pymongo/ismaster.py | Python | mit | 3,733 |
from django.contrib import admin
#from ittc.capabilities.models import Server, Extent, Layer, Collection, CollectionMember, TileService, TileServiceType, ImageType
from ittc.capabilities.models import Server, Extent, Layer, Collection, CollectionMember, TileServiceType, ImageType
class ExtentAdmin(admin.ModelAdmin):
... | state-hiu/ittc-server-django | ittc/capabilities/admin.py | Python | mit | 2,008 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import training
from chainer.training import extensions
import chainermn
from chainermn.extensions import create_multi_node_checkpointer
class MLP(chainer.... | tkerola/chainer | examples/chainermn/mnist/train_mnist_checkpoint.py | Python | mit | 5,159 |
from daemon import Daemon
| samrocketman/globd | glib/__init__.py | Python | apache-2.0 | 26 |
from __future__ import print_function
from bokeh.client import push_session
from bokeh.document import Document
from bokeh.models.layouts import WidgetBox
from bokeh.models.widgets import (
Icon, Button, Toggle, Dropdown, CheckboxGroup, RadioGroup,
CheckboxButtonGroup, RadioButtonGroup,
)
def button_handler()... | phobson/bokeh | examples/models/buttons_server.py | Python | bsd-3-clause | 2,518 |
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
help = 'Updates a Site object.'
args = '<site id>'
option_list = BaseCommand.option_list + (
make_option('-s', '--site-id',
... | state-hiu/rogue_geonode | geoshape/core/management/commands/siteupdate.py | Python | gpl-3.0 | 1,253 |
# -*- coding:utf-8 -*-
import math
# 这个开始我还没有考虑dp什么那么多,自己想没有想出来,看了网上讨论.
# 假设台阶总是为100阶
# 分为51种情况,有0次两个台阶,有1次上两个台阶...有50次上两个台阶.
# 没有实现,太麻烦
# def count_stairs(n):
# if n % 2 == 0:
# count_2 = n / 2 + 1
# start = 3
# else:
# count_2 = (n + 1) / 2 + 1
# start = 2
#
# counts = 1... | xudongyangwork/algo | day8/xudy.py | Python | mit | 986 |
from builtins import *
from domain.channel import Channel
from domain.client import Client
from domain.protocol import Protocol
from system import hooks
from system.ircfactory import IRCFactory
from system.messagehandler import MessageHandler
from table import Table
from tablerow import TableRow
from util import logge... | yukaritan/kawaiirc | autodoc/autodoc.py | Python | gpl-2.0 | 4,824 |
#!/usr/bin/env python3
import numpy as np
import torch
import itertools
import argparse
import training
import data
import plotting
import model
def main(args):
np.random.seed(args.seed)
gens = data.instantiate_generators()
X, t_phn, t_spk = data.generate(gens, 100)
X_val, t_phn_val, t_spk_val = d... | ibenes/speaker-oblivious-bottlenecks | main.py | Python | apache-2.0 | 2,008 |
'''
https://leetcode.com/contest/weekly-contest-172/problems/maximum-69-number/
'''
class Solution:
def maximum69Number (self, num: int) -> int:
stk = []
while num > 0:
stk.append(num % 10)
num //= 10
done = False
while len(stk) > 0:
if not done an... | jan25/code_sorted | leetcode/weekly172/1_max69.py | Python | unlicense | 457 |
class Variants(object):
def __init__(self, file_path):
self.load_variants(file_path)
def load_variants(self, file_path):
variants = []
with open(file_path) as f:
for line in f:
tokens = line.split()
chrom, name, pos, coord, A1, A2 = tokens
... | dlrice/evoker-lite | evokerlite/variants.py | Python | gpl-3.0 | 1,658 |
"""
Benchmark to help choosing the best chunksize so as to optimize the
access time in random lookups.
"""
from time import time
import os
import subprocess
import numpy
import tables
# Constants
NOISE = 1e-15 # standard deviation of the noise compared with actual values
rdm_cod = ['lin', 'rnd']
def get_nrows(nr... | cpcloud/PyTables | bench/lookup_bench.py | Python | bsd-3-clause | 7,870 |
def square(x):
return x * x
| yehnan/python_book_yehnan | ch10/package_example/formats/bar.py | Python | gpl-2.0 | 38 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies 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 3 of the License, or
# (at your option) any later version.
... | noplay/gns3-gui | gns3/items/node_item.py | Python | gpl-3.0 | 16,117 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.