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 src.game_utils.function_proxy as check
from src.basic_functions import *
"""
This file is the one you'll be working on
read the documentation of the functions to know
what it must be able to do.
"""
def move_snake():
"""
This function controls how the snake moves
Uses an edited v... | RagaiAhmed/PSP | src/tasks.py | Python | apache-2.0 | 1,617 | 0.005566 |
from collections import UserDict
class PathDict(UserDict):
def __normalize_key(self, key):
tkey = key
if isinstance(key, str) and '.' in key:
tkey = tuple(key.split('.'))
return tkey
def __setitem__(self, key, value):
tkey = self.__normalize_key(key)
retur... | UKTradeInvestment/export-wins-data | fdi/tests/util.py | Python | gpl-3.0 | 706 | 0 |
## Copyright (c) 2003 Henk Punt
## 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,
#... | toymachine/venster | venster/windows.py | Python | mit | 23,583 | 0.018318 |
# This is the interface for adb
import subprocess
import logging
import re
from adapter import Adapter
import time
import sys
import os
class ADBException(Exception):
"""
Exception in ADB connection
"""
pass
class ADB(Adapter):
"""
interface of ADB
send adb commands via this, see:
ht... | nastya/droidbot | droidbot/adapter/adb.py | Python | mit | 13,744 | 0.003783 |
# -*- coding: Latin-1 -*-
"""Graphviz's dot language Python interface.
This module provides with a full interface to create handle modify
and process graphs in Graphviz's dot language.
References:
pydot Homepage: http://code.google.com/p/pydot/
Graphviz: http://www.graphviz.org/
DOT Language: http://www.grap... | andrewjylee/omniplay | logdb/pydot.py | Python | bsd-2-clause | 60,152 | 0.01694 |
#!/usr/bin/python3 -S
# -*- coding: utf-8 -*-
"""
`Unit tests for cargo.clients.AioPostgresPool`
--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--
2016 Jared Lunde © The MIT License (MIT)
http://github.com/jaredlunde
"""
import unittest
import psycopg2
from cargo.cursors import... | jaredlunde/cargo-orm | unit_tests/aio/AioPostgresPool.py | Python | mit | 5,680 | 0 |
import pydev_log
import traceback
import pydevd_resolver
from pydevd_constants import * #@UnusedWildImport
from types import * #@UnusedWildImport
try:
from urllib import quote
except:
from urllib.parse import quote #@UnresolvedImport
try:
from xml.sax.saxutils import escape
def makeValidXmlValue(s):
... | akiokio/centralfitestoque | src/.pycharm_helpers/pydev/pydevd_xml.py | Python | bsd-2-clause | 6,287 | 0.009384 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
lasduplicate.py
---------------------
Date : September 2013
Copyright : (C) 2013 by Martin Isenburg
Email : martin near rapidlasso point com
************... | jarped/QGIS | python/plugins/processing/algs/lidar/lastools/lasduplicate.py | Python | gpl-2.0 | 3,468 | 0.001442 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-03-13 11:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('views', '0014_data_migration'),
]
operations = [
migrations.AlterField(
... | rdmorganiser/rdmo | rdmo/views/migrations/0015_remove_null_true.py | Python | apache-2.0 | 4,097 | 0.003661 |
#!/usr/bin/env python
import sys
from imp import load_source
from os import path
src_path = path.abspath(path.dirname(__file__))
oj_path = path.join(src_path, 'dependencies', 'oj')
sys.path.append(oj_path)
oj = load_source('oj', path.join(oj_path, 'utils', 'run.py'))
oj.run(src_path)
| NuAge-Solutions/NW | oj.py | Python | gpl-3.0 | 292 | 0 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel 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 require... | dmsuehir/spark-tk | regression-tests/sparktkregtests/testcases/frames/frame_group_by_test.py | Python | apache-2.0 | 10,492 | 0.000096 |
import datetime
import re
import requests
from django.conf import settings
from django.utils.timezone import make_aware, utc
from raven.contrib.django.raven_compat.models import client as sentry_client
def get_articles_data(count=8):
payload = {
'consumer_key': settings.POCKET_CONSUMER_KEY,
'acce... | sgarrity/bedrock | bedrock/pocketfeed/api.py | Python | mpl-2.0 | 1,744 | 0.00172 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/requests/messages/evolve_pokemon_message.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _m... | bellowsj/aiopogo | aiopogo/pogoprotos/networking/requests/messages/evolve_pokemon_message_pb2.py | Python | mit | 3,240 | 0.008025 |
from test.UdsTest import UdsTest
from test.stub import StubbedIsoTPSocket
from udsoncan.exceptions import *
import socket
class TestStubbedIsoTPSocket(UdsTest):
def test_open(self):
tpsock = StubbedIsoTPSocket()
self.assertFalse(tpsock.bound)
tpsock.bind(interface='vcan0', rxid=0x100, txid=... | pylessard/python-udsoncan | test/test_stubbed_isotpsock.py | Python | mit | 2,233 | 0.000896 |
import io,pycurl,sys,os,time
class idctest:
def __init__(self):
self.contents = ''
def body_callback(self,buf):
self.contents = self.contents + buf
def test_gzip(input_url):
t = idctest()
#gzip_test = file("gzip_test.txt", 'w')
c = pycurl.Curl()
c.setopt(pycurl.WRITEFUNCT... | jinzekid/codehub | python/test_web_speed.py | Python | gpl-3.0 | 1,603 | 0.022163 |
#
# Copyright (c) 2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of... | hustodemon/spacewalk | backend/wsgi/__init__.py | Python | gpl-2.0 | 609 | 0 |
#!/usr/bin/env python3
from mathbind.types import BasicType
class BasicValueType(BasicType):
"""
Represents a basic pure type that can be passed by value, thus excluding arrays and pointers.
Attributes:
- typename (str): basic C typename (int, long long, unsigned, bool, etc)
- c_math_name (str): ... | diogenes1oliveira/mathbind | mathbind/types/basicvaluetype.py | Python | mit | 3,498 | 0.002287 |
# Copyright 2008-2009 WebDriver committers
# Copyright 2008-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 requ... | jijeshmohan/webdriver-rb | firefox/src/py/firefox_profile.py | Python | apache-2.0 | 11,601 | 0.003017 |
#
# 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
# ... | mahak/cinder | cinder/tests/unit/image/test_accelerator.py | Python | apache-2.0 | 3,676 | 0.002176 |
"""
Copyright 2008, 2009, 2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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... | glennlive/gnuradio-wg-grc | grc/gui/MainWindow.py | Python | gpl-3.0 | 13,903 | 0.006258 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py | Python | mit | 16,766 | 0.005189 |
"""followers
Revision ID: 2356a38169ea
Revises: 288cd3dc5a8
Create Date: 2013-12-31 16:10:34.500006
"""
# revision identifiers, used by Alembic.
revision = '2356a38169ea'
down_revision = '288cd3dc5a8'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by... | mrcatacroquer/Bridge | migrations/versions/2356a38169ea_followers.py | Python | mit | 941 | 0.012752 |
'''
Created on Apr 19, 2012
@package: superdesk media archive
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor
SQL Alchemy based implementation for the image data API.
'''
from ally.cdm.spec import ICDM
from ally.container import wire
from ally.container... | superdesk/Live-Blog | plugins/media-archive-image/superdesk/media_archive/impl/image_data.py | Python | agpl-3.0 | 1,525 | 0.007213 |
#!/usr/bin/env python
from time import sleep
class ButtonListener():
"""
Service that polls the button status device and calls a
callback funtion for each button pressed.
Callback function should return a boolean to show whether
or not the listening should continue.
"""
def __init__(se... | kd0kfo/pi_lcd_controller | python/picontroller/button_listener.py | Python | gpl-3.0 | 1,373 | 0.00437 |
# Multi-threaded Mandelbrot Fractal (Do not run using IDLE!)
# FB - 201104306
import threading
from PIL import Image
w = 512 # image width
h = 512 # image height
image = Image.new("RGB", (w, h))
wh = w * h
maxIt = 256 # max number of iterations allowed
# drawing region (xa < xb & ya < yb)
xa = -2.0
xb = 1.0
ya = -1.5
y... | ActiveState/code | recipes/Python/577680_Multithreaded_Mandelbrot_Fractal/recipe-577680.py | Python | mit | 1,749 | 0.009148 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
###########################################################################
## ##
## Copyrights Frédéric Rodrigo 2016 ##
## ... | tyndare/osmose-backend | analysers/analyser_osmosis_highway_turn_lanes.py | Python | gpl-3.0 | 4,965 | 0.006448 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
A tool to generate a tasks_list.sh file for running fmriprep
on subjects downloaded with datalad with sample_openfmri.py
"""
import os
import glob
CMDLINE = """\
{fmriprep_cm... | oesteban/preprocessing-workflow | fmriprep/cli/sample_openfmri_tasks_list.py | Python | bsd-3-clause | 3,643 | 0.000549 |
from distutils.core import setup
from program_version import RELEASE
setup(name='program',
version=RELEASE,
description='A self updating program example',
author='Mr Snow',
author_email='ninja@snow.com',
url='https://github.com/mr-ninja-snow/Self-Updating-Python-Program.git',
packa... | mr-ninja-snow/Self-Updating-Python-Program | setup.py | Python | gpl-3.0 | 334 | 0.005988 |
"""
Due is a learning, modular, action-oriented dialogue agent. `Agents` are the
entities that can take part in Episodes (:mod:`due.episode`), receiving and
issuing Events (:mod:`due.event`).
"""
import uuid
from abc import ABCMeta, abstractmethod
from datetime import datetime
from due.event import Event
from due impo... | dario-chiappetta/Due | due/agent.py | Python | gpl-3.0 | 7,123 | 0.026534 |
from django import forms
# future use | DemocracyFoundation/Epitome | Agora/forms.py | Python | agpl-3.0 | 40 | 0.025 |
#Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.
import sys
sys.path.append("./CommonTestScripts")
import Test
doc = atfDocService.OpenNewDocument(editor)
#===================== 0: root ==================================
Test.Equal(0, Test.GetEnumerableCount(treeLister.TreeView.GetChil... | mindbaffle/ATF | Test/FunctionalTests/DomTreeEditorTestScripts/AddAllItems.py | Python | apache-2.0 | 20,874 | 0.007857 |
"""Makes figure with GridRad and MYRORSS predictors."""
import argparse
import numpy
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as pyplot
from gewittergefahr.gg_utils import soundings
from gewittergefahr.gg_utils import radar_utils
from gewittergefahr.gg_utils import time_conversion
from gewitter... | thunderhoser/GewitterGefahr | gewittergefahr/prediction_paper_2019/make_predictor_figure.py | Python | mit | 17,810 | 0.000842 |
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/... | staute/shinken_deb | shinken/util.py | Python | agpl-3.0 | 24,533 | 0.001141 |
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
from acq4.util.DataManager import *
#import acq4.Manager as Manager
import acq4.pyqtgraph as pg
#from acq4.pyqtgraph.MultiPlotWidget import MultiPlotWidget
#from acq4.pyqtgraph.ImageView import ImageView
from acq4.util.DictView import *
import acq4.util.metaarray... | mgraupe/acq4 | acq4/modules/DataManager/FileDataView.py | Python | mit | 3,567 | 0.00841 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mining RPCs
- getmininginfo
- getblocktemplate proposal mode
- submitblock"""
import copy
from b... | Jcing95/iop-hd | test/functional/mining.py | Python | mit | 5,574 | 0.002153 |
"""
ship_crew.py
Generates a minimal ship crew based on tonnage.
python crew -s 400
"""
from __future__ import print_function
import random
import sys
sys.path.append(".")
from character import Character
import character_tools
def get_career():
return random.choice(['Scouts', 'Navy', 'Merchants'])
def creat... | makhidkarun/py_tools | lib/ship_crew.py | Python | gpl-3.0 | 852 | 0.026995 |
# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
A Grouper establishes a group of parenting nodes for which
each level is setted in equivalent hdf5 structure.
"""
#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYour... | Ledoux/ShareYourSystem | Pythonlogy/draft/Noders/Grouper/Drafts/__init__ copy.py | Python | mit | 4,755 | 0.04837 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | sysadminmatmoz/odoo-clearcorp | account_exchange_rates_adjustment/__init__.py | Python | agpl-3.0 | 1,086 | 0 |
# -*- coding: utf-8 -*-
msg = {
'en': {
'isbn-formatting': u'Robot: Formatting ISBN',
},
# Author: Csisc
# Author: Lloffiwr
# Author: Xqt
'qqq': {
'isbn-formatting': u'Edit summary when the bot fixes [http://en.wikipedia.org/wiki/International_Standard_Book_Number ISBN] number formatting.',
},
# Author: Csi... | legoktm/pywikipedia-rewrite | scripts/i18n/isbn.py | Python | mit | 10,492 | 0.047954 |
#
# Copyright 2010 (C) Norwegian University of Science and Technology
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# Thi... | alexanderfefelov/nav | python/nav/web/portadmin/views.py | Python | gpl-2.0 | 20,814 | 0 |
# (c) 2016, Allen Sanabria <asanabria@linuxdynasty.org>
#
# This file is part of Ansible
#
# 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 License, or
# (at your option) any l... | Tatsh-ansible/ansible | lib/ansible/plugins/action/include_vars.py | Python | gpl-3.0 | 10,206 | 0.001372 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('setlist', '0012_remove_show_leg'),
]
operations = [
migrations.CreateModel(
name='Show2',
fields=[
... | tylereaves/26md | setlist/migrations/0013_show2.py | Python | bsd-3-clause | 970 | 0.002062 |
# Force loading views
from oioioi.disqualification.views import disqualification_fragment
app_name = 'disqualification'
urlpatterns = ()
| sio2project/oioioi | oioioi/disqualification/urls.py | Python | gpl-3.0 | 139 | 0 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# CowBots -- Error detection bots for CKAN-of-Worms
# By: Emmanuel Raviart <emmanuel@raviart.com>
#
# Copyright (C) 2013 Etalab
# http://github.com/etalab/cowbots
#
# This file is part of CowBots.
#
# CowBots is free software; you can redistribute it and/or modify
# it u... | etalab/cowbots | email_changes.py | Python | agpl-3.0 | 16,025 | 0.016047 |
import json
import requests
class Building():
"""Building Client."""
# Service Setup
config = {
'schema': 'http',
'host': 'localhost',
'port': '9202',
'endpoint': 'api/v1/buildings'
}
@classmethod
def base_url(cls):
"""Form the base url for the service... | Foris/darwined-core-python-clients | darwined_core_python_clients/physical/buildings.py | Python | mit | 2,117 | 0 |
#!/usr/bin/env python3
#定义一个变量a
a = 100
#判断a是否大于等于0
if a >= 100:
# 如果大于等于0执行这里边的内容
print('a为正 a =',a)
else:
# 反之执行这段代码
print('a为负 a =',a)
#
#转义字符
#
print("I'm OK")
print('I\'m OK')
print('I\'m\tlearning\nPython')
# 使用 r'' 来使 '' 里边的字符串不需要转 // 但是这样不行 --> print(r'I'm OK')
print(r'\\n\\')
# 如果有很多换行的地方可以使用 ... | CrazyDaiDai/learningPython | hellow.py | Python | gpl-3.0 | 1,589 | 0.019119 |
__author__ = 'mdavid'
| netkicorp/wns-api-server | netki/util/__init__.py | Python | bsd-3-clause | 23 | 0.043478 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Case',
fields=[
('id', models.AutoField(primary... | Omrigan/diseases | diseases/migrations/0001_initial.py | Python | mit | 1,149 | 0.003481 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-06 13:24
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('badges', '0003_badgedesign_bg_color'),
]
operations = ... | helfertool/helfertool | src/badges/migrations/0004_auto_20160306_1424.py | Python | agpl-3.0 | 638 | 0.001567 |
# coding=utf-8
'''
xssbot 必须具有以下功能
1.可对指定url进行访问
2.拦截alert等框框
3.拦截页内跳转
4.锁定设定cookies(未实现)
在EditThisCookie的chrome扩展中使用扩展特有的接口实现
chrome.cookies.onChanged.addListener
但在https://chromedevtools.github.io/devtools-protocol/文档中并没有相关类似功能、
'''
from chromeremote import ChromeTabThread as ChromeTab
... | sadnoodles/chromeremote | examples/xssbot.py | Python | gpl-3.0 | 2,168 | 0 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from ggrc import db
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import validates
from .categorization import Categorization
from .mixins import deferred, Base, Hierarch... | NejcZupec/ggrc-core | src/ggrc/models/category.py | Python | apache-2.0 | 1,823 | 0.013165 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyrigt: (c) 2017, Yanis Guenane <yanis+ansible@guenane.org>
# 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
ANSIBLE_METADATA = {'metadata_ve... | azaghal/ansible | test/support/integration/plugins/modules/openssl_csr.py | Python | gpl-3.0 | 53,940 | 0.004301 |
# TwilioQuest version 3.1.26
# Works in:
# 3.1.26
# bog standard main function
def main():
print("functions")
hail_friend()
print("function arguments")
hail_friend("Operator")
print("function return values")
print(f"{add_numbers(45, -1)}")
# functions the tasks demand
def add_numbers(num1... | greysondn/gamesolutions | twilioquest/python/codepath/functions.py | Python | mit | 644 | 0.006211 |
#! /usr/bin/env python
# Copyright (C) 2011-2012 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
# 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, ... | adapteva/epiphany-gdb | gdb/copyright.py | Python | gpl-2.0 | 11,525 | 0.000954 |
"""
@file
@brief This file loads and saves settings (as JSON)
@author Ted Lazaros <tedlaz@gmail.com>
@section LICENSE
"""
try:
import json
except ImportError:
import simplejson as json
import copy
from classes.logger import log
class JsonDataStore:
"""
This class which allow... | tedlaz/pyted | tests/pysqlqt/src/classes/json_data.py | Python | gpl-3.0 | 4,956 | 0 |
[m,n] = map(int,input().split())
def find(v,cs):
for c in cities:
if v in c:
return (True,c)
return (False,set([v]))
cities = []
for _ in range(n):
[a,b] = map(int,input().split())
(ra,fa) = find(a,cities)
(rb,fb) = find(b,cities)
mg = fa | fb
if ra:
cities.r... | a143753/AOJ | 1576.py | Python | apache-2.0 | 497 | 0.026157 |
#!/usr/bin/env python
import glob
import os
import platform
import shutil
import stat
import sys
from distutils import log
from distutils import dir_util
from distutils.command.build_clib import build_clib
from distutils.command.sdist import sdist
from distutils.core import setup
from distutils.sysconfig import get_py... | zneak/capstone | bindings/python/setup.py | Python | bsd-3-clause | 6,134 | 0.001304 |
#!/usr/bin/env python3
#
# Create frozen modules structure for MicroPython.
#
# Usage:
#
# Have a directory with modules to be frozen (only modules, not packages
# supported so far):
#
# frozen/foo.py
# frozen/bar.py
#
# Run script, passing path to the directory above:
#
# ./make-frozen.py frozen > frozen.c
#
# Include... | jimkmc/micropython | tools/make-frozen.py | Python | mit | 1,041 | 0.000961 |
import platform
from base64 import b64encode
import re
from ingenico.connect.sdk.data_object import DataObject
from ingenico.connect.sdk.defaultimpl.default_marshaller import \
DefaultMarshaller
from ingenico.connect.sdk.domain.metadata.shopping_cart_extension import ShoppingCartExtension
from request_header impor... | Ingenico-ePayments/connect-sdk-python2 | ingenico/connect/sdk/meta_data_provider.py | Python | mit | 5,912 | 0.001522 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2014 Torsten Duwe <duwe@suse.de>
## Copyright (C) 2014 Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public Lic... | zeldin/libsigrokdecode | decoders/timing/pd.py | Python | gpl-3.0 | 4,356 | 0.005282 |
import sys, os, fabric
class PiServicePolicies:
@staticmethod
def is_local():
return (not fabric.api.env.hosts or fabric.api.env.hosts[0] in ['localhost', '127.0.0.1', '::1'])
@staticmethod
def is_pi():
return os.path.isdir('/home/pi')
@staticmethod
def check_local_or_exit():
if not PiService... | creative-workflow/pi-setup | lib/piservices/policies.py | Python | mit | 867 | 0.023068 |
"""autogenerated by genpy from geographic_msgs/GetGeographicMapRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import geographic_msgs.msg
class GetGeographicMapRequest(genpy.Message):
_md5sum = "505cc89008cb1745810d2ee4ea646d6e"
_type = "... | superdyzio/PWR-Stuff | AIR-ARR/Projekt Zespołowy/catkin_ws/devel/lib/python2.7/dist-packages/geographic_msgs/srv/_GetGeographicMap.py | Python | mit | 33,019 | 0.015385 |
import csv
import os
class ArticleMappingReader(object):
def __init__(self, arcticlesFilepath, delimiter=','):
self.__delimiter = delimiter
self.__articlesFilepath = arcticlesFilepath
self.__articlesFile = None
self.__articlesReader = None
self.__currentArticleData = None... | CodeLionX/CommentSearchEngine | cse/reader/ArticleMappingReader.py | Python | mit | 1,729 | 0.009254 |
import requests
class YGOPricesAPI():
def __init__(self):
self.url = "http://yugiohprices.com/api"
def __make_request(self, url):
"""Request a resource from api"""
request = requests.get(url)
if request.status_code != 200:
status_code = request.status_code
... | mneary1/YGOPricesAPI | prices.py | Python | mit | 2,551 | 0.000784 |
# Copyright 2013 Cloudbase Solutions Srl
# 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 r... | openstack/compute-hyperv | compute_hyperv/nova/imagecache.py | Python | apache-2.0 | 11,925 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-logic/azure/mgmt/logic/models/integration_account_map_paged.py | Python | mit | 926 | 0.00108 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'LoginWidget.ui'
#
# Created: Wed Jul 13 22:46:23 2011
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Att... | buchwj/xvector | client/xVClient/ui/LoginWidgetUI.py | Python | gpl-3.0 | 11,829 | 0.004734 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 Lic... | kvar/ansible | lib/ansible/modules/network/fortios/fortios_system_replacemsg_traffic_quota.py | Python | gpl-3.0 | 10,207 | 0.001568 |
#!/usr/bin/python
import re,os
def compare_file(x,y):
dr = re.compile(r"[\S]+?([0-9]+)[\S]+")
orderx = -1
ordery = -1
m = dr.match(x)
if m:
orderx = int(m.group(1))
m = dr.match(y)
if m:
ordery = int(m.group(1))
if orderx == -1 or ordery== -1:
return 0
if orderx>ordery:
return 1
elif orderx==ordery:
... | thierry1985/project-1022 | domains/driverlogshift/readsetting.py | Python | mit | 965 | 0.048705 |
import numpy as np
import random
class NeuralNetwork():
def __init__(self, sizes):
# sizes is an array with the number of units in each layer
# [2,3,1] means w neurons of input, 3 in the hidden layer and 1 as output
self.num_layers = len(sizes)
self.sizes = sizes
# the syn... | guilhermefloriani/signature-recognition | network.py | Python | mit | 4,512 | 0.005319 |
import enum
class calendar_permissions(enum.IntEnum):
ASCIT = 21
AVERY = 22
BECHTEL = 23
BLACKER = 24
DABNEY = 25
FLEMING = 26
LLOYD = 27
PAGE = 28
RICKETTS = 29
RUDDOCK = 30
OTHER = 31
ATHLETICS = 32
| ASCIT/donut-python | donut/modules/calendar/permissions.py | Python | mit | 251 | 0 |
#!/usr/bin/env python
"""
SyntaxError - There's something wrong with how you wrote the surrounding code.
Check your parentheses, and make sure there are colons where needed.
"""
while True
print "Where's the colon at?" | selimnairb/2014-02-25-swctest | lessons/thw-python-debugging/basic_exceptions/syntax_error.py | Python | bsd-2-clause | 223 | 0.008969 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | rahulunair/nova | nova/tests/functional/api_sample_tests/test_instance_actions.py | Python | apache-2.0 | 5,930 | 0 |
# Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
"""List commands"""
arg = argument.lower()
index ... | nickraptis/fidibot | src/modules/help.py | Python | bsd-2-clause | 2,615 | 0.000765 |
# -*- coding: utf-8 -*-
import fcntl
import glob
import json
import os
import random
import shutil
import socket
import subprocess
import sys
import tempfile
import time
TEST_DIR = os.path.normpath(os.path.dirname(os.path.realpath(os.path.join(__file__, ".."))))
def browser_path(headless=True):
"""Return path t... | stefwalter/cockpit | test/common/cdp.py | Python | lgpl-2.1 | 9,003 | 0.002777 |
import numpy as np
STR_NOBOND = """AU
3 1 2 1
1 0.00000000 0.00000000 0.00000000 -0.66387672 0.00000000 -0.00000000 0.34509720 3.78326969 -0.00000000 -0.00000000 3.96610412 0.00000000 3.52668267 0.00000000 -0.00000000 -2.98430053 0.00000000 -0.00000000 ... | vahtras/loprop | tests/test_bond.py | Python | gpl-3.0 | 7,956 | 0.005279 |
from django.test import TestCase
from restclients.mock_http import MockHTTP
from myuw.util.cache_implementation import MyUWCache
from restclients.models import CacheEntryTimed
from datetime import timedelta
CACHE = 'myuw.util.cache_implementation.MyUWCache'
class TestCustomCachePolicy(TestCase):
def test_sws_de... | fanglinfang/myuw | myuw/test/cache.py | Python | apache-2.0 | 5,375 | 0 |
# coding: utf-8
# In[2]:
# Import and read the datset
import numpy as np
from sklearn import linear_model
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv("C://Users//Koyel//Desktop/MieRobotAdvert.csv")
dataset.head()
# In[3]:
dataset.describe()
# In[4]:
dataset.columns
# In[5]:
i... | MieRobot/Blogs | Blog_LinearRegression.py | Python | gpl-3.0 | 1,518 | 0.009223 |
"""Utility classes and functions for configuring and setting up the content and the look of a QR code."""
import datetime
import decimal
from collections import namedtuple
from dataclasses import dataclass, asdict
from datetime import date
from typing import Optional, Any, Union, Sequence
from django.utils.html import... | dprog-philippe-docourt/django-qr-code | qr_code/qrcode/utils.py | Python | bsd-3-clause | 30,602 | 0.003171 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | jumpstarter-io/horizon | openstack_dashboard/dashboards/admin/images/properties/forms.py | Python | apache-2.0 | 3,269 | 0.000612 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | souravbadami/oppia | schema_utils_test.py | Python | apache-2.0 | 25,162 | 0.000318 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# eLyXer -- convert LyX source files to HTML output.
#
# Copyright (C) 2009 Alex Fernández
#
# 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 Foundat... | hainm/elyxer | src/elyxer/gen/layout.py | Python | gpl-3.0 | 10,103 | 0.010792 |
"""Test cases for JSON lws_logger module, assumes Pytest."""
from jsonutils.lws import lws_logger
class TestDictToTreeHelpers:
"""Test the helper functions for dict_to_tree."""
def test_flatten_list(self):
"""Test flattening of nested lists."""
f = lws_logger.flatten_list
nested = [1... | tkuriyama/jsonutils | jsonutils/lws/test/test_lws_logger.py | Python | mit | 3,990 | 0 |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.views.... | Tusky/DjangoSample | blog/views.py | Python | mit | 2,273 | 0.00088 |
from __future__ import with_statement
from sympy.printing.mathml import mathml
import tempfile
import os
def print_gtk(x, start_viewer=True):
"""Print to Gtkmathview, a gtk widget capable of rendering MathML.
Needs libgtkmathview-bin"""
from sympy.utilities.mathml import c2p
tmp = tempfile.mktemp()... | lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/printing/gtk.py | Python | gpl-3.0 | 510 | 0.003922 |
from pahera.models import Person
from django.db import connection, transaction
from pahera.Utilities import DictFetchAll
# To check whether there exists a user with same email or phone no before registering the new user..!!!
def VerifyTheUser(data):
cursor = connection.cursor()
email = data['email']
phone ... | thebachchaoproject/bachchao-server | pahera/PythonModules/CheckIfUserExists_mod.py | Python | mit | 1,431 | 0.004892 |
import unittest
import pqkmeans
import numpy
import collections
import pickle
class TestPQKMeans(unittest.TestCase):
def data_source(self, n: int):
for i in range(n):
yield [i * 100] * 6
def setUp(self):
# Train PQ encoder
self.encoder = pqkmeans.encoder.PQEncoder(num_subd... | kogaki/pqkmeans | test/clustering/test_pqkmeans.py | Python | mit | 2,918 | 0.004798 |
HTBRootQdisc = """\
tc qdisc add dev {interface!s} root handle 1: \
htb default {default_class!s}\
"""
HTBQdisc = """\
tc qdisc add dev {interface!s} parent {parent!s} handle {handle!s} \
htb default {default_class!s}\
"""
NetemDelayQdisc = """\
tc qdisc add dev {interface!s} parent {parent!s} handle {handle!s} \
ne... | praus/shapy | shapy/framework/commands/qdisc.py | Python | mit | 537 | 0.001862 |
import time as real_time
import unittest
import jwt as jwt_lib
from mock import patch
from twilio.jwt import Jwt, JwtDecodeError
class DummyJwt(Jwt):
"""Jwt implementation that allows setting arbitrary payload and headers for testing."""
ALGORITHM = 'HS256'
def __init__(self, secret_key, issuer, subje... | twilio/twilio-python | tests/unit/jwt/test_jwt.py | Python | mit | 9,331 | 0.002251 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2014, Hewlett-Packard Development Company, L.P.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# Standard openstack documentation fragment
DOCUMENTATION = r'''
options:
cloud:
descri... | thaim/ansible | lib/ansible/plugins/doc_fragments/openstack.py | Python | mit | 3,726 | 0.001074 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-oslogin | google/cloud/oslogin_v1/types/__init__.py | Python | apache-2.0 | 1,116 | 0 |
from django.apps import AppConfig
class FilesConfig(AppConfig):
name = 'files'
verbose_name = 'Files'
def ready(self):
from . import signals
| chaos-soft/chocola | files/apps.py | Python | mit | 164 | 0 |
try:
from configparser import NoSectionError, NoOptionError
except ImportError:
from ConfigParser import NoSectionError, NoOptionError
from django import forms
from django.utils.translation import ugettext as _
def get_option(settings, section, option):
try:
return settings.get(section, option)
... | trehn/django-installer | django_installer/installer/forms.py | Python | isc | 2,440 | 0.00041 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Taoni.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | LunacyZeus/Tao-ni | web/Taoni/manage.py | Python | gpl-3.0 | 803 | 0 |
from django.test import TestCase
from wagtail.search.tests.test_backends import BackendTests
from wagtail.tests.search import models
from ..utils import BOOSTS_WEIGHTS, WEIGHTS_VALUES, determine_boosts_weights, get_weight
class TestPostgresSearchBackend(BackendTests, TestCase):
backend_path = 'wagtail.contrib.p... | kaedroho/wagtail | wagtail/contrib/postgres_search/tests/test_backend.py | Python | bsd-3-clause | 7,353 | 0.000272 |
#!/usr/bin/env python
# Copyright 2014 Rafael Dantas Justo. All rights reserved.
# Use of this source code is governed by a GPL
# license that can be found in the LICENSE file.
import getopt
import sys
import subprocess
import urllib.request
class NS:
def __init__(self):
self.name = ""
self.type = "NS"
... | rafaeljusto/shelter | testing/scan_querier/scan_querier.input.py | Python | gpl-2.0 | 3,451 | 0.019994 |
__author__ = 'Christof Pieloth'
import logging
from packbacker.errors import ParameterError
from packbacker.installers import installer_prototypes
from packbacker.utils import UtilsUI
class Job(object):
log = logging.getLogger(__name__)
def __init__(self):
self._installers = []
def add_instal... | cpieloth/CppMath | tools/PackBacker/packbacker/job.py | Python | apache-2.0 | 2,389 | 0.000837 |
import json
import pickle
import numpy as np
import pandas as pd
import numpy as np
import datatables.traveltime
def write_model(baserate, model_file):
"""
Write model to file
baserate -- average travel time
output_file -- file
"""
model_params = {
'baserate': baserate
}
model_s... | anjsimmo/simple-ml-pipeline | learners/traveltime_baserate.py | Python | mit | 1,292 | 0.00387 |
import logging
import tmlib.models as tm
class SubmissionManager(object):
'''Mixin class for submission and monitoring of computational tasks.'''
def __init__(self, experiment_id, program_name):
'''
Parameters
----------
experiment_id: int
ID of the processed expe... | TissueMAPS/TmLibrary | tmlib/submission.py | Python | agpl-3.0 | 1,761 | 0.000568 |
#!/usr/bin/env python3
#
# Copyright (c) 2015-2017 Nest Labs, 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/lice... | openweave/happy | happy/ReturnMsg.py | Python | apache-2.0 | 1,604 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.