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 |
|---|---|---|---|---|---|---|
from indiefilmrentals.products.models import *
from shop_simplecategories.models import *
def categories(request):
return {'categories': Category.objects.all()} | blorenz/indie-film-rentals | indiefilmrentals/products/processors.py | Python | bsd-3-clause | 169 | 0.017751 |
# -*- coding: utf-8 -*-
# flake8: noqa
# Disable Flake8 because of all the sphinx imports
#
# 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 licens... | owlabs/incubator-airflow | docs/conf.py | Python | apache-2.0 | 17,740 | 0.001522 |
"""
Example generation for the scikit learn
Generate the rst files for the examples by iterating over the python
example files.
Files that generate images should start with 'plot'
"""
from __future__ import division, print_function
from time import time
import ast
import os
import re
import shutil
import traceback
i... | NelisVerhoef/scikit-learn | doc/sphinxext/gen_rst.py | Python | bsd-3-clause | 40,198 | 0.000697 |
# -*- coding: utf-8 -*-
'''
Interface with a Junos device via proxy-minion.
'''
# Import python libs
from __future__ import print_function
from __future__ import absolute_import
import logging
# Import 3rd-party libs
import jnpr.junos
import jnpr.junos.utils
import jnpr.junos.utils.config
import json
HAS_JUNOS = Tru... | smallyear/linuxLearn | salt/salt/proxy/junos.py | Python | apache-2.0 | 1,727 | 0.001158 |
from PyQt5.QtCore import pyqtSlot, QThread, pyqtSignal
import os
from PyQt5.QtWidgets import QFileDialog, QProgressDialog, QMessageBox
from PyQt5.QtCore import pyqtSlot, QObject
from books.soldiers import processData
import route_gui
from lxml import etree
import multiprocessing
import math
class XmlImport(QObject):
... | Learning-from-our-past/Kaira | qtgui/xmlImport.py | Python | gpl-2.0 | 4,469 | 0.005147 |
import datetime
import json
class Experience:
def __init__(self, date, event):
self._date = date
self._event = event
@classmethod
def reconstruct_from_db_data_event(cls, date, event):
event = json.loads(event)
date = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S.%f"... | semiirs/ai_project | common/experience.py | Python | gpl-3.0 | 462 | 0.002165 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | google/gnxi | oc_config_validate/oc_config_validate/models/macsec.py | Python | apache-2.0 | 391,144 | 0.007626 |
# 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... | dmlc/tvm | python/tvm/relay/testing/mobilenet.py | Python | apache-2.0 | 7,444 | 0.000672 |
#!/usr/bin/python3
"""Filter to normalize/canonicalize objdump --dwarf=info dumps.
Reads stdin, normalizes / canonicalizes and/or strips the output of objdump
--dwarf to make it easier to "diff".
Support is provided for rewriting absolute offsets within the dump to relative
offsets. A chunk like
<2><2d736>: Abbrev ... | thanm/devel-scripts | normalize-dwarf-objdump.py | Python | apache-2.0 | 10,730 | 0.014073 |
#
# 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... | spektom/incubator-airflow | tests/providers/zendesk/hooks/test_zendesk.py | Python | apache-2.0 | 5,046 | 0.000396 |
# -*- coding:utf-8 -*-
from sqlalchemy import desc, func
from atlas.modeles.entities.vmSearchTaxon import VmSearchTaxon
def listeTaxons(session):
"""
revoie un tableau de dict :
label = nom latin et nom francais concatene, value = cd_ref
TODO Fonction inutile à supprimer !!!
"""
... | PnEcrins/GeoNature-atlas | atlas/modeles/repositories/vmSearchTaxonRepository.py | Python | gpl-3.0 | 1,550 | 0.000647 |
# urllib3/util.py
# Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from __future__ import absolute_import
from base64 import b64encode
from socket import error as So... | ryfx/modrana | core/backports/urllib3_python25/util.py | Python | gpl-3.0 | 11,071 | 0.000542 |
from __future__ import absolute_import
from fulltext.backends import __html
from fulltext.util import run, assert_cmd_exists
from fulltext.util import BaseBackend
def cmd(path, **kwargs):
cmd = ['hwp5proc', 'xml']
cmd.extend([path])
return cmd
def to_text_with_backend(html):
return __html.handle_fo... | btimby/fulltext | fulltext/backends/__hwp.py | Python | mit | 544 | 0 |
"""
xModule implementation of a learning sequence
"""
# pylint: disable=abstract-method
import json
import logging
from pkg_resources import resource_string
import warnings
from lxml import etree
from xblock.core import XBlock
from xblock.fields import Integer, Scope, Boolean, Dict
from xblock.fragment import Fragme... | nttks/edx-platform | common/lib/xmodule/xmodule/seq_module.py | Python | agpl-3.0 | 13,629 | 0.001761 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import shutil
import sys
from setuptools import setup
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
with open(os.path.join(package, '__init__.py'), 'rb') as init_py:
src = in... | orf/django-rest-framework-jwt | setup.py | Python | mit | 3,404 | 0 |
"""Support for switches which integrates with other components."""
import logging
import voluptuous as vol
from homeassistant.components.switch import (
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
SwitchEntity,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
CONF_ENTITY_PICTURE_... | titilambert/home-assistant | homeassistant/components/template/switch.py | Python | apache-2.0 | 6,023 | 0.000332 |
#!/usr/bin/env python3
from setuptools import setup, find_packages
version = '0.2.4'
setup(
name='lolbuddy',
version=version,
description='a cli tool to update league of legends itemsets and ability order from champion.gg',
author='Cyrus Roshan',
author_email='hello@cyrusroshan.com',
license=... | CyrusRoshan/lolbuddy | setup.py | Python | mit | 674 | 0.001484 |
#!/usr/bin/env python
# remoteobj v0.4, best yet!
# TODO: This will get wrecked by recursive sets/lists/dicts; need a more picklish method.
# TODO: Dict/sets/lists should get unpacked to wrappers that are local for read-only access,
# but update the remote for write access. Note that __eq__ will be an interesting... | KernelAnalysisPlatform/KlareDbg | static2/ida/remoteobj.py | Python | gpl-3.0 | 16,409 | 0.016942 |
# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
#
# 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 app... | dtudares/hello-world | yardstick/yardstick/vTC/apexlake/experimental_framework/api.py | Python | apache-2.0 | 6,381 | 0 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_permission_codename, get_user_model
from django.contrib.auth.models import AnonymousUser
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse, NoReverseMatch... | czpython/django-cms | cms/cms_toolbars.py | Python | bsd-3-clause | 32,747 | 0.003237 |
"""Yummly data models.
"""
from inspect import getargspec
class Storage(dict):
"""An object that is like a dict except `obj.foo` can be used in addition
to `obj['foo']`.
Raises Attribute/Key errors for missing references.
>>> o = Storage(a=1, b=2)
>>> assert(o.a == o['a'])
>>> assert(o.b =... | dgilland/yummly.py | yummly/models.py | Python | mit | 8,795 | 0 |
from __future__ import absolute_import
from typing import Any, Callable, Dict, Iterable, List, Set, Tuple, Text
from collections import defaultdict
import datetime
import pytz
import six
from django.db.models import Q, QuerySet
from django.template import loader
from django.conf import settings
from django.utils.time... | verma-varsha/zulip | zerver/lib/digest.py | Python | apache-2.0 | 10,690 | 0.001403 |
# -*- coding: utf-8 -*-
# Copyright 2015 Objectif Libre
#
# 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 ... | muraliselva10/cloudkitty | cloudkitty/tests/gabbi/rating/pyscripts/test_gabbi.py | Python | apache-2.0 | 1,187 | 0 |
from time import sleep
from worker import delayable
import requests
@delayable
def add(x, y, delay=None):
# Simulate your work here, preferably something interesting so Python doesn't sleep
sleep(delay or (x + y if 0 < x + y < 5 else 3))
return x + y
@delayable
def get(*args, **kwargs):
r = requests.g... | vals/google_devnull | tasks.py | Python | mit | 361 | 0.00831 |
# Use this script to collapse a multi-level folder of images into one folder.
import fnmatch
import os
import shutil
folderName = 'unknown'
matches = []
for root, dirnames, filenames in os.walk(folderName):
for filename in fnmatch.filter(filenames, '*.jpg'):
matches.append(os.path.join(root, filename))
i... | ajagnanan/docker-opencv-api | openface/images/collapse.py | Python | apache-2.0 | 465 | 0.004301 |
# -*- coding: UTF-8 -*-
import re
def mgo_text_split(query_text):
''' split text to support mongodb $text match on a phrase '''
sep = r'[`\-=~!@#$%^&*()_+\[\]{};\'\\:"|<,./<>?]'
word_lst = re.split(sep, query_text)
text_query = ' '.join('\"{}\"'.format(w) for w in word_lst)
return text_query
# 搜... | ysrc/xunfeng | views/lib/QueryLogic.py | Python | gpl-3.0 | 2,319 | 0.002621 |
# 005_cleaner.py
#####################################################################
##################################
# Import des modules et ajout du path de travail pour import relatif
import sys
sys.path.insert(0 , 'C:/Users/WILLROS/Perso/Shade/scripts/LocalWC-Shade-App/apis/')
from voca import AddLog , ... | sighill/shade_app | apis/raw/005_raw/005_cleaner.py | Python | mit | 1,625 | 0.015423 |
PER_PAGE = 50
ANNOUNCE_INTERVAL = 300
| kron4eg/django-btt | settings.py | Python | gpl-3.0 | 39 | 0 |
import pygame
import os
from buffalo import utils
from item import Item
# User interface for trading with NPCs
# Similar to the crafting UI, with some minor differences
# The biggest thing is that it only appears when you "talk to" (read click on)
# A trader NPC and disappears when you leave that window, and only cont... | benjamincongdon/adept | tradingUI.py | Python | mit | 3,586 | 0.037646 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from datetime import datetime
from os import environ
from requests import get
from bs4 import BeautifulSoup, NavigableString
from icalendar import Calendar, Even... | albatros69/Divers | scrap_ffme.py | Python | gpl-3.0 | 3,373 | 0.006235 |
import sys
if __name__ == "__main__":
# Parse command line arguments
if len(sys.argv) < 2:
sys.exit("python {} <datasetFilename> {{<maxPoints>}}".format(sys.argv[0]))
datasetFilename = sys.argv[1]
if len(sys.argv) >= 3:
maxPoints = int(sys.argv[2])
else:
maxPoints = None
# Perform initial pass through fil... | DonaldWhyte/multidimensional-search-fyp | scripts/read_multifield_dataset.py | Python | mit | 1,612 | 0.030397 |
'''
aima-ui project
=============
This is just a graphic user interface to test
agents for an AI college course.
'''
from kivy.uix.button import Button
from kivy.uix.togglebutton import ToggleButton
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.uix.label import Label
from kivy.uix.b... | valefranz/AI-Project-VacuumEnvironment | aima-ui-2a.py | Python | apache-2.0 | 17,529 | 0.000628 |
import socket
import string
from driver import driver
class WiFiMouseDriver(driver):
ACTION_KEYS = {
'TAB': 'TAB',
'ENTER': 'RTN',
'ESCAPE': 'ESC',
'PAGE_UP': 'PGUP',
'PAGE_DOWN': 'PGDN',
'END': 'END',
'HOME': 'HOME',
'LEFT': 'LF',
'UP': 'UP'... | obi1kenobi/pyre | WiFiMouse/wifimouse_driver.py | Python | mit | 2,923 | 0.002053 |
"""
Authenication and Authorization tests which require DC/OS Enterprise.
Currently test against root marathon. Assume we will want to test these
against MoM EE
"""
import common
import dcos
import pytest
import shakedown
from urllib.parse import urljoin
from dcos import marathon
from shakedown import credentials, e... | Caerostris/marathon | tests/system/marathon_auth_common_tests.py | Python | apache-2.0 | 2,070 | 0.004831 |
import xml.etree.ElementTree as etree
import base64
from struct import unpack, pack
import sys
import io
import os
import time
import itertools
import xbmcaddon
import xbmc
import urllib2,urllib
import traceback
import urlparse
import posixpath
import re
import socket
from flvlib import tags
from flvlib import helper... | noam09/kodi | script.module.israeliveresolver/lib/interalSimpleDownloader.py | Python | gpl-3.0 | 10,978 | 0.017216 |
# coding: utf-8
# Copyright 2017 Solthis.
#
# This file is part of Fugen 2.0.
#
# Fugen 2.0 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 ver... | Solthis/Fugen-2.0 | data/indicators/lost_back_patients.py | Python | gpl-3.0 | 3,277 | 0.000305 |
from collections import namedtuple, OrderedDict
from functools import wraps
from queue import Queue
import os
import shutil
import threading
from plover import log, system
from plover.dictionary.loading_manager import DictionaryLoadingManager
from plover.exception import DictionaryLoaderException
from plover.formatti... | openstenoproject/plover | plover/engine.py | Python | gpl-2.0 | 20,307 | 0.00064 |
import ast
from collections import defaultdict
from contextlib import ExitStack, contextmanager
from functools import singledispatch
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Union
from breakfast.position import Position
from breakfast.source import Source
from tests import make_source
Qua... | thisfred/breakfast | tests/test_attempt_12.py | Python | bsd-2-clause | 21,250 | 0.000659 |
"""
Copyright (c) 2016 Keith Sterling
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,... | CHT5/program-y | src/programy/config/brain.py | Python | mit | 8,932 | 0.007053 |
from mocket import Mocket, mocketize
from mocket.async_mocket import async_mocketize
from mocket.compat import byte_type, text_type
from mocket.mockhttp import Entry as MocketHttpEntry
from mocket.mockhttp import Request as MocketHttpRequest
from mocket.mockhttp import Response as MocketHttpResponse
def httprettifier... | mindflayer/python-mocket | mocket/plugins/httpretty/__init__.py | Python | bsd-3-clause | 3,152 | 0.000317 |
"""Support for switches through the SmartThings cloud API."""
from __future__ import annotations
from collections.abc import Sequence
from pysmartthings import Capability
from homeassistant.components.switch import SwitchEntity
from . import SmartThingsEntity
from .const import DATA_BROKERS, DOMAIN
async def asyn... | jawilson/home-assistant | homeassistant/components/smartthings/switch.py | Python | apache-2.0 | 1,911 | 0.000523 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-05-30 17:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0062_auto_20171223_1552'),
]
operations = [
migrations.AddField(
... | OKThess/website | main/migrations/0063_event_date_end.py | Python | mit | 469 | 0 |
from baseline.pytorch.torchy import *
from eight_mile.pytorch.layers import TransformerEncoderStack, subsequent_mask, MultiHeadedAttention
from baseline.model import LanguageModel, register_model
from eight_mile.pytorch.serialize import load_tlm_npz
import torch.autograd
import os
class LanguageModelBase(nn.Module, L... | dpressel/baseline | baseline/pytorch/lm/model.py | Python | apache-2.0 | 11,032 | 0.001813 |
import click
from pycolorterm.pycolorterm import print_pretty
from quarantine.cdc import CDC
from sh import ErrorReturnCode
@click.group()
def cli():
pass
@cli.command()
@click.argument('name')
@click.argument('pip_args', nargs=-1)
def install(name, pip_args):
"""Install the package. Pip args specified with... | Raynes/quarantine | quarantine/__main__.py | Python | apache-2.0 | 719 | 0.002782 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | ksrajkumar/openerp-6.1 | openerp/osv/orm.py | Python | agpl-3.0 | 245,233 | 0.004592 |
from model.info_contact import Infos
testdata = [
Infos(firstname="firstname1",lastname="lastname1"),
Infos(firstname="firstname2",lastname="lastname2")
] | Alex-Chizhov/python_training | home_works/data/contacts.py | Python | apache-2.0 | 166 | 0.018072 |
#__all__ = [ 'search', 'ham_distance', 'lev_distance', 'distance', 'distance_matrix' ]
| vfulco/scalpel | lib/gravity/tae/match/__init__.py | Python | lgpl-3.0 | 94 | 0.031915 |
from mock import patch
import mock
from kiwi.storage.subformat.vhdx import DiskFormatVhdx
class TestDiskFormatVhdx:
@patch('platform.machine')
def setup(self, mock_machine):
mock_machine.return_value = 'x86_64'
xml_data = mock.Mock()
xml_data.get_name = mock.Mock(
return_... | b1-systems/kiwi | test/unit/storage/subformat/vhdx_test.py | Python | gpl-3.0 | 1,314 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
DEBUG = True
observer = None
ser_port = None
s = 0
ser = None
#--------------------------------------------------------------------
import signal
import sys
import os
def signal_handler(signal, frame):
global s, ser
print '\nYou pressed Ctrl+C!'
... | Ma3X/boot-talker | codes/python/talk.py | Python | gpl-3.0 | 19,742 | 0.020819 |
# Copyright (c) 2017 Charles University in Prague, Faculty of Arts,
# Institute of the Czech National Corpus
# Copyright (c) 2017 Tomas Machalek <tomas.machalek@gmail.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
#... | tomachalek/kontext | lib/plugins/abstract/chart_export.py | Python | gpl-2.0 | 3,124 | 0 |
import config
#This module is used for calling the Wolfram Alpha API
#It defines a function that constructs an URL based on the query.
#NOTE: This module returns only the URL. This URL is passed in the bot.py file. Telegram Takes care of the rest.
def query(query):
question = query.replace(" ","+") ... | SiddharthSham/PetAteMyHW | wolfram.py | Python | gpl-3.0 | 692 | 0.023121 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2011, Volkan Esgel
#
# 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 l... | vesgel/quicknotes | plasmoid/contents/code/main.py | Python | gpl-3.0 | 1,970 | 0.001015 |
# -*- coding: utf-8 -*-
import pytest
import env # noqa: F401
from pybind11_tests import kwargs_and_defaults as m
def test_function_signatures(doc):
assert doc(m.kw_func0) == "kw_func0(arg0: int, arg1: int) -> str"
assert doc(m.kw_func1) == "kw_func1(x: int, y: int) -> str"
assert doc(m.kw_func2) == "k... | YannickJadoul/Parselmouth | pybind11/tests/test_kwargs_and_defaults.py | Python | gpl-3.0 | 10,048 | 0.001393 |
import random
def preprocessing(mazeMap, mazeWidth, mazeHeight, playerLocation, opponentLocation, piecesOfCheese, timeAllowed):
return
def turn (mazeMap, mazeWidth, mazeHeight, playerLocation, opponentLocation, playerScore, opponentScore, piecesOfCheese, timeAllowed):
return
def postprocessing (mazeMap, mazeWi... | vgripon/PyRat | imports/dummyplayer.py | Python | gpl-3.0 | 440 | 0.018182 |
from skin import parseColor, parseFont, parseSize
from Components.config import config, ConfigClock, ConfigInteger, ConfigSubsection, ConfigYesNo, ConfigSelection, ConfigSelectionNumber
from Components.Pixmap import Pixmap
from Components.Button import Button
from Components.ActionMap import HelpableActionMap
from Comp... | noox-/stbgui-1 | lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py | Python | gpl-2.0 | 40,917 | 0.034216 |
from ..Qt import QtGui, QtCore
import os, weakref, re
from ..pgcollections import OrderedDict
from .ParameterItem import ParameterItem
PARAM_TYPES = {}
PARAM_NAMES = {}
def registerParameterType(name, cls, override=False):
global PARAM_TYPES
if name in PARAM_TYPES and not override:
raise Exception("Pa... | hiuwo/acq4 | acq4/pyqtgraph/parametertree/Parameter.py | Python | mit | 29,533 | 0.009142 |
from protoplot.engine.options_container import OptionsContainer
from protoplot.engine.tag import make_tags_list
from protoplot.engine.item_metaclass import ItemMetaclass # @UnusedImport
from protoplot.engine.item_container import ItemContainer
# TODO options should be resolved in the proper order. Here's the proposed... | deffi/protoplot | protoplot/engine/item.py | Python | agpl-3.0 | 6,684 | 0.006882 |
# Copyright 2020 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.
"""Methods related to outputting script results in a human-readable format.
Also probably a good example of how to *not* write HTML.
"""
from __future__ imp... | nwjs/chromium.src | testing/unexpected_passes_common/result_output.py | Python | bsd-3-clause | 21,925 | 0.007206 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import gtk
from objects.gradientcolor import GradientColor
from objects.gradient import Gradient
from interfaces.signalizable import Signalizable
class GradientLine(gtk.Viewport):
def __init__(self, moving_callback=None, color_callback=None, gradient=None):
"""
... | jaliste/sanaviron | sanaviron/ui/gradienteditor.py | Python | apache-2.0 | 10,331 | 0.00242 |
# Copyright 2022 Google 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | GoogleCloudPlatform/declarative-resource-client-library | python/services/identitytoolkit/beta/tenant.py | Python | apache-2.0 | 10,862 | 0.002025 |
import urllib2
import base64
import json
from link import *;
from GitFetcher import GitHubFetcher;
username = "debuggerman"
password = "megadeth"
orgUrl = "https://api.github.com/orgs"
orgName = "coeus-solutions"
gitFetcher = GitHubFetcher(username = username, password = password, orgUrl = orgUrl, orgName = orgName)
... | debuggerman/gitstats.py | gitstats.py | Python | mit | 344 | 0.031977 |
from omelette.fromage.common import DrawableNode
class DrawableNode(DrawableNode):
def __init__(self, uml_object):
super(DrawableNode, self).__init__(uml_object)
| pienkowb/omelette | omelette/fromage/test/data/node.py | Python | gpl-3.0 | 175 | 0.005714 |
'''
Created on 20/10/2014
@author: fer
'''
if __name__ == '__main__':
print('hola')
x=32 #entero
print x
# variable mensaje
mensaje = "hola mundo"
print mensaje
#booleano
my_bool=True
print my_bool
#exponentes
calculo = 10**2
print calculo
print ("La va... | arkadoel/AprendiendoPython | PrimerosPasos/dos.py | Python | gpl-3.0 | 579 | 0.018998 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | runt18/nupic | src/nupic/frameworks/opf/metrics.py | Python | agpl-3.0 | 54,801 | 0.012992 |
"""
Support for Synology Surveillance Station Cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.synology/
"""
import asyncio
import logging
import voluptuous as vol
import aiohttp
import async_timeout
from homeassistant.cons... | morphis/home-assistant | homeassistant/components/camera/synology.py | Python | apache-2.0 | 8,436 | 0.000119 |
import os
import pickle
import numpy as np
from tqdm import tqdm
class SumTree:
def __init__(self, capacity):
self.capacity = capacity
self.tree = np.zeros(2 * capacity - 1, dtype=np.float32)
self.data = np.empty(capacity, dtype=object)
self.head = 0
@property
def total_p... | akshaykurmi/reinforcement-learning | atari_breakout/per.py | Python | mit | 4,539 | 0.000881 |
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Rez Project
"""
Get a list of a package's plugins.
"""
from __future__ import print_function
def setup_parser(parser, completions=False):
parser.add_argument(
"--paths", type=str, default=None,
help="set package search path")
... | instinct-vfx/rez | src/rez/cli/plugins.py | Python | apache-2.0 | 1,176 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the file entry implementation using pyfsapfs."""
import unittest
from dfvfs.lib import definitions
from dfvfs.path import factory as path_spec_factory
from dfvfs.resolver import context
from dfvfs.resolver import resolver
from dfvfs.vfs import apfs_attribute
... | joachimmetz/dfvfs | tests/vfs/apfs_file_entry.py | Python | apache-2.0 | 30,722 | 0.002181 |
#
# ElementTree
# $Id: ElementTree.py 3440 2008-07-18 14:45:01Z fredrik $
#
# light-weight XML support for Python 2.3 and later.
#
# history (since 1.2.6):
# 2005-11-12 fl added tostringlist/fromstringlist helpers
# 2006-07-05 fl merged in selected changes from the 1.3 sandbox
# 2006-07-05 fl removed support for ... | bikashgupta11/javarobot | src/main/resources/jython/Lib/xml/etree/ElementTree.py | Python | gpl-3.0 | 56,932 | 0.001194 |
# -*- coding: utf-8 -*-
'''
Flixnet Add-on
Copyright (C) 2017 homik
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 l... | azumimuo/family-xbmc-addon | plugin.video.showboxarize/resources/lib/sources_pl/filister.py | Python | gpl-2.0 | 5,852 | 0.003418 |
from gh_frespo_integration.utils import github_adapter
from gh_frespo_integration.models import *
from django.conf import settings
import logging
from datetime import timedelta
__author__ = 'tony'
logger = logging.getLogger(__name__)
def get_repos_and_configs(user):
repos = []
github_username = user.github_u... | eahneahn/free | djangoproject/gh_frespo_integration/services/github_services.py | Python | agpl-3.0 | 5,113 | 0.008801 |
from lxml import etree
import os
from BeautifulSoup import BeautifulSoup
from itertools import chain
def replacements(text):
text = text.replace('>', '\\textgreater ')
text = text.replace('<', '\\textless ')
text = text.replace('&', '\&')
text = text.replace('_', '\_')
text = text.replace('%'... | vijeshm/eezyReport | eezyReport.py | Python | mit | 16,797 | 0.006727 |
from django.contrib import admin
from widgy.admin import WidgyAdmin
from widgy.contrib.page_builder.models import Callout
admin.site.register(Callout, WidgyAdmin)
| j00bar/django-widgy | widgy/contrib/page_builder/admin.py | Python | apache-2.0 | 165 | 0 |
from django.db import models
from gitireadme.utils import getUploadToPath
import datetime
class Article(models.Model):
name = models.CharField(max_length=255,blank=True,null=True)
path = models.CharField(max_length=255,blank=True,null=True)
class ArticleAlias(models.Model):
repo = models.CharField(max_le... | gitireadme/gitireadme.server | gitireadme/article/models.py | Python | apache-2.0 | 391 | 0.023018 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/python/util/deprecation_test.py | Python | apache-2.0 | 28,547 | 0.004134 |
# coding=UTF-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
#import tornado
from tornado import ioloop , web , httpserver , websocket , options
#import handler function
import handler
import os
#set server setti... | ken1277725/pythonweb-STT | server/server.py | Python | mit | 1,001 | 0.034965 |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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.
CVXPY is distributed i... | sdpython/cvxpy | cvxpy/tests/test_lin_ops.py | Python | gpl-3.0 | 5,078 | 0 |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
VirtualDiskAdapterType = Enum(
'busLogic',
'ide',
'lsiLogic',
)
| xuru/pyvisdk | pyvisdk/enums/virtual_disk_adapter_type.py | Python | mit | 239 | 0 |
"""
A Python implementation of the _bh_ Olden benchmark.
The Olden benchmark implements the Barnes-Hut benchmark
that is decribed in:
J. Barnes and P. Hut, "A hierarchical o(N log N) force-calculation algorithm",
Nature, 324:446-449, Dec. 1986
The original code in the Olden benchmark suite is derived from the... | shedskin/shedskin | examples/bh.py | Python | gpl-3.0 | 20,915 | 0.001004 |
from random import sample
import os
songList = []
songDict = None
userPlayList = []
directory = ''
def getSongs(name, limit):
global songList
global directory
print('*'*30)
print('* Minerando ', str(limit), ' músicas *')
print('*'*30)
status = 0
if not os.path.exists(directory):
os... | DiegoCorrea/ouvidoMusical | config/data/oneMillionSongs/mining.py | Python | mit | 2,978 | 0.003359 |
# -*- coding: utf-8 -*-
from django.core import exceptions
from django.utils.importlib import import_module
__author__ = 'jb'
MIGRATION_MANAGERS = {}
DEFAULT_MANAGER = None
def load_manager(path):
"""
Code taken from django.
Copyright (c) Django Software Foundation and individual contributors.... | jbzdak/migration_manager | migration_manager/manager.py | Python | bsd-2-clause | 2,915 | 0.009262 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A script to manage development tasks """
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
from os import path as p
from manager import Manager
from subprocess import call
manager = Manager()
_basedir = p.d... | reubano/ckanutils | manage.py | Python | mit | 2,296 | 0 |
"""
Unique place for all runscripts to set the module path.
(i.e. if you have a copy of TEMareels in some place on your
hard disk but not in PYTHONPATH).
NOTE: it is recommended to keep a copy of all TEMareels
module files with your data/analysis, as future versions
will be not necessarily backwards... | rhambach/TEMareels | runscripts/_set_pkgdir.py | Python | mit | 674 | 0.01632 |
import _plotly_utils.basevalidators
class SourceattributionValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="sourceattribution",
parent_name="layout.mapbox.layer",
**kwargs
):
super(SourceattributionValidator, self).__init__(
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/mapbox/layer/_sourceattribution.py | Python | mit | 521 | 0 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool by AusAid - **Clipper test suite.**
Contact : ole.moller.nielsen@gmail.com
.. note:: 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... | Gustry/inasafe | safe/datastore/test/test_geopackage.py | Python | gpl-3.0 | 5,299 | 0.000189 |
import logging
import numpy as np
import pandas as pd
import numexpr as ne
from astropy import units as u, constants as const
from tardis.plasma.properties.base import ProcessingPlasmaProperty
from tardis.plasma.properties.util import macro_atom
logger = logging.getLogger(__name__)
__all__ = ['StimulatedEmissionFac... | orbitfold/tardis | tardis/plasma/properties/radiative_properties.py | Python | bsd-3-clause | 11,605 | 0.003188 |
#!/usr/bin/env python
"""
Get an action by name (name is not a supported selector for action)
"""
# import the basic python packages we need
import os
import sys
import tempfile
import pprint
import traceback
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan ... | tanium/pytan | EXAMPLES/PYTAN_API/invalid_get_action_single_by_name.py | Python | mit | 3,103 | 0.0029 |
from . import base
from grow.common import utils
from protorpc import messages
import logging
import os
import re
if utils.is_appengine():
sass = None # Unavailable on Google App Engine.
else:
import sass
SUFFIXES = frozenset(['sass', 'scss'])
SUFFIX_PATTERN = re.compile('[.](' + '|'.join(map(re.escape, SUFF... | denmojo/pygrow | grow/preprocessors/sass_preprocessor.py | Python | mit | 3,649 | 0.002192 |
# -*- coding: utf-8 -*-
#
# hdfs documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 6 16:04:56 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | laserson/hdfs | doc/conf.py | Python | mit | 10,413 | 0.006914 |
from __future__ import print_function, unicode_literals, division, absolute_import
import os
import sys
import string
import random
import hashlib
import logging
import subprocess
from io import StringIO
import config
def valid_path(path):
"""
Returns an expanded, absolute path, or None if the path does not ... | hwkns/macguffin | files/utils.py | Python | gpl-3.0 | 5,724 | 0.001747 |
"""Config flow for TP-Link."""
from __future__ import annotations
from typing import Any
from kasa import SmartDevice, SmartDeviceException
from kasa.discover import Discover
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.const import CO... | home-assistant/home-assistant | homeassistant/components/tplink/config_flow.py | Python | apache-2.0 | 5,772 | 0.001213 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
import random
import string
def activation_code(chars = string.ascii_uppercase + string.digits, length=16):
return ''.join([random.choice(chars) for i in range(length)])
if __... | Show-Me-the-Code/python | pylyria/0001/0001_1.py | Python | mit | 651 | 0.012939 |
"""
Simple http server to create streams for asyncio tests
"""
import asyncio
import aiohttp
from aiohttp import web
import codecs
from utils.streamdecoder import DecodingStreamReader
async def get_data(host, port):
url = 'http://{}:{}/'.format(host, port)
decoder = codecs.getincrementaldecoder('utf-8')(erro... | ethanfrey/aiojson | aiojson/echo_server.py | Python | bsd-3-clause | 1,771 | 0.000565 |
../../../../../../share/pyshared/twisted/persisted/journal/base.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/twisted/persisted/journal/base.py | Python | gpl-3.0 | 66 | 0.015152 |
__author__ = 'mFoxRU'
import scipy.signal as sps
from abstractwavelet import AbstractWavelet
class Ricker(AbstractWavelet):
name = 'Ricker(MHAT)'
params = {}
def fn(self):
return sps.ricker
| mFoxRU/cwaveplay | cwp/wavelets/ricker.py | Python | mit | 215 | 0 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import itertools
import os
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, Iterable, List, Mapping, Optional, Sequence, Set, Tuple, Type
fro... | tdyas/pants | src/python/pants/option/options_bootstrapper.py | Python | apache-2.0 | 9,939 | 0.004628 |
import redis
class RedisAdapter:
storage = None
host = None
port = None
def __init__(self, host, port):
if not self.storage:
self.storage = redis.StrictRedis(host=host, port=int(port), db=0)
def get_storage(self):
return self.storage
| MShel/PyChatBot | storage/Redis.py | Python | gpl-3.0 | 288 | 0 |
#
# Copyright (c) 2013 Red Hat, 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 t... | oVirt/ovirt-engine-sdk-tests | src/utils/dictutils.py | Python | apache-2.0 | 1,025 | 0.002927 |
import os
import numpy
from numpy.distutils.misc_util import Configuration
def configuration(parent_package="", top_path=None):
config = Configuration("tree", parent_package, top_path)
libraries = []
if os.name == 'posix':
libraries.append('m')
config.add_extension("_tree",
... | B3AU/waveTree | sklearn/waveTree/setup.py | Python | bsd-3-clause | 672 | 0.001488 |
#!/usr/bin/env python
"""
lit - LLVM Integrated Tester.
See lit.pod for more information.
"""
from __future__ import absolute_import
import math, os, platform, random, re, sys, time
import lit.ProgressBar
import lit.LitConfig
import lit.Test
import lit.run
import lit.util
import lit.discovery
class TestingProgress... | JianpingZeng/xcc | xcc/java/utils/lit/lit/main.py | Python | bsd-3-clause | 21,621 | 0.005041 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.