text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import os
import genapi
from genapi import TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi
import numpy_api
h_template = r"""
#ifdef _MULTIARRAYMODULE
typedef struct {
PyObject_HEAD
npy_bool obval;
} PyBoolScalarObject;
extern NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type;
extern NPY_NO... | teoliphant/numpy-refactor | numpy/core/code_generators/generate_numpy_api.py | Python | bsd-3-clause | 7,203 | 0.001944 |
# -*- coding: utf-8 -*-
"""
Traces: Activity Tracker
Copyright (C) 2015 Adam Rule
with Aurélien Tabard, Jonas Keper, Azeem Ghumman, and Maxime Guyaux
Inspired by Selfspy and Burrito
https://github.com/gurgeh/selfspy
https://github.com/pgbovine/burrito/
You should have received a copy of the GNU General Public License... | activityhistory/traces | traces/recorders/scroll_recorder.py | Python | gpl-3.0 | 1,355 | 0.01551 |
# Copyright 2018 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/ftc-object-detection | training/object_detector.py | Python | apache-2.0 | 4,142 | 0.007001 |
from __future__ import absolute_import, print_function
import unittest
from bokeh.application.spellings import ScriptHandler
from bokeh.document import Document
def _with_temp_file(func):
import tempfile
f = tempfile.NamedTemporaryFile()
try:
func(f)
finally:
f.close()
def _with_scri... | gpfreitas/bokeh | bokeh/application/spellings/tests/test_script.py | Python | bsd-3-clause | 2,526 | 0.003167 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stats', '0021_set_normalized_stress'),
]
operations = [
migrations.AddField(
model_name='scenario',
name='is_public',
field=mod... | UUDigitalHumanitieslab/timealign | stats/migrations/0022_scenario_is_public.py | Python | mit | 448 | 0.002232 |
import os
import posixpath
import re
import sys
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Dict
from typing import List
from typing import Tuple
from typing import Union
from urllib.parse import unquote
from urllib.parse import urlsplit
from urllib.request import url2pathname
if TYP... | python-poetry/poetry-core | src/poetry/core/packages/utils/utils.py | Python | mit | 10,888 | 0.000643 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-13 18:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myblog', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | NischalLal/Humpty-Dumpty-SriGanesh | myblog/migrations/0002_contact_project_socialsite.py | Python | bsd-3-clause | 1,637 | 0.002443 |
"""
A webdriver/selenium based scraper for San Francisco Board of Supervisors
voting data.
- Troy Deck (troy.deque@gmail.com)
"""
from selenium import webdriver
from datetime import date
import argparse
import time
import db
#############
# Constants #
#############
PATIENCE = 2 # Seconds to wait after executing a... | tdeck/grab-sf-votes | collect.py | Python | mit | 9,518 | 0.004728 |
"""Fixtures for Hass.io."""
import os
from unittest.mock import Mock, patch
import pytest
from homeassistant.components.hassio.handler import HassIO, HassioAPIError
from homeassistant.core import CoreState
from homeassistant.setup import async_setup_component
from . import HASSIO_TOKEN
@pytest.fixture
def hassio_e... | jawilson/home-assistant | tests/components/hassio/conftest.py | Python | apache-2.0 | 2,490 | 0 |
# Copyright 2016, 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | tengyifei/grpc | src/python/grpcio_tests/tests/stress/client.py | Python | bsd-3-clause | 4,801 | 0.007707 |
import os
def clang_format_recursive(root_path):
for root, dirs, files in os.walk(root_path):
for file in files:
if file.endswith(".cpp") or file.endswith(".hpp"):
path = os.path.join(root, file)
print('formatting %s' % path)
os.system('clang-for... | ColinDuquesnoy/MellowPlayer | scripts/beautify.py | Python | gpl-2.0 | 893 | 0 |
# Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | samueldotj/TeeRISC-Simulator | src/arch/x86/isa/insts/simd128/floating_point/data_conversion/__init__.py | Python | bsd-3-clause | 2,483 | 0 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Openstack, LLC.
# 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
#
# ... | superstack/nova | nova/vnc/proxy.py | Python | apache-2.0 | 4,135 | 0.000726 |
"""
Requirements file parsing
"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
from __future__ import absolute_import
import optparse
import os
import re
import shlex
import sys
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal... | davidharvey1986/pyRRG | unittests/bugFixPyRRG/lib/python3.7/site-packages/pip/_internal/req/req_file.py | Python | mit | 19,075 | 0.000052 |
#!/usr/bin/env python
"""A module with functions for working with GRR packages."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import importlib
import inspect
import logging
import os
import sys
import pkg_resources
from typing import Text
from grr_... | dunkhong/grr | grr/core/grr_response_core/lib/package.py | Python | apache-2.0 | 2,986 | 0.011386 |
from pathplanning import *
| wannesvl/topap | pathplanning/__init__.py | Python | lgpl-3.0 | 27 | 0 |
"""Support for NX584 alarm control panels."""
import logging
from nx584 import client
import requests
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
from homeassistant.components.alarm_control_panel.const i... | leppa/home-assistant | homeassistant/components/nx584/alarm_control_panel.py | Python | apache-2.0 | 4,039 | 0 |
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_POST
from .models import Question, Vote
@require_POST
def vote(request, question_id):
question = get_object_or_404(Question, id=question_id)
if question.can_vote(reques... | misli/cmsplugin-survey | cmsplugin_survey/views.py | Python | bsd-3-clause | 659 | 0 |
import pyxbmct.addonwindow as pyxbmct
import plex
from common import printDebug, GLOBAL_SETUP
import xbmc
printDebug=printDebug("PleXBMC", "plex_signin")
class plex_signin(pyxbmct.AddonFullWindow):
def __init__(self, title=''):
"""Class constructor"""
# Call the base class' constructor.
su... | hippojay/plugin.video.plexbmc | resources/lib/plex_signin.py | Python | gpl-2.0 | 13,463 | 0.004754 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from django.contrib.auth import get_user_model
from shoop.adm... | taedori81/shoop | shoop_tests/admin/test_contact_edit.py | Python | agpl-3.0 | 1,225 | 0 |
import requests
import hashlib
import json
import random
import sys
class ApiItemAmount(object):
def __new__(self, item_type, amount):
return {"type": item_type, "amount": amount}
class SagaAPI(object):
secret = ""
episodeLengths = {}
apiUrl = ""
clientApi = ""
unlockLevelItemId = -1
... | boskee/regicide | regicide.py | Python | gpl-3.0 | 8,891 | 0.005511 |
from django.conf import settings
def _get_backend():
return getattr(settings, 'SESSIONPROFILE_BACKEND', 'sessionprofile.backends.db')
| modelbrouwers/django-sessionprofile | sessionprofile/settings.py | Python | mit | 140 | 0.007143 |
from django.conf.urls import patterns, url
from interviews.views import ElegibilityCertificateDetailView
__author__ = 'LBerrocal'
urlpatterns = patterns('',
url(r'^certificate/(?P<pk>[\d]+)/$', ElegibilityCertificateDetailView.as_view(), name='certificate-goal'),
) | luiscberrocal/homeworkpal | homeworkpal_project/interviews/urls.py | Python | mit | 313 | 0.00639 |
import pygame as pg
from .sprite import Sprite
class Animation(object):
def __init__(self,
paths=None,
imgs=None,
sprites=None,
spritesheet=None,
rect=None,
count=None,
colorkey=None,
loop=False,
frame_interval=1,
size=None):
if paths:
self.frames = [Sprit... | LittleSmaug/summercamp2k17 | src/game/animation.py | Python | gpl-3.0 | 1,129 | 0.06023 |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
def mnist_manyCols_largeGBM():
#Log.info("Importing mnist train data...\n")
train = h2o.import_file(path=tests.locate("bigdata/laptop/mnist/train.csv.gz"))
#Log.info("Check that tail works...")
train.tail()
#Log.info("Doing gb... | kyoren/https-github.com-h2oai-h2o-3 | h2o-py/tests/testdir_algos/gbm/pyunit_mnist_manyCols_largeGBM.py | Python | apache-2.0 | 564 | 0.021277 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Huyuwei/tvm | python/tvm/expr.py | Python | apache-2.0 | 17,385 | 0.000575 |
# Copyright (C) 2015-2016 Free Software Foundation, 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.
#
# This progr... | ccilab/binutils | gdb/testsuite/gdb.python/py-mi-objfile-gdb.py | Python | gpl-3.0 | 1,077 | 0 |
# Copyright 2019-present, GraphQL Foundation
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from casing import camel, title
from license import C_LICENSE_COMMENT
class Printer(object):
def __init__(self):
pass
def start_file(self)... | graphql/libgraphqlparser | ast/cxx_visitor.py | Python | mit | 1,218 | 0.009031 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'urssus/ui/configdialog.ui'
#
# Created: Fri Feb 27 23:57:10 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(sel... | ralsina/urssus | urssus/ui/Ui_configdialog.py | Python | gpl-2.0 | 1,833 | 0.006001 |
import copy
import difflib
import logging
from coalib.results.LineDiff import LineDiff, ConflictError
from coalib.results.SourceRange import SourceRange
from coalib.results.TextRange import TextRange
from coala_utils.decorators import enforce_signature, generate_eq
@generate_eq('_file', 'modified', 'rename', 'delete... | arush0311/coala | coalib/results/Diff.py | Python | agpl-3.0 | 18,892 | 0 |
from __future__ import unicode_literals
from django.core import serializers
from django.db import connection
from django.test import TestCase
from .models import FKDataNaturalKey, NaturalKeyAnchor
from .tests import register_tests
class NaturalKeySerializerTests(TestCase):
pass
def natural_key_serializer_test... | loic/django | tests/serializers/test_natural.py | Python | bsd-3-clause | 2,699 | 0.002223 |
from unittest.mock import Mock
import requests
from boxsdk.network.default_network import DefaultNetworkResponse
from boxsdk.network.network_interface import Network
class MockNetwork(Network):
"""Mock implementation of the network interface for testing purposes."""
def __init__(self):
super().__init... | box/box-python-sdk | test/integration/mock_network.py | Python | apache-2.0 | 1,019 | 0.000981 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 0, transform = "Logit", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_Lag1Trend/cycle_0/ar_/test_artificial_128_Logit_Lag1Trend_0__20.py | Python | bsd-3-clause | 260 | 0.088462 |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design 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:
#
# * Redistrib... | lucienfostier/gaffer | python/GafferSceneUI/DeleteOptionsUI.py | Python | bsd-3-clause | 2,461 | 0.009752 |
# -*- coding: utf-8 -*-
# Copyright 2017 KMEE
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import inherited_financial_document_type
from . import inherited_financial_move
from . import bank_payment_line
from . import payment_line
from . import payment_mode
from . import payment_mode_type
# fr... | kmee/odoo-brazil-banking | l10n_br_financial_payment_order/models/__init__.py | Python | agpl-3.0 | 556 | 0 |
"""Unit test for LinUCB
"""
from striatum.storage import (
MemoryHistoryStorage,
MemoryModelStorage,
MemoryActionStorage,
Action,
Recommendation,
)
class BaseBanditTest(object):
# pylint: disable=protected-access
def setUp(self): # pylint: disable=invalid-name
self.model_storage ... | ntucllab/striatum | striatum/bandit/tests/base_bandit_test.py | Python | bsd-2-clause | 7,923 | 0.000505 |
# handleTorrent.py
# function to manipulate all the torrent part
import requests
from requests.auth import HTTPBasicAuth
import ClassUsers
# file used to store sensible data, like API key
def hash2magnet(hashlink):
magnet = "magnet:?xt=urn:btih:" + hashlink[2:-2]
return magnet
def addmagnet(torrent, chat_i... | pazpi/ruTorrent-bot | handleTorrent.py | Python | gpl-2.0 | 1,580 | 0.002532 |
'''
Copyright (c) 2017 Yogesh Khatri
This file is part of mac_apt (macOS Artifact Parsing Tool).
Usage or distribution of this software/code is subject to the
terms of the MIT License.
'''
import io
import os
import logging
import nska_deserialize as nd
from plugins.helpers import macinfo
import plu... | ydkhatri/mac_apt | plugins/safari.py | Python | mit | 30,422 | 0.008809 |
# Copyright 2013 IBM Corporation
# 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 ... | zsoltdudas/lis-tempest | tempest/api/compute/admin/test_hypervisor.py | Python | apache-2.0 | 4,953 | 0 |
# encoding: latin2
"""
Distance functions from an area to a region
"""
__author__ = "Juan C. Duque"
__credits__ = "Copyright (c) 2009-11 Juan C. Duque"
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "RiSE Group"
__email__ = "contacto@rise-group.org"
import numpy
import distanceFunctions
de... | tectronics/clusterpy | clusterpy/core/toolboxes/cluster/componentsAlg/dist2Regions.py | Python | bsd-3-clause | 1,076 | 0.001859 |
import os
import stat
from mimetypes import guess_type
from rest_framework import serializers
from hav.utils.imaginary import generate_thumbnail_url, generate_srcset_urls
from hav.utils.exif import get_exif_data
import logging
logger = logging.getLogger(__name__)
def is_hidden(fn):
return fn.startswith(".")
c... | whav/hav | src/hav/apps/sources/filesystem/api/serializers.py | Python | gpl-3.0 | 4,892 | 0.000613 |
"""
ChkConfig - command ``chkconfig``
=================================
"""
from collections import namedtuple
from .. import Parser, parser
import re
from insights.specs import chkconfig
@parser(chkconfig)
class ChkConfig(Parser):
"""
A parser for working with data gathered from `chkconfig` utility.
Sam... | wcmitchell/insights-core | insights/parsers/chkconfig.py | Python | apache-2.0 | 6,449 | 0.001396 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | egabancho/invenio-oauth2server | invenio_oauth2server/forms.py | Python | gpl-2.0 | 5,319 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
from itertools import tee, izip
import logging
from rdkit import Chem
from rdkit.Chem.rdchem import BondType, BondStereo, BondDir
__author__ = 'Matt Swain'
__email__ = 'm.swain@me.com'
__license__ = 'MIT'
log = logging.getLogger('tautomer')
BONDMAP = {'-': B... | jlec/coot | pyrogen/tautomer.py | Python | gpl-3.0 | 25,160 | 0.00473 |
"""
Separate module with function samples for serialization tests,
to avoid issues with __main__.
"""
import math
from numba import jit, generated_jit
from numba.core import types
@jit((types.int32, types.int32))
def add_with_sig(a, b):
return a + b
@jit
def add_without_sig(a, b):
return a + b
@jit(nopyth... | cpcloud/numba | numba/tests/serialize_usecases.py | Python | bsd-2-clause | 2,317 | 0.006905 |
# -*- coding: utf8 -*-
from __future__ import absolute_import
"""
"""
__author__ = "Jerome Samson"
__copyright__ = "Copyright 2014, Mikros Image"
import logging
import time
try:
import simplejson as json
except ImportError:
import json
from tornado.web import HTTPError
from octopus.core.communication.http i... | mikrosimage/OpenRenderManagement | src/octopus/dispatcher/webservice/job.py | Python | bsd-3-clause | 3,190 | 0.00094 |
# 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
# distributed under t... | bigswitch/horizon | openstack_dashboard/dashboards/project/volumes/backups/forms.py | Python | apache-2.0 | 4,401 | 0 |
'''
Created on Feb 22, 2013
@author: u5682
'''
from datetime import datetime
import os, sys, pickle
import subprocess
from time import sleep
import xml.dom.minidom
from xml.dom.minidom import Node
class DistributedTask(object):
'''
classdocs
'''
def __init__(self, fileName = None):
'''
Constructor
'''... | supermanue/distributedController | clusterController/DistributedTask.py | Python | gpl-2.0 | 3,026 | 0.045935 |
# -*- coding: utf-8 -*-
#
# 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 ... | vilobhmm/delimiter | delimiter/drivers/sql.py | Python | apache-2.0 | 715 | 0 |
import unittest
import math
def main():
# read input
nv = int(input().strip())
tree_raw = [ int(t) for t in input().strip().split(' ')]
nexperiments = int(input().strip())
exp = []
for _ in range(nexperiments):
exp.append( [ int(t) for t in input().strip().split(' ')] )
nodes =... | tuergeist/HackerRank | contests/w23/gravity1.py | Python | gpl-3.0 | 3,805 | 0.017346 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | cin/spark | python/pyspark/sql/readwriter.py | Python | apache-2.0 | 49,040 | 0.005669 |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2022 BigML
#
# 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... | bigmlcom/python | bigml/tests/create_sample_steps.py | Python | apache-2.0 | 2,068 | 0.002418 |
# Copyright 2009 Google 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 writing, ... | jimpick/jaikuengine | common/user.py | Python | apache-2.0 | 6,537 | 0.014227 |
# -*- coding: utf-8 -*-
class Error:
def __init__(self, tipo, bad_rows):
self.tipo = tipo
self.bad_rows = bad_rows
def get_tipo(self):
return self.tipo
def get_bad_rows(self):
return self.bad_rows
def __str__(self):
if self.tipo == "1":... | ieeeugrsb/ieeextreme8 | Teams/MineCoders/22_Binary Matrices/Solucion.py | Python | gpl-3.0 | 2,025 | 0.011369 |
# Copyright 2014 NEC Corporation. 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 ... | viggates/nova | nova/api/openstack/compute/schemas/v3/quota_sets.py | Python | apache-2.0 | 1,547 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: Brian Cherinka, José Sánchez-Gallego, and Brett Andrews
# @Date: 2017-07-02
# @Filename: test_map.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
#
# @Last modified by: andrews
# @Last modified time: 2019-11-22 12:11:29
import ... | sdss/marvin | tests/tools/test_map.py | Python | bsd-3-clause | 26,199 | 0.001527 |
from __future__ import print_function
from __future__ import division
__author__ = """Alex "O." Holcombe""" ## double-quotes will be silently removed, single quotes will be left, eg, O'Connor
import numpy as np
import itertools #to calculate all subsets
from copy import deepcopy
from math import atan, pi, cos, sin, sqr... | alexholcombe/movingCue | helpersAOHtargetFinalCueLocatn.py | Python | mit | 32,987 | 0.030072 |
# Generated by h2py from /usr/include/linux/cdrom.h
CDROMPAUSE = 0x5301
CDROMRESUME = 0x5302
CDROMPLAYMSF = 0x5303
CDROMPLAYTRKIND = 0x5304
CDROMREADTOCHDR = 0x5305
CDROMREADTOCENTRY = 0x5306
CDROMSTOP = 0x5307
CDROMSTART = 0x5308
CDROMEJECT = 0x5309
CDROMVOLCTRL = 0x530a
CDROMSUBCHNL = 0x530b
CDROMREADMO... | Orav/kbengine | kbe/src/lib/python/Lib/plat-linux/CDROM.py | Python | lgpl-3.0 | 5,242 | 0 |
from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParametersCable, eDVBFrontendParametersTerrestrial
from Components.NimManager import nimmanager
def ConvertToHumanReadable(tp, type = None):
ret = { }
if type is None:
type = tp.get("tuner_type", "None")
if type == "DVB-S":
ret["tuner_type"] = _("S... | popazerty/bh1 | lib/python/Tools/Transponder.py | Python | gpl-2.0 | 7,700 | 0.032987 |
import os
# import json
# 1
def extract_users_from_file(file_name):
fn = os.path.join(os.path.dirname(__file__), file_name)
users = {}
with open(fn) as f:
for line in f:
row_elements = line.split(":")
if len(row_elements) > 0 and "#" not in row_elements[0]:
... | NorbertAgoston3pg/PythonLearning | DemoProject/src/input_output.py | Python | mit | 3,588 | 0.000279 |
'''plist utility functions'''
from Foundation import NSPropertyListSerialization
from Foundation import NSPropertyListXMLFormat_v1_0
from Foundation import NSPropertyListBinaryFormat_v1_0
class FoundationPlistException(Exception):
"""Basic exception for plist errors"""
pass
def write_plist(dataObject, pathn... | rodm/osx-vm-templates | scripts/support/plistutils.py | Python | mit | 1,198 | 0.001669 |
# Generated by Django 1.11.11 on 2018-08-27 21:51
from django.db import migrations
def update_domain_forward(apps, schema_editor):
"""Set site domain and name."""
Domain = apps.get_model("domains", "Domain")
Domain.objects.update_or_create(pk=1, name="fedrowanie.siecobywatelska.pl")
class Migration(mig... | watchdogpolska/feder | feder/domains/migrations/0002_initial-domain.py | Python | mit | 454 | 0 |
# Rekall Memory Forensics
# Copyright (C) 2011
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Michael Cohen <scudette@gmail.com>
#
# ******************************************************
#
# * This program is free software; you can redistribute it and/or
# * modify it under the terms of the GNU General Public... | rainaashutosh/MyTestRekall | rekall-core/rekall/registry.py | Python | gpl-2.0 | 5,183 | 0.000193 |
def hotel_cost(nights):
return 140 * nights
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
elif city == "Los Angeles":
return 475
def rental_car_cost(days):
total_car = days * ... | GunnerJnr/_CodeInstitute | Stream-2/Back-End-Development/1.Installing-Python/3.Using-IDLE/challenge-solution/vacation.py | Python | mit | 629 | 0.007949 |
import re
def convert(path):
f = open(path)
FUNCTION_RE = re.compile(r'(\S*?)\s*=\s*\w+dll.\w+.(\S*)')
import ctypes
dlls = \
{
'user32' : ctypes.windll.user32,
'shell32' : ctypes.windll.shell32,
'kernel32' : ctypes.windll.kernel32,
'gdi32' : ctypes... | gregorlarson/loxodo | src/frontends/ppygui/ppygui_winxp/converttonwin32.py | Python | gpl-2.0 | 1,317 | 0.009871 |
class Solution(object):
def isPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
s = re.sub('[^a-zA-Z0-9]','',s.lower())
return True if s == s[::-1] else False | ranji2612/leetCode | validPalindrome.py | Python | gpl-2.0 | 215 | 0.013953 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-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... | fiete201/qutebrowser | tests/test_conftest.py | Python | gpl-3.0 | 1,648 | 0.000607 |
# Copyright: (c) 2018, Pluribus Networks
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn_vrouter_pim_... | thaim/ansible | test/units/modules/network/netvisor/test_pn_vrouter_pim_config.py | Python | mit | 2,463 | 0.002842 |
# proxy module
from __future__ import absolute_import
from blockcanvas.app.workbench_app.application_editor_manager import *
| enthought/etsproxy | enthought/block_canvas/app/workbench_app/application_editor_manager.py | Python | bsd-3-clause | 125 | 0 |
import kolabformat
from pykolab.translate import _
from pykolab.translate import N_
from contact_reference import ContactReference
participant_status_labels = {
"NEEDS-ACTION": N_("Needs Action"),
"ACCEPTED": N_("Accepted"),
"DECLINED": N_("Declined"),
"TENTATIVE": N_("Tentatively Acc... | tpokorra/pykolab | pykolab/xml/attendee.py | Python | gpl-3.0 | 9,223 | 0.002927 |
from collidable import *
from math_3d import *
class PixelCollidable( Collidable ) :
def __init__(self) :
self.spm = None
self.r = None
| sphereflow/space_combat | src/pixel_collidable.py | Python | mit | 152 | 0.052632 |
# -*- coding: utf-8 -*-
import re
from django.forms import ValidationError, ModelForm, Form, CharField, PasswordInput, TextInput
from django.utils.translation import ugettext_lazy as _
from accounts.models import MyUser
class SignUpForm(ModelForm):
"""
Регистрационная форма.
"""
password = CharField... | IlyaGusev/PoetryCorpus | poetry/apps/accounts/forms.py | Python | apache-2.0 | 2,884 | 0.003124 |
# -*- coding: utf-8 -*-
"""
Extension that integrates cookiecutter templates into PyScaffold.
"""
from __future__ import absolute_import
import argparse
from ..api.helpers import register, logger
from ..api import Extension
from ..contrib.six import raise_from
class Cookiecutter(Extension):
"""Additionally appl... | cpaulik/pyscaffold | src/pyscaffold/extensions/cookiecutter.py | Python | mit | 5,160 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-26 22:42
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('progress', '0003_auto_20161227_0401'),
]
operation... | kaqfa/supervise_backend | progress/migrations/0004_auto_20161227_0542.py | Python | apache-2.0 | 1,355 | 0.002214 |
from cpptrimesh import CppTriMesh
from menpo.shape.mesh.base import TriMesh
from menpo.shape.mesh.coloured import ColouredTriMesh
from menpo.shape.pointcloud import PointCloud
class FastTriMesh(TriMesh, CppTriMesh):
"""A TriMesh with an underlying C++ data structure, allowing for efficient
iterations around m... | jabooth/menpo-archive | menpo/shape/mesh/__init__.py | Python | bsd-3-clause | 1,181 | 0.00254 |
import unittest
import unittest.mock
from GitManager.repo import finder, description
class TestFinder(unittest.TestCase):
""" Tests that the Finder() class works correctly """
@unittest.mock.patch("os.listdir")
@unittest.mock.patch("os.path")
@unittest.mock.patch("GitManager.repo.finder.Finder.get_f... | tkw1536/GitManager | tests/repo/test_finder.py | Python | mit | 9,603 | 0 |
"""
1001 : A - B
URL : https://www.acmicpc.net/problem/1001
Input :
3 2
Output :
1
"""
input = input().split()
a = int(input[0])
b = int(input[1])
print(a - b) | 0x1306e6d/Baekjoon | baekjoon/1001.py | Python | gpl-2.0 | 191 | 0.005236 |
class С:
def __init__(self, x=None):
if x is None:
self.foo = {
'A': {
'x': 0,
'y': 0,
},
}
else: # init was given the previous state
assert isinstance(x, С)
self.foo = {
... | mdanielwork/intellij-community | python/testData/refactoring/rename/renameSelfAndParameterAttribute.py | Python | apache-2.0 | 460 | 0.00655 |
# coding=utf-8
#
#
# 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 writi... | SauloAislan/ironic | ironic/objects/node.py | Python | apache-2.0 | 29,894 | 0 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import binascii
import os
import struct
import subprocess
import aurorawatchnet as awn
import aurorawatchnet.message
# Parse command line options
parser = argparse.ArgumentParser(description='Make firmware image files')
parser.add_argumen... | stevemarple/AuroraWatchNet | software/magnetometer/sketches/RioLog/mkfwimage.py | Python | gpl-2.0 | 2,395 | 0.003758 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import struct
import array
import os
def pack_neg(ID):
type = 0
id = ID
data = struct.pack('>II', type, id)
return data
def unpack_neg(data):
type,id = struct.unpack('>II', data)
return (type,id)
print "negotiation", unpack_neg(pack_neg(16))
d... | edderick/E0_Python | pystruct.py | Python | mit | 1,485 | 0.03771 |
"""Cloud browser package."""
from __future__ import with_statement
import os
from sys import version_info
from setuptools import find_packages, setup
from cloud_browser import __version__
###############################################################################
# Environment and Packages.
####################... | ryan-roemer/django-cloud-browser | setup.py | Python | mit | 2,485 | 0 |
# Copyright (C) 2009 Red Hat, Inc., Joey Boggs <jboggs@redhat.com>
# Copyright (C) 2012 Rackspace US, Inc.,
# Justin Shepherd <jshepher@rackspace.com>
# Copyright (C) 2013 Red Hat, Inc., Flavio Percoco <fpercoco@redhat.com>
# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee <jagee@redhat.com>
# This pr... | csutherl/sos | sos/plugins/openstack_cinder.py | Python | gpl-2.0 | 3,713 | 0 |
import ocl
import pyocl
import camvtk
import time
import vtk
import datetime
import math
if __name__ == "__main__":
print ocl.revision()
myscreen = camvtk.VTKScreen()
#stl = camvtk.STLSurf("../stl/gnu_tux_mod.stl")
stl = camvtk.STLSurf("../stl/mount_rush.stl")
myscreen.addActor(stl)
stl... | AlanZatarain/opencamlib | scripts/batchdropcutter_mtrush.py | Python | gpl-3.0 | 2,327 | 0.026214 |
from datetime import datetime
import factory
from zds.forum.factories import PostFactory, TopicFactory
from zds.gallery.factories import GalleryFactory, UserGalleryFactory
from zds.utils.factories import LicenceFactory, SubCategoryFactory
from zds.utils.models import Licence
from zds.tutorialv2.models.database import... | ChantyTaguan/zds-site | zds/tutorialv2/factories.py | Python | gpl-3.0 | 8,840 | 0.002263 |
#!/usr/bin/env python
#
# 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 ve... | deevarvar/myLab | baidu_code/soap_mockserver/spyne/test/test_sqlalchemy.py | Python | mit | 25,512 | 0.002861 |
# Copyright 2018 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... | freedomtan/tensorflow | tensorflow/compiler/tests/qr_op_test.py | Python | apache-2.0 | 5,667 | 0.006529 |
#!/usr/bin/env python
#
# GrovePi Example for using the Grove Vibration Motor (http://www.seeedstudio.com/wiki/Grove_-_Vibration_Motor)
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example? A... | gerald-yang/ubuntu-iotivity-demo | snappy/grovepi/pygrovepi/grove_vibration_motor.py | Python | apache-2.0 | 2,209 | 0.00498 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v1beta1_flow_distinguisher_method.py | Python | apache-2.0 | 3,838 | 0 |
#!/usr/bin/python
# 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.
# Use: ../mergetraces.py `ls cyglog.* -Sr` > merged_cyglog
""""Merge multiple logs files from different processes into a single log.
Give... | jgcaaprom/android_external_chromium_org | tools/cygprofile/mergetraces.py | Python | bsd-3-clause | 8,029 | 0.011957 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-28 02:28
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('webcore', '0003_auto_20170427_1825'),
]
operations = [
migrations.RemoveField(
... | Nikita1710/ANUFifty50-Online-Mentoring-Platform | project/fifty_fifty/webcore/migrations/0004_auto_20170428_0228.py | Python | apache-2.0 | 459 | 0 |
#!/usr/bin/python
##############################################################################################
# Copyright (C) 2014 Pier Luigi Ventre - (Consortium GARR and University of Rome "Tor Vergata")
# Copyright (C) 2014 Giuseppe Siracusano, Stefano Salsano - (CNIT and University of Rome "Tor Vergata")
# www.... | netgroup/Dreamer-Mininet-Deployer | deployer_configuration_utils.py | Python | apache-2.0 | 1,593 | 0.011927 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('appliances', '0009_appliancepool_provider'),
]
operations = [
migrations.AddField(
... | akrzos/cfme_tests | sprout/appliances/migrations/0010_appliance_power_state_changed.py | Python | gpl-2.0 | 511 | 0 |
# https://requests-oauthlib.readthedocs.org/en/latest/examples/real_world_example.html#real-example
import os
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
# import hashlib
# import binascii
import evernote.edam.userstore.constants as UserStoreConstants
# import evernote... | rdhyee/oauth-flask-examples | evernote_sdk/evernote_oauth1a.py | Python | apache-2.0 | 3,694 | 0.001083 |
# Copyright 2013 OpenStack Foundation
# Copyright 2014 NEC Corporation
# 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/licens... | queria/my-tempest | tempest/api/compute/v3/admin/test_quotas_negative.py | Python | apache-2.0 | 4,153 | 0 |
"""Nearest Neighbor Regression."""
# Authors: Jake Vanderplas <vanderplas@astro.washington.edu>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Sparseness support by Lars Buitinck
# Multi-output support by Arnaud Joly <a.joly@ulg.a... | sergeyf/scikit-learn | sklearn/neighbors/_regression.py | Python | bsd-3-clause | 16,414 | 0.000244 |
# 514. Freedom Trail
# DescriptionHintsSubmissionsDiscussSolution
# DiscussPick One
# In the video game Fallout 4, the quest "Road to Freedom" requires players to reach a metal dial called the "Freedom Trail Ring", and use the dial to spell a specific keyword in order to open the door.
#
# Given a string ring, which r... | shawncaojob/LC | PY/514_freedom_trial.py | Python | gpl-3.0 | 4,396 | 0.007962 |
#! /user/bin/env python
__version__ = '0.8.54'
| jalanb/jab | src/python/__init__.py | Python | mit | 48 | 0 |
from database.db import db
import pymongo
class UserMetadataService(object):
def __init__(self):
self.user_meta = db.user_metadata
def get_active(self):
return self.user_meta.find_one({'active': True})
def insert(self, user_meta_dict):
return self.user_meta.insert(user_meta_dict... | iurykrieger96/morpy | app/api/services/UserMetadataService.py | Python | gpl-3.0 | 546 | 0.005495 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from time import sleep
msg = [u'あ', u'り', u'が', u'う']
wait = 0.7
for m in msg:
print(m, end="", flush=True)
sleep(wait)
print('\b', end="", flush=True)
sleep(wait)
print(u'と', end="", flush=True)
sleep(wait)
print(u'う', end="", flush=True)
sleep(wait)
print("""
Q.「I... | yutakakn/MyScript | Python/thanks.py | Python | bsd-3-clause | 534 | 0.009524 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.