code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""Compatibility shim for PIL's `ImageMorph`."""
from PIL.ImageMorph import *
| coxmediagroup/pil-compat | ImageMorph/__init__.py | Python | mit | 78 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from models import Subscriber,Newsletter
class SubscriberAdmin(admin.ModelAdmin):
list_display = ('email','created')
list_display_links = ('email','created')
ordering = ['id']
class NewsletterAdmin(admin.ModelAdmin):
list_display = ('send','n')... | userzimmermann/wbc | lib/wbc/news/admin.py | Python | gpl-3.0 | 479 |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
#
# License: MIT
#
"""This module exports the Arc plugin class."""
from SublimeLinter.lint import Linter, util
class Arc(Linter):
"""Provides an interface to arc."""
syntax = ('php', 'html')
cmd = 'arc lint --out... | rissole/SublimeLinter-contrib-arc | linter.py | Python | mit | 749 |
"""."""
import numpy as _np
from ..search import PSSearch as _PSSearch
from ..namesys import SiriusPVName as _SiriusPVName
from . import Device as _Device
from . import Devices as _Devices
from . psconv import StrengthConv as _StrengthConv
class PSNamesSOFB:
"""."""
_sofb = dict()
_sofb_factory = None
... | lnls-sirius/dev-packages | siriuspy/siriuspy/devices/pssofb.py | Python | gpl-3.0 | 12,042 |
# 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... | klmitch/nova | nova/tests/unit/policies/test_availability_zone.py | Python | apache-2.0 | 4,849 |
from distutils.core import setup
from distutils.extension import Extension
from distutils.command.install_lib import install_lib as _install
from Cython.Distutils import build_ext
VERSION = '3.0.4'
compile_args = ['-O3', '-fomit-frame-pointer']
ext_modules = [
Extension("capstone.ccapstone", ["pyx/ccapstone.pyx"... | dhxkgozj/DirEngine | lib/capstone/bindings/python/setup_cython.py | Python | bsd-3-clause | 2,667 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# when web2py is run as a windows service (web2py.exe -W)
# it does not load the command line options but it
# expects to find conifguration settings in a file called
#
# web2py/options.py
#
# this file is an example for options.py
import socket
import os
ip ... | ccpgames/eve-metrics | web2py/options.py | Python | mit | 1,058 |
#!/usr/bin/env python
"""
@file visum_parseZaehlstelle.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-11-30
@version $Id: visum_parseZaehlstelle.py 14425 2013-08-16 20:11:47Z behrisch $
This script reads "Zaehlstellen" from a given VISUM-network
and projects them onto a given SUMO-network.
... | cathyyul/sumo-0.18 | tools/import/visum/visum_parseZaehlstelle.py | Python | gpl-3.0 | 1,883 |
#!/usr/bin/env python
#
# Bzip2
#
# Bzip2 packages and versions
#
# Author P G Jones - 2014-08-15 <p.g.jones@qmul.ac.uk> : New file.
####################################################################################################
import nusoft.package.conditional as conditional_package
import os
class Bzip2(condit... | pgjones/nusoft | packages/nusoft/bzip2.py | Python | mit | 2,422 |
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
import json
from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers
from . import models
from pdc.apps.common.serializers import StrictSerializerMixin
class RPMSeria... | maxamillion/product-definition-center | pdc/apps/package/serializers.py | Python | mit | 6,852 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Common codegen classes.
import operator
import os
import re
import string
import textwrap
import functools
from WebI... | karlito40/servo | components/script/dom/bindings/codegen/CodegenRust.py | Python | mpl-2.0 | 231,777 |
# Copyright 2010 by Dana Larose
# This file is part of crashRun.
# crashRun 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.
# crashR... | DanaL/crashRun | src/GamePersistence.py | Python | gpl-3.0 | 5,337 |
"""Run all examples in test area
"""
import os
from aim.interface import run_scenario
scenarios = ['mayon',
'galunggung',
'pinatubo',
'merapi',
'tambora',
'guntur']
for scenario_name in scenarios:
aim = run_sc... | GeoscienceAustralia/PF3D | testing/run_all_examples.py | Python | gpl-3.0 | 439 |
# Various uses of the Notification Originator (TRAP/INFORM)
from pysnmp.entity.rfc3413.oneliner import ntforg
from pysnmp.proto import rfc1902
ntfOrg = ntforg.NotificationOriginator()
# Using
# SNMPv2c
# over IPv4/UDP
# send TRAP notification
# with TRAP ID 'coldStart' specified as a MIB symbol
# ... | xfguo/pysnmp | examples/v3arch/oneliner/agent/ntforg.py | Python | bsd-3-clause | 4,355 |
#!/usr/bin/env python
# encoding: utf-8
"""
Universal Acceptance of TLDs
Copyright (c) 2006 ICANN. All rights reserved.
2005-12-04
v0.4 Kim Davies <kim.davies@icann.org>
2005-10-31
v0.3 Kim Davies <kim.davies@icann.org>
2005-10-28
v0.2 Kim Davies <kim.davies@icann.org>
2006-09-24
v0.1 Kim Davies <kim.... | icann/uniaccept-python | uniaccept/core.py | Python | bsd-3-clause | 4,770 |
import logging
logger = logging.Logger('ppp_datamodel')
| ProjetPP/PPP-datamodel-Python | ppp_datamodel/log.py | Python | agpl-3.0 | 58 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=too-few-public-methods
"""... | mganeva/mantid | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANS/SANSCrop.py | Python | gpl-3.0 | 3,455 |
from pyrake.spider import Spider
class Spider2(Spider):
name = "spider2"
allowed_domains = ["pyrake2.org", "pyrake3.org"]
| elkingtowa/pyrake | tests/test_spidermanager/test_spiders/spider2.py | Python | mit | 131 |
# -*- coding: utf-8 -*-
import json
import logging
from dateutil.relativedelta import relativedelta
from math import exp
from unidecode import unidecode
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.validators import RegexValidator
from django.db import models, transac... | WojtekReu/Politikon | events/models.py | Python | gpl-2.0 | 27,371 |
#!/usr/bin/python
# Copyright 2013 Dick Marinus
#
# 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 agr... | meeuw/condora | condora-script.py | Python | apache-2.0 | 6,083 |
from flask import abort, render_template
from werkzeug.contrib.cache import MemcachedCache
from werkzeug.security import generate_password_hash, check_password_hash
from database import db_session
from models import User
import bbcode
import re
# http://stackoverflow.com/questions/10016499/nginx-with-flask-and-memcac... | michaelgugino/turbo-lister | Objects.py | Python | gpl-3.0 | 6,405 |
import pathlib
import environ
from django.utils.translation import gettext_lazy as _
#########
# PATHS #
#########
BASE_DIR = pathlib.Path(__file__).resolve(strict=True).parent.parent
ROOT_DIR = BASE_DIR.parent
ENV_FILE = ROOT_DIR.joinpath(".env")
###############
# ENVIRONMENT #
###############
env = environ.Env()
... | antonrh/configfactory | configfactory/conf/settings.py | Python | mit | 1,474 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... | zhengwsh/InplusTrader_Linux | rqalpha/core/strategy_universe.py | Python | mit | 1,953 |
# 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/machinelearning/azure-mgmt-guestconfig/azure/mgmt/guestconfig/aio/_guest_configuration_client.py | Python | mit | 5,638 |
answer1 = widget_inputs["check1"]
answer2 = widget_inputs["check2"]
answer3 = widget_inputs["check3"]
answer4 = widget_inputs["check4"]
is_correct = False
comments = []
def commentizer(new):
if new not in comments:
comments.append(new)
if answer1 == True:
is_correct = True
else:
is_correct = is_c... | udacity/responsive-images | grading_scripts/2_5.py | Python | mit | 1,377 |
# -*- coding: utf-8 -*-
__project_name__ = 'IMAPLinkParser'
__project_web__ = 'https://github.com/erdinc-me/IMAPLinkParser'
__file_web__ = 'https://github.com/erdinc-me/IMAPLinkParser/blob/master/IMAPLinkParser.py'
__date__ = '10/13/14'
__author__ = 'Erdinç Yılmaz'
__author_web__ = 'http://erdinc.me'
__author_github__... | erdinc-me/IMAPLinkParser | IMAPLinkParser.py | Python | gpl-3.0 | 19,856 |
import datetime
import logging
import math
from copy import deepcopy
from decimal import Decimal
from botocore.exceptions import NoCredentialsError
from dateutil.parser import parse
from django.core.exceptions import ObjectDoesNotExist
from django.core.files.storage import default_storage
from django.db import transac... | KerkhoffTechnologies/django-connectwise | djconnectwise/sync.py | Python | mit | 109,800 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import platform
import unittest
from nose.plugins.attrib import attr
from conans.client import tools
from conans.client.conf import default_settings_yml
from conans.client.tools.env import environment_append
from conans.errors import ConanException
from conans.model.sett... | memsharded/conan | conans/test/unittests/util/vcvars_arch_test.py | Python | mit | 3,988 |
from __future__ import absolute_import, unicode_literals
from collections import defaultdict
import datetime as dt
from django.views.generic import DetailView, TemplateView, View
from django.template.loader import render_to_string
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers... | wooey/django-djangui | wooey/views/views.py | Python | bsd-3-clause | 9,349 |
#!/usr/bin/python
# vim:et:ts=4
"""
srfsh.py - provides a basic shell for issuing OpenSRF requests
help
- show this menu
math_bench <count>
- runs <count> opensrf.math requests and prints the average time
request <service> <method> [<param1>, <param2>, ...]
- performs an opensrf request
- param... | kbeswick/opensrf | src/python/srfsh.py | Python | gpl-2.0 | 16,816 |
# Copyright (c) 2014 Evalf
#
# 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, s... | CVerhoosel/nutils | nutils/log.py | Python | mit | 4,107 |
#initialized all the data and loads deck from decklist
import sys
import argparse
import sqlite3
import os.path
from game import Game
from script.card import Card
import script
import inspect
from ai.ai import AI
import ai
import time
from debug import Debug
#from script.card import Card
#from script.c1475311 import c1... | Khanguy/ygo-ftk | ftk.py | Python | agpl-3.0 | 4,411 |
# coding=utf-8
import time
class Printer:
"""Basic class for printing messages"""
def __init__(self, debug):
self.debug = debug
def debugPrint(self, string, tipo="DEBUG"):
tipo = tipo[:4] + '.' if len(tipo) > 5 else tipo
if tipo not in "DEBUG" or self.debug:
... | jbonet/TuSubseeker | libs/Printer.py | Python | gpl-3.0 | 686 |
"""subtest URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
C... | Kesel/django | mysite/urls.py | Python | mit | 1,074 |
from __future__ import print_function
from miasm.core.modint import *
a = uint8(0x42)
b = uint8(0xFF)
c = uint8(0x4)
d = uint1(0)
e = uint1(1)
f = uint8(0x1)
g = int8(-3)
print(a, b, c)
print(a + b, a + c, b + c)
print(a == a, a == b, a == 0x42, a == 0x78)
print(a != b, a != a)
print(d, e)
print(d + e, d + d, e + ... | serpilliere/miasm | test/core/modint.py | Python | gpl-2.0 | 1,446 |
# Copyright 2019 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 or a... | tensorflow/tfx | tfx/tools/cli/handler/kubeflow_handler.py | Python | apache-2.0 | 10,861 |
#!/usr/bin/python3
import os
import re
import sys
import osc.babysitter
import osc.commandline
import osc.core
from osc.util.helper import decode_it
try:
from urllib.error import HTTPError
except ImportError:
from urllib2 import HTTPError
try:
from xml.etree import cElementTree as ET
except ImportError:
... | aspiers/automation | jenkins/ci.opensuse.org/openstack-prepare-staging.py | Python | apache-2.0 | 5,166 |
#!/usr/bin/env python
import os
import sys
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
if __name__ == "__main__":
main()
| crgwbr/asymmetric_jwt_auth | sandbox/manage.py | Python | isc | 268 |
#!/usr/bin/env python
""" nav_square.py - Version 1.1 2013-12-20
A basic demo of the using odometry data to move the robot
along a square trajectory.
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2012 Patrick Goebel. All rights reserved.
This program is free software; y... | shevchenco123/28-Mansions | colibri_manctrl/scripts/nav_square.py | Python | apache-2.0 | 6,773 |
from django.db.models import Transform
class Unaccent(Transform):
bilateral = True
lookup_name = 'unaccent'
def as_postgresql(self, compiler, connection):
lhs, params = compiler.compile(self.lhs)
return "UNACCENT(%s)" % lhs, params
| iambibhas/django | django/contrib/postgres/lookups.py | Python | bsd-3-clause | 263 |
# -*- coding: utf-8 -*-
import stock_request
| luoguizhou/gooderp_addons | scm/models/__init__.py | Python | agpl-3.0 | 46 |
from django.db.models import Q, Sum
from django.db.models.deletion import ProtectedError
from django.db.utils import IntegrityError
from django.forms.models import modelform_factory
from django.test import TestCase, skipIfDBFeature
from .models import (
A, Address, B, Board, C, CharLink, Company, Contact, Content,... | baylee/django | tests/generic_relations_regress/tests.py | Python | bsd-3-clause | 11,472 |
import pyblish.api
import ftrack
@pyblish.api.log
class ExtractFtrack(pyblish.api.InstancePlugin):
""" Creating any Asset or AssetVersion in Ftrack.
"""
order = pyblish.api.ExtractorOrder
label = 'Ftrack'
def process(self, instance):
# skipping instance if ftrackData isn't present
... | mkolar/pyblish-ftrack | pyblish_ftrack/plugins/extract_ftrack.py | Python | lgpl-3.0 | 3,872 |
# -*- coding: utf-8 -*-
"""Autoscaling configuration for endpoints."""
from verta._internal_utils import documentation
from ._autoscaling import Autoscaling
documentation.reassign_module(
[Autoscaling],
module_name=__name__,
)
| mitdbg/modeldb | client/verta/verta/endpoint/autoscaling/__init__.py | Python | mit | 239 |
#
# To see the output of this macro, click begin_html <a href="gif/gerrors.gif">here</a>. end_html
#
from ROOT import TCanvas, TGraphErrors
from ROOT import gROOT
from array import array
gROOT.Reset()
c1 = TCanvas( 'c1', 'A Simple Graph with error bars', 200, 10, 700, 500 )
c1.SetFillColor( 42 )
c1.SetGrid()
c1.Ge... | esakellari/my_root_for_test | tutorials/pyroot/gerrors.py | Python | lgpl-2.1 | 876 |
from modularodm import Q
from website.app import init_app
from website.models import Subject, PreprintProvider
def find_child_and_grandchild(grandpa, childIndex=0):
parent = Subject.find(Q('parents', 'eq', grandpa))[childIndex]
try:
child = Subject.find(Q('parents', 'eq', parent))[0]
except IndexE... | hmoco/osf.io | scripts/add_acceptable_subjects_to_provider.py | Python | apache-2.0 | 1,144 |
"""
Utility functions for course_wiki.
"""
from django.core.exceptions import ObjectDoesNotExist
from xmodule import modulestore
import courseware
def user_is_article_course_staff(user, article):
"""
The root of a course wiki is /<course_number>. This means in case there
are two courses which have the sa... | nanolearning/edx-platform | lms/djangoapps/course_wiki/utils.py | Python | agpl-3.0 | 3,481 |
import pytest
from thefuck.rules.rm_root import match, get_new_command
from thefuck.types import Command
def test_match():
assert match(Command('rm -rf /', 'add --no-preserve-root'))
@pytest.mark.parametrize('command', [
Command('ls', 'add --no-preserve-root'),
Command('rm --no-preserve-root /', 'add --... | nvbn/thefuck | tests/rules/test_rm_root.py | Python | mit | 558 |
# Copyright (c) Corporation for National Research Initiatives
import jast
import org, java
from Object import Object, PyObject, Generic
from org.python.parser import ast
def makeAnys(args):
ret = []
for arg in args:
ret.append(arg.asAny())
return ret
def PyObjectArray(args):
... | DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Tools/jythonc/ObjectFactory.py | Python | gpl-3.0 | 11,340 |
from django.contrib import admin
from news.models import News, Event
class NewsAdmin(admin.ModelAdmin):
pass
class EventAdmin(admin.ModelAdmin):
pass
admin.site.register(News, NewsAdmin)
admin.site.register(Event, EventAdmin) | khraneo/newspaper | newspaper/news/admin.py | Python | gpl-3.0 | 239 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from lxml import etree
import requests
class cysf():
def __init__(self):
self.word = ""
self.ciyuan = ""
self.jiyifangfa = ""
def work_spider(self):
url = "http://www.youdict.com/w/"+self.word
header = {'User-Agent': r'Mozill... | skymyyang/YouDaoWord | ciyuan2.py | Python | gpl-2.0 | 2,461 |
#
# Copyright 2015-2017 ASAP
#
# 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 (... | project-asap/telecom-analytics | src/python/workflow/socio_publisher.py | Python | apache-2.0 | 2,405 |
import paho.mqtt.client as mqtt
import RPi.GPIO as GPIO
import time
import serial
from DbUtils import DevConfig
#read the configuration settings from database
config = DevConfig('piArduinoMqtt.py',False)
config.getConfig()
pl = config.configDict["defaultColor"]
pl = pl + "," + config.configDict["timeout"]
... | nakulsolanki/HomeAutomation | python/piArduinoMqtt.py | Python | apache-2.0 | 2,793 |
###########################################################################
#
# Copyright 2020 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
#
# https://www.apache.org/l... | google/starthinker | starthinker/task/traffic/ad.py | Python | apache-2.0 | 23,434 |
import logging
import socket
asyncio_logger = logging.getLogger('asyncio')
asyncio_logger.setLevel(logging.ERROR)
API_address = 'localhost'
API_port = 8888
CONNECTION_args = (API_address, API_port)
SOCKET_FAMILY = socket.AF_INET
SOCKET_TYPE = socket.SOCK_STREAM
SOCKET_args = (SOCKET_FAMILY, SOCKET_TYPE) | austiny88/pyfix | __init__.py | Python | gpl-2.0 | 309 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | djkonro/client-python | kubernetes/test/test_v1_preferred_scheduling_term.py | Python | apache-2.0 | 941 |
"""
Write a program to find the n-th ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ugly numbers.
Note that 1 is typically treated as an ugly number.
"""
class Solution(object):
def nthUglyNum... | yingcuhk/LeetCode | Algorithms/#264 Ugly Number II/PythonCode.py | Python | mit | 1,510 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | autrilla/servo | python/tidy/servo_tidy_tests/test_tidy.py | Python | mpl-2.0 | 4,318 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-14 18:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20170414_1806'),
]
operations = [... | raghuraju/Simple-Project-Management | src/users/migrations/0003_auto_20170414_1807.py | Python | apache-2.0 | 561 |
import os
from ..input_parser.add_database_types import create_type_contents
from ..input_parser.parse_dictionary import parse_dict_file
from ..input_parser.parse_inflections import parse_inflect_file
from ..config import config
def parse_all_inputs(words_dir: str = os.path.expanduser('~/.doll/wordsall'), commit_chan... | badge/doll | doll/input_parser/__init__.py | Python | apache-2.0 | 1,717 |
import unittest
import time
import asyncio
import random
import math
import collections
from .siridb import SiriDB
from .server import Server
from .client import Client
def default_test_setup(nservers=1, **kwargs):
def wrapper(func):
async def wrapped(self):
self.db = SiriDB(**kwargs)
... | transceptor-technology/siridb-server | itest/testing/testbase.py | Python | mit | 5,039 |
"""Client for the Nuxeo REST API."""
import base64
import json
import urllib2
from nxdrive.logging_config import get_logger
log = get_logger(__name__)
class RestAPIClient(object):
"""Client for the Nuxeo REST API."""
application_name = 'Nuxeo Drive'
def __init__(self, server_url, user_id, device_id, ... | loopingz/nuxeo-drive | nuxeo-drive-client/nxdrive/client/rest_api_client.py | Python | lgpl-2.1 | 4,343 |
name = "debinterface"
| nMustaki/debinterface | __init__.py | Python | bsd-3-clause | 22 |
print("Hello World!") # Too many newline characters after this line
| pyta-uoft/pyta | examples/pylint/c0305_trailing_newlines.py | Python | gpl-3.0 | 74 |
from functools import wraps
from flask import make_response, request
from userver.user.models import User
"""
support basic auth
1、email and password
2、auth token(username=auth token, password='')
"""
class HTTPAuth:
def __init__(self):
# def default_get_password(username):
# return None
... | soybean217/lora-python | UServer/http_api_no_auth/http_auth.py | Python | mit | 1,665 |
# -*- coding: utf-8 -*-
u"""setup development directory
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern.pkcollections import PKDict
from pykern.pkdebug import p... | mkeilman/sirepo | sirepo/pkcli/setup_dev.py | Python | apache-2.0 | 1,881 |
import trolley as trolley_objs
from pyticketswitch.util import (
to_float_or_zero, resolve_boolean, dict_ignore_nones,
boolean_to_yes_no
)
from base import Customer
import bundle as bundle_objs
class Reservation(trolley_objs.Trolley):
"""Object that represents a reserved TSW trolley.
In TSW, a reserv... | graingert/pyticketswitch | pyticketswitch/interface_objects/reservation.py | Python | mit | 19,652 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Cisco Systems, 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... | FreescaleSemiconductor/quantum | quantum/plugins/cisco/nexus/cisco_nexus_plugin_v2.py | Python | apache-2.0 | 8,487 |
"""
Assume s is a string of lower case characters.
Write a program that prints the number of times the string 'bob' occurs in s. For example, if s = 'azcbobobegghakl', then your program should print
Number of times bob occurs is: 2
"""
bobCount = 0
for i in range(len(s)+1):
if s[i:i+3] == 'bob':
... | keepokeepo/MITx-6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python | PSET 1/PSET 1 Problem 2.py | Python | mit | 400 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import locale
locale.setlocale(locale.LC_ALL, 'pt_PT.UTF8')
import logging
logging.basicConfig(level=logging.DEBUG)
import os
import string
import datetime
from pprint import pprint
from html2text import add_item
### Constantes ###
MP_STATEMENT = 'deputado_i... | transparenciahackday/dar-scripts | scripts/raspadar/txt2taggedtext.py | Python | gpl-3.0 | 23,048 |
import argparse
import sys
from research.index.common import IndexFactory
parser = argparse.ArgumentParser(description='Flip the most significant bit in every byte of the file.')
parser.add_argument('index', type=str, help='JSON file of the input index')
g = parser.add_mutually_exclusive_group(required=True)
g.add_ar... | west-tandon/ReSearch | bin/findd.py | Python | mit | 1,253 |
#
# $LicenseInfo:firstyear=2010&license=mit$
#
# Copyright (c) 2010, Linden Research, Inc.
#
# 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 limitatio... | lexelby/apiary | historical/timestamp.py | Python | mit | 2,737 |
import sys
import time
import collections
import logging
from spanner.decorators import validate_args
class Timer:
"""
Loop iteration timer. Measures iteration progress and provides estimated
time to completion (assuming uniform loop time)
Usage:
t = Timer(...)
for i in iterable:
...... | dbjohnson/spanner | spanner/countdown.py | Python | mit | 3,594 |
from . import base
from . import combine
from . import dino
from . import geotop
from . import knmi
from . import other
| RoelvandenBerg/groundwater_timenet | groundwater_timenet/parse/__init__.py | Python | gpl-3.0 | 120 |
#!/usr/bin/env python
'''
Unit-tests.
'''
import unittest
import shutil
import sys
import os
from datetime import date
from datetime import timedelta
sys.path.insert(0, os.path.join(os.path.dirname(
os.path.abspath(__file__)), '..'))
import summershum.utils
class UtilsTest(unittest.TestCase):
""" summers... | fedora-infra/summershum | tests/__init__.py | Python | gpl-2.0 | 2,112 |
#!/usr/bin/env python
# Copyright (C) 2017 Marcus Fedarko, Jay Ghurye, Todd Treangen, Mihai Pop
# Authored by Marcus Fedarko
#
# This file is part of MetagenomeScope.
#
# MetagenomeScope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... | fedarko/MetagenomeScope | graph_collator/collate.py | Python | gpl-3.0 | 105,697 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from .widgets import GeopositionWidget
class GeopositionField(forms.MultiValueField):
default_error_messages = {
'invalid': _('Enter a valid geoposition.')
}
def __init__(self, *args, **kwargs):
self.widget =... | coxmediagroup/django-geoposition | geoposition/forms.py | Python | mit | 830 |
"""Test class for Tailoring Files
:Requirement: tailoringfiles
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: SCAPPlugin
:Assignee: jpathan
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from nailgun import entities
from robottelo.datafactory import gen_string
... | SatelliteQE/robottelo | tests/foreman/api/test_oscap_tailoringfiles.py | Python | gpl-3.0 | 1,920 |
import os
from lib.base_plugin import BasePlugin
from lib.paths import SteamGamesPath
class CoD4MWPlugin(BasePlugin):
Name = "Call of Duty 4: Modern Warfare"
support_os = ["Windows"]
def backup(self, _):
_.add_folder('Profiles', os.path.join(SteamGamesPath, 'Call of Duty 4'), 'players')
def ... | Pr0Ger/SGSB | plugins/CoD4_MW.py | Python | mit | 576 |
from django.conf.urls import include, url
from rest_framework import routers
from edctf.api import views
from rest_framework.urlpatterns import format_suffix_patterns
router = routers.DefaultRouter()
urlpatterns = [
url(r'^', include(router.urls)),
url(r'^session/?$', views.session_view.as_view()),
url(r'^ctfs... | IAryan/edCTF | edctf/api/urls.py | Python | apache-2.0 | 994 |
#!/usr/bin/env python
from tools.multiclass_shared import prepare_data
[traindat, label_traindat, testdat, label_testdat] = prepare_data()
parameter_list = [[traindat,testdat,label_traindat,2.1,1,1e-5],[traindat,testdat,label_traindat,2.2,1,1e-5]]
def classifier_multiclassmachine (fm_train_real=traindat,fm_test_real... | lambday/shogun | examples/undocumented/python/classifier_multiclassmachine.py | Python | bsd-3-clause | 1,118 |
# Tests universal newline support for both reading and parsing files.
import io
import _pyio as pyio
import unittest
import os
import sys
from test import support
from test.support import os_helper
if not hasattr(sys.stdin, 'newlines'):
raise unittest.SkipTest(
"This Python does not have universal newline... | brython-dev/brython | www/src/Lib/test/test_univnewlines.py | Python | bsd-3-clause | 3,972 |
# -*- coding: utf-8 -*-
#
# PySPED - Python libraries to deal with Brazil's SPED Project
#
# Copyright (C) 2010-2012
# Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Library General Public Lic... | aricaldeira/PySPED | pysped/nfe/danfe/__init__.py | Python | lgpl-2.1 | 1,944 |
import cv2
import numpy as np
#Function to draw a list of contours onto an image
def drawContoursList(dst, inputList, contourIdx, color, thick):
for i in range(0, len(inputList)):
cv2.drawContours(dst, inputList[i], contourIdx, color, thickness=thick)
def findColorAverage(img, Contours):
#creates an arr... | CarterFendley/2015-vision | scratchpad/drawImage.py | Python | apache-2.0 | 1,437 |
# Copyright (c) 2009, 2010, 2011 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple 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 reta... | js0701/chromium-crosswalk | third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py | Python | bsd-3-clause | 14,748 |
# GBRT for Hjerkinn case study site
# Training data: manually digitized training areas, including water pixels
# Predictors: results of FCLS spectral unmixing
# Authors: Stefan Blumentrath
import numpy as np
import matplotlib.pyplot as plt
from sklearn import ensemble
from sklearn import datasets
from sklearn.utils i... | NINAnor/sentinel4nature | Tree canopy cover/regression/GBRT_Hjerkinn_manual_FCLS.py | Python | gpl-2.0 | 8,852 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-06-25 04:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Course'... | paulopinda/simplemooc | simplemooc/courses/migrations/0001_initial.py | Python | gpl-2.0 | 1,152 |
'''tzinfo timezone information for America/Cancun.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Cancun(DstTzInfo):
'''America/Cancun timezone definition. See datetime.tzinfo for details'''
zone = 'America/Cancun'
... | newvem/pytz | pytz/zoneinfo/America/Cancun.py | Python | mit | 3,964 |
"""
Extensions, integrations, and pymel-dependent tools.
Tool Modules
------------
- `pymel.tools.loggingControl`
- `pymel.tools.mel2py`
- `pymel.tools.py2mel`
- `pymel.tools.envparse`
"""
| AtonLerin/pymel | pymel/tools/__init__.py | Python | bsd-3-clause | 200 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010, 2degrees Limited <egoddard@tech.2degreesnetwork.com>.
# All Rights Reserved.
#
# This file is part of djangoaudit <https://launchpad.net/django-audit/>,
# which is subject to the provisions of ... | rdkls/django-audit-mongodb | tests/test_models.py | Python | bsd-3-clause | 25,093 |
"""
WSGI config for metuly project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "metuly.settings")
from django.core.wsg... | kamyarg/enfame | metuly/wsgi.py | Python | gpl-2.0 | 387 |
#!/usr/bin/env python3
"""
Script to generate entrez gene IDs from HGNC gene symbols in the format
NCBIGene:1234
Queries mygene and monarch and joins the results, noting conflicts
likely from dupe/ambiguous ids in both dbs
"""
import mygene
import argparse
import requests
import time
MONARCH_URL = 'https://beta.mon... | TomConlin/dipper | scripts/fetch-gene-ids.py | Python | bsd-3-clause | 2,607 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of my-weather-indicator
#
# Copyright (c) 2012 Lorenzo Carbonell Cerezo <a.k.a. atareao>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... | atareao/my-weather-indicator | src/graph.py | Python | mit | 4,558 |
from nav.connection import Connection
from nav.element import Element
from util.priorityqueue import PriorityQueue
class PathNode(object):
__slots__ = (
'parent',
'parent_connection',
'area',
'move_cost',
'heuristic_cost',
'total_cost'
)
... | GitExl/DoomPath | src/navedit/pathfind.py | Python | bsd-2-clause | 6,869 |
import os
import cat_service
import platform
import subprocess
def main():
print_header()
folder = get_or_create_output_folder()
print('Found or created folder: {}'.format(folder))
download_cats(folder)
display_cats(folder)
def print_header():
print('-----------------------------------------... | derrickyoo/python-jumpstart | apps/06_cat_factory/program.py | Python | mit | 1,480 |
#!/usr/bin/env python
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from... | kk9599/osquery | tools/tests/test_osqueryd.py | Python | bsd-3-clause | 2,187 |
# -*- coding: utf-8 -*-
# Automatic provisioning of AWS VPC NAT gateways.
import uuid
import time
import boto3
import botocore
import nixops.util
import nixops.resources
from nixops.resources.ec2_common import EC2CommonState
import nixops.ec2_utils
from nixops.diff import Diff, Handler
from nixops.state import Stat... | AmineChikhaoui/nixops | nixops/resources/vpc_nat_gateway.py | Python | lgpl-3.0 | 6,209 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Deepin, Inc.
# 2011 Wang Yong
# 2012 Reza Faiz A
#
# Author: Wang Yong <lazycat.manatee@gmail.com>
# Maintainer: Wang Yong <lazycat.manatee@gmail.com>
# Reza Faiz A <ylpmiskrad@gmail.com>
# Remixed : Reza Faiz A <ylpmi... | Zulfikarlatief/tealinux-software-center | src/constant.py | Python | gpl-3.0 | 5,219 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Copyright (c) 2016, Kersten Doering <kersten.doering@gmail.com>
This script reads the Lucene index "lucene_index.Index". It builds one query over Title and Abstract field with "OR" and one query with "AND".
"""
# lucene modules needed for this scriptimport luc... | telukir/PubMed2Go | PyLucene/search.py | Python | isc | 1,998 |
# -*- coding: utf-8 -*-
"""converter.py
Does the meat of the file conversion for icw.
"""
from __future__ import unicode_literals
from datetime import datetime, timedelta
from icalendar import Calendar, Event, LocalTimezone
from icw import app
import csv
import uuid
import codecs
from collections import Counter
import... | n8henrie/icw | icw/converter.py | Python | gpl-3.0 | 9,921 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.