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 |
|---|---|---|---|---|---|
# -*- encoding: utf-8 -*-
"""
This class has been adapted from Twython. Thanks to Erik Scheffers.
"""
import urllib
import urlparse
import inspect
import oauth2 as oauth
from settings import REQUEST_TOKEN_URL
from settings import ACCESS_TOKEN_URL
from settings import AUTHORIZE_URL
from settings import AUTHENTICATE_... | ahmontero/django-twitter | twitter/toauth.py | Python | mit | 4,149 |
"""Tests for certbot.configuration."""
import os
import unittest
import mock
from certbot import errors
class NamespaceConfigTest(unittest.TestCase):
"""Tests for certbot.configuration.NamespaceConfig."""
def setUp(self):
self.namespace = mock.MagicMock(
config_dir='/tmp/config', work_d... | nohona/cron-crm | usr/local/certbot/certbot/tests/configuration_test.py | Python | gpl-3.0 | 5,331 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# no... | nuagenetworks/monolithe | monolithe/generators/managers/vanillamanager.py | Python | bsd-3-clause | 2,093 |
from django.template import Context
from django.template.loader import get_template
def get_header_navbar(acc_type, name, title):
header = get_template("header.html").render(
Context( {
'type': acc_type,
'name': name,
'title': title,
'loggedIn':True } ))
navbar = get_template("navbar... | varun-verma11/CodeDrill | djangoSRV/Views/utils.py | Python | bsd-2-clause | 586 |
# Copyright 2013 Rackspace Hosting
# 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 require... | saeki-masaki/glance | glance/tests/integration/v2/test_tasks_api.py | Python | apache-2.0 | 19,998 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:[email protected]
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | dbbhattacharya/kitsune | vendor/packages/logilab-common/tasksqueue.py | Python | bsd-3-clause | 2,818 |
# -*- coding: utf-8 -*-
# YAFF is yet another force-field code.
# Copyright (C) 2011 Toon Verstraelen <[email protected]>,
# Louis Vanduyfhuys <[email protected]>, Center for Molecular Modeling
# (CMM), Ghent University, Ghent, Belgium; all rights reserved unless otherwise
# stated.
#
# This file is pa... | molmod/yaff | yaff/analysis/test/test_blav.py | Python | gpl-3.0 | 1,509 |
#
# rtlsdr_scan
#
# http://eartoearoak.com/software/rtlsdr-scanner
#
# Copyright 2012 - 2015 Al Brown
#
# A frequency scanning GUI for the OsmoSDR rtl-sdr library at
# http://sdr.osmocom.org/trac/wiki/rtl-sdr
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | EarToEarOak/RTLSDR-Scanner | rtlsdr_scanner/panels.py | Python | gpl-3.0 | 39,759 |
import re
string1 = "1C|2C++|3Java|4C#|5Python|6JavaScript"
string2 = "100000001"
string3 = "AC35B9V2L$40K43ll6af52hf7r"
string4 = "life is short, i use python, i love python"
# match,match尝试在字符串的首字母开始匹配,如果首字母没有匹配到,则返回None,匹配第一个
print(re.match("...", string1))
print(re.match("...", string1).group(0))
print(re.match("... | Ztiany/CodeRepository | Python/Python3-Base/08_Regular/Match.py | Python | apache-2.0 | 572 |
from lms.envs.devstack_with_worker import *
| Stanford-Online/edx-platform | openedx/stanford/lms/envs/devstack_with_worker.py | Python | agpl-3.0 | 44 |
# Copyright 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 to in writ... | openstack/solum | solum/tests/api/test_auth.py | Python | apache-2.0 | 3,629 |
import warnings
from wtforms import form
from wtforms.ext.i18n.utils import get_translations
translations_cache = {}
class Form(form.Form):
"""
Base form for a simple localized WTForms form.
**NOTE** this class is now un-necessary as the i18n features have
been moved into the core of WTForms, and wi... | Lessig2016/teams | wtforms/ext/i18n/form.py | Python | agpl-3.0 | 1,560 |
# -*- coding: utf-8 -*-
import os
import collections
from six.moves import cPickle
import numpy as np
import re
import itertools
class TextLoader():
def __init__(self, data_dir, batch_size, seq_length):
self.data_dir = data_dir
self.batch_size = batch_size
self.seq_length = seq_length
... | bahmanh/word-rnn-tensorflow | utils.py | Python | mit | 4,469 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2017-8-30
@author: generated by @lolobosse script
'''
LOCALE = [
["μόλις τώρα", "σε λίγο"],
["%s δευτερόλεπτα πριν", "σε %s δευτερόλεπτα"],
["1 λεπτό πριν", "σε 1 λεπτό"],
["%s λεπτά πριν", "σε %s λεπτά"],
["1 ώρα πριν", "σε 1 ώρα"],
... | Vagab0nd/SiCKRAGE | lib3/timeago/locales/el.py | Python | gpl-3.0 | 912 |
#coding=utf-8
#并没有redis所以我只是抄官网的示例代码
import os,re,redis
path = os.path.split(os.path.realpath(__file__))[0]+"/"
f = open(path+"code.txt","r")
A = f.read()
arr = re.split("\s+",A)
r = redis.Redis(host='localhost', port=6379, db=0)
for i in range(len(arr)):
if i:
r.set(str(i),arr[i])
r.save() | luoxufeiyan/python | NKUCodingCat/0003/0003.py | Python | mit | 326 |
# -*- coding: utf-8 -*-
#
# fgmm documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 1 16:26:50 2010.
#
# 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 co... | flo-dhalluin/fgmm | docsrc/conf.py | Python | lgpl-3.0 | 7,192 |
import random
from compositecore import Leaf
import spawner
from messenger import msg
class RemoveEntityOnDeath(Leaf):
"""
Will remove the parent from the dungeon when parent Entity dies.
"""
def __init__(self):
super(RemoveEntityOnDeath, self).__init__()
self.component_type = "remove_... | co/TheLastRogue | ondeath.py | Python | bsd-2-clause | 1,983 |
#!/usr/bin/env python
import math
## functions ##
## classes ##
class GenomicDirections():
''' Class to represent genomic directions
'''
UPSTREAM="upstream"
DOWNSTREAM="downstream"
class ModBlatHit(object):
''' Class for the modified blat/psl format alignment hit (cf. QT).
Argument: St... | jos4uke/getSeqFlankBlatHit | getSeqFlankBlatHitLib.py | Python | gpl-2.0 | 5,395 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the VFS data stream interface."""
import unittest
from dfvfs.vfs import data_stream
from tests import test_lib as shared_test_lib
class DataStreamTest(shared_test_lib.BaseTestCase):
"""Tests the VFS data stream interface."""
def testName(self):
""... | joachimmetz/dfvfs | tests/vfs/data_stream.py | Python | apache-2.0 | 883 |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 09 14:51:02 2015
@author: Methinee
"""
import pandas as pd
import numpy as np
from collections import defaultdict
from astropy.table import Table, Column
df = pd.read_csv('../data/CS_table_No2_No4_new.csv',delimiter=";", skip_blank_lines = True,
error_... | wasit7/book_pae | pae/forcast/src/csv/CS_table_No2_No4.py | Python | mit | 1,865 |
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# 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 li... | faarwa/EngSocP5 | zxing/cpp/scons/scons-local-2.0.0.final.0/SCons/Options/ListOption.py | Python | gpl-3.0 | 2,001 |
from . import paste
from . import detach
| uclouvain/OSIS-Louvain | program_management/forms/tree/__init__.py | Python | agpl-3.0 | 41 |
'''
Created on Dec 13, 2015
@author: Shannon Litwin
'''
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.PWM as PWM
import Lib_LCD as LCD
import Lib_Main as BBB
import sys
import signal
import time
leftForward = "P8_46"
leftBackward = "P8_45"
rightForward = "P9_14"
rightBackward = "P9_16"
def Control_C_Exit(si... | ValRose/Rose_Bone | PythonLibraries/lcd_demo.py | Python | mit | 1,617 |
from . import AbstractEngine
class HybridEngine(AbstractEngine):
def __init__(self, name, taxonomy, components, settings = {}):
super(HybridEngine, self).__init__(name, taxonomy, settings)
self.components = components
def get_components(self):
return self.components
def recommend(... | halk/recowise | core/engine/hybrid.py | Python | mit | 417 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
Robustness check for Agent-Based Models
(conceivably other models as well)
across the whole of the multidimensional
parameter space.
Author: Pawel Fiedor ([email protected])
Co-Pierre Georg ([email protected])
Version: 0.2
Date of last update: 19-11-2015 (C... | cogeorg/BlackRhino | examples/withclearing/abm_template/calc_goodness.py | Python | gpl-3.0 | 595 |
class CyCyError(Exception):
"""
Base class for non-runtime internal errors.
"""
def rstr(self):
name = self.__class__.__name__
return "%s\n%s\n\n%s" % (name, "-" * len(name), self.__str__())
| Magnetic/cycy | cycy/exceptions.py | Python | mit | 225 |
#!/usr/bin/env python3
import torch
from .. import settings
def lanczos_tridiag(
matmul_closure,
max_iter,
dtype,
device,
matrix_shape,
batch_shape=torch.Size(),
init_vecs=None,
num_init_vecs=1,
tol=1e-5,
):
"""
"""
# Determine batch mode
multiple_init_vecs = Fals... | jrg365/gpytorch | gpytorch/utils/lanczos.py | Python | mit | 6,520 |
#!/usr/bin/env python
'Conjugate-gradient method'
## Copyright (C) 2008 University of Texas at Austin
##
## 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 2 of the Lic... | TobbeTripitaka/src | user/fomels/shaping.py | Python | gpl-2.0 | 2,149 |
__all__ = ["orderly","combin","graph","draw"]
| rmanders/unlabeled-graphical-enumeration | graphs/__init__.py | Python | mit | 46 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Belgium - Accounting',
'version': '1.1',
'category': 'Localization/Account Charts',
'description': """
This is the base module to manage the accounting chart for Belgium in OpenERP.
===========... | minhphung171093/GreenERP | openerp/addons/l10n_be/__openerp__.py | Python | gpl-3.0 | 2,511 |
from . import base
class TestTlsHttpClientWithProxy(base.TestHttpClient):
with_proxy = True
with_tls = True
| ymero/pulsar | tests/http/tunnel.py | Python | bsd-3-clause | 118 |
# 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 agreed to in writing, ... | google/gazoo-device | gazoo_device/tests/functional_tests/comm_power_test_suite.py | Python | apache-2.0 | 3,518 |
from sample_code_file_maps import *
from jinja2 import Environment, FileSystemLoader
regiones = [
','.join(['chr15', str(48791193-3000), str(48791193+3000)]),
','.join(['chr2', str(21231387-3000), str(21231387+3000)]),
','.join(['chr2', str(21233999-3000), str(21233999+3000)]),
]
env = Environment(loade... | CSB-IG/non-coding-NGS | igv_snapshots/genera_scripts.py | Python | gpl-3.0 | 877 |
"""
Copyright 2013 Steven Diamond
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... | SteveDiamond/cvxpy | cvxpy/settings.py | Python | gpl-3.0 | 3,552 |
# -*- coding: utf-8 -*-
import functools
import httplib as http
from furl import furl
from flask import request
from framework import status
from framework.auth import Auth, cas
from framework.flask import redirect # VOL-aware redirect
from framework.exceptions import HTTPError
from framework.auth.decorators import ... | TomBaxter/osf.io | website/project/decorators.py | Python | apache-2.0 | 13,204 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = """
---
module: kube
short_description: Manage Kubernetes Cluster
description:
- Create, replace, remove, and stop resources within a Kubernetes Cluster
version_added: "2.0"
options:
name:
required: false
default: null
description:
- The n... | insequent/kargo | library/kube.py | Python | apache-2.0 | 8,694 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Vauxoo C.A. (http://openerp.com.ve/) All Rights Reserved.
# Javier Duran <[email protected]>
#
#
# WARNING: This program as such is intended to be used by professional
# pr... | 3dfxsoftware/cbss-addons | report_profit/report/__init__.py | Python | gpl-2.0 | 1,424 |
# 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/logic/azure-mgmt-logic/azure/mgmt/logic/operations/_workflow_run_actions_operations.py | Python | mit | 13,765 |
"""Constants for the Minecraft Server integration."""
ATTR_PLAYERS_LIST = "players_list"
DEFAULT_HOST = "localhost"
DEFAULT_NAME = "Minecraft Server"
DEFAULT_PORT = 25565
DOMAIN = "minecraft_server"
ICON_LATENCY_TIME = "mdi:signal"
ICON_PLAYERS_MAX = "mdi:account-multiple"
ICON_PLAYERS_ONLINE = "mdi:account-multipl... | postlund/home-assistant | homeassistant/components/minecraft_server/const.py | Python | apache-2.0 | 863 |
"""
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
import pytest
from byceps.services.user import command_service as user_command_service
from byceps.services.user import event_service
from byceps.services.user import service as user_service
@pytest.fixture(sco... | homeworkprod/byceps | tests/integration/services/user/test_suspend_unsuspend.py | Python | bsd-3-clause | 2,416 |
""" EC2Endpoint class is the implementation of the EC2 interface to
a cloud endpoint
"""
import os
import json
import boto3
from DIRAC import gLogger, S_OK, S_ERROR
from DIRAC.Core.Utilities.File import makeGuid
from VMDIRAC.Resources.Cloud.Endpoint import Endpoint
__RCSID__ = '$Id$'
class EC2Endpoint( Endpoin... | xianghuzhao/VMDIRAC | VMDIRAC/Resources/Cloud/EC2Endpoint.py | Python | gpl-3.0 | 6,505 |
#!/usr/bin/python
# $Id$
# vim:ft=python:sw=4:sta:et
#
# test_cronwatch.py - Unit tests for cronwatch
# Copyright (C) 2011 David Lowry < wdlowry at gmail dot com >
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free... | wdlowry/cronwatch | test_cronwatch.py | Python | gpl-3.0 | 29,395 |
class Manipulator(object):
KINDS=()
SEPERATOR="$"
def __call__(self, txt, **kwargs):
data = {}
splitted = txt.split("$")
for kind, part in zip(self.KINDS, splitted):
data[kind]=part
for info, new_value in kwargs.items():
kind, position = info.r... | jedie/django-secure-js-login | tests/test_utils/manipulators.py | Python | gpl-3.0 | 1,102 |
# telemetry.py listens for psas packets and sends them to the front-end.
# Copyright (c) 2017 Jeff Patterson, Amanda Murphy, Paolo Villanueva,
# Patrick Overton, Connor Picken, Yun Cong Chen, Seth Amundsen, Michael
# Ohl, Matthew Tighe
# ALL RIGHTS RESERVED
# [This program is licensed under the "GNU General Public Lice... | patter5/rv3k | back-end/telemetry.py | Python | gpl-2.0 | 5,743 |
class IncorrectEmailException(Exception):
def __init__(self):
message = """Incorrect email address encountered, expected
something like [email protected]"""
super(IncorrectEmailException, self).__init__(message)
| dhruvagarwal/termailer | exceptions.py | Python | mit | 253 |
from django.apps import AppConfig
class $fileinputname$Config(AppConfig):
name = '$fileinputname$'
| DinoV/PTVS | Python/Templates/Django/ItemTemplates/Python/DjangoNewAppFiles19/apps.py | Python | apache-2.0 | 105 |
#!/usr/bin/env python
from matplotlib import pyplot, rc
import itertools
def figureItOut(x_lists, y_lists, axis_bounds):
colors = 'kbrg'
shapes = ['', '*', 'o', 's']
lines = [':', '-', '-', '-']
labels = ['Random Actions',
'Learning with 360$^\circ$ Sensor FoV',
'Learning... | MatthewRueben/multiple-explorers | scripts/test/figure_template.py | Python | mit | 1,391 |
# vim:fileencoding=utf-8:noet
from __future__ import division
from powerline.lib import mergedicts, add_divider_highlight_group, REMOVE_THIS_KEY
from powerline.lib.humanize_bytes import humanize_bytes
from powerline.lib.vcs import guess, get_fallback_create_watcher
from powerline.lib.threaded import ThreadedSegment, K... | wezhang/vim-setup | bundle/powerline/tests/test_lib.py | Python | apache-2.0 | 21,628 |
from __future__ import absolute_import
from traits.testing.unittest_tools import UnittestTools, unittest
from ...image_cache import ImageCache
from ...window import Window
from ..action import Action
from ..action_controller import ActionController
from ..action_item import ActionItem
from ..menu_manager import MenuM... | brett-patterson/pyface | pyface/action/tests/test_action_item.py | Python | bsd-3-clause | 5,556 |
if __name__ == "__main__":
n = int(input())
set_A = set(list(input().split()))
m = int(input())
set_B = set(list(input().split()))
a_minus_b = set_A.difference(set_B)
b_minus_a = set_B.difference(set_A)
diff = a_minus_b.union(b_minus_a)
arr = list(map(int, diff))
arr.sort()
... | MithileshCParab/HackerRank-10DaysOfStatistics | Python/Sets/symmetric_difference.py | Python | apache-2.0 | 357 |
# coding=utf-8
"""QGIS plugin implementation.
.. 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; either version 2 of the License, or
(at your option) any later version.
.. note... | gltn/stdm | stdm/tests/qgis_interface.py | Python | gpl-2.0 | 7,490 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wagtail.core.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0053_auto_20150903_1738'),
]
operations = [
migrations.AddField(
model_na... | OpenCanada/website | articles/migrations/0054_seriespage_short_description.py | Python | mit | 469 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | qiime2-plugins/normalize | q2_feature_table/_version.py | Python | bsd-3-clause | 18,470 |
import numpy as np
import pytest
import pandas as pd
import pandas.util.testing as tm
@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
@pytest.mark.filterwarnings("ignore:DataFrame.to_sparse:FutureWarning")
class TestSparseGroupBy:
def setup_method(self, method):
self.dense = pd.DataFrame(
... | toobaz/pandas | pandas/tests/sparse/test_groupby.py | Python | bsd-3-clause | 2,770 |
import sys, os
sys.path.insert(0, os.path.join(os.path.split(__file__)[0], '../'))
import os
from Bio import Entrez
import nesoni
from nesoni import config, io
# ref.: http://wilke.openwetware.org/Parsing_Genbank_files_with_Biopython.html
# replace with your real email (optional):
#Entrez.email = '[email protected]... | Victorian-Bioinformatics-Consortium/nesoni | test/test_analyse_samples.py | Python | gpl-2.0 | 3,409 |
"""
converter file Handler
In goes a file, out comes a string.
If no convertion is present for filetype:
then return statement of filetype
"""
import textract
import tempfile
import os
import urllib2
class FileConverter:
valid = False
txt = ""
def __init__(self, url):
valid_types = ['doc','txt','docx','p... | turtlekingster/ScubaWeb | scrapewriter/converters.py | Python | mit | 737 |
"""
Forms for the bug tracker app.
"""
from django import forms
from django.utils.translation import ugettext_lazy as _
from apps.txtrender.forms import MarkupCharField
from apps.contentreport.forms import ContentReportCreationForm
from apps.tools.http_utils import get_client_ip_address
from .models import (IssueTic... | TamiaLab/carnetdumaker | apps/bugtracker/forms.py | Python | agpl-3.0 | 4,597 |
from construct import *
class InterfaceCounters(object):
def __init__(self, u):
self.if_index = u.unpack_uint()
self.if_type = u.unpack_uint()
self.if_speed = u.unpack_uhyper()
self.if_mode = u.unpack_uint()
self.if_status = u.unpack_uint()
self.if_inOctets = u.unp... | calston/tensor | tensor/protocol/sflow/protocol/counters.py | Python | mit | 9,132 |
try:
from . import generalIO
except ImportError:
import generalIO
import czifile
def _eval(txt):
try:
return eval(txt)
except (NameError, TypeError, SyntaxError):
return txt
class CZIReader(generalIO.GeneralReader):
def __init__(self, fn):
"""
fn: file name
... | macronucleus/chromagnon | Chromagnon/imgio/cziIO.py | Python | mit | 1,890 |
import calendar
import json
import re
import unicodedata
from datetime import datetime, time, timedelta
from enum import Enum
from uuid import UUID
import iso639
import pytz
from dateutil.relativedelta import relativedelta
from temba_client.utils import format_iso8601
from django.utils import timezone
from django.uti... | rapidpro/casepro | casepro/utils/__init__.py | Python | bsd-3-clause | 5,702 |
# -*- coding: utf-8 -*-
#/******************************************************************************
# * Copyright (c) 2012 Jan Rheinländer <[email protected]> *
# * *
# * This file is part of the FreeCAD CAx developmen... | sanguinariojoe/FreeCAD | src/Mod/PartDesign/WizardShaft/Shaft.py | Python | lgpl-2.1 | 32,813 |
from markdown import Extension
from markdown.util import etree
from markdown.inlinepatterns import Pattern
RE = r'\[code\](.*?)\[\/code\]'
class MultilineCodeExtension(Extension):
def extendMarkdown(self, md, md_globals):
element = NestedElements(RE)
md.inlinePatterns.add('pre', element, '<not_st... | nuke2015/python_blog | models/mdx_code_multiline.py | Python | mit | 611 |
import _plotly_utils.basevalidators
class LenmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="lenmode", parent_name="histogram.marker.colorbar", **kwargs
):
super(LenmodeValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/histogram/marker/colorbar/_lenmode.py | Python | mit | 547 |
'''
The Common subpackage is of primary interest to all
ALMA developers wishing to use Python. The modules here
are of common use to everyone. A few brief descriptions
on the modules follow:
- Callbacks contains complete BACI callback implementations. This
functionality has not been provided in Java or C++.
- CDBAcce... | ACS-Community/ACS | LGPL/CommonSoftware/acspycommon/src/Acspy/Common/__init__.py | Python | lgpl-2.1 | 1,144 |
# To be deprecated!!!
from legacy import *
| aksalj/whiskerboard | board/api/__init__.py | Python | mit | 44 |
# 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/op/vision/_yolo.py | Python | apache-2.0 | 1,131 |
import _plotly_utils.basevalidators
class ColoraxisValidator(_plotly_utils.basevalidators.SubplotidValidator):
def __init__(
self, plotly_name="coloraxis", parent_name="scatter3d.marker.line", **kwargs
):
super(ColoraxisValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scatter3d/marker/line/_coloraxis.py | Python | mit | 597 |
print "In distro.py"
if not sysconf.getReadOnly():
if not sysconf.has("rpm-root"):
sysconf.set("rpm-root", "/opt/redhat/rpm/solaris/")
if not sysconf.has("channels"):
sysconf.set(("channels", "myrpm-db"),
{"alias": "myrpm-db",
"type": "rpm-sys",
... | dmacvicar/spacewalk | client/solaris/smartpm/contrib/solaris/distro-rpm.py | Python | gpl-2.0 | 854 |
# getdents syscall
def generate(in_fd):
"""getdents - lists specific directory in thumb mode
Args:
in_fd - (int/str/reg): in file descriptor
"""
sc = ''
try:
xin_fd = int(in_fd)
sc += 'mov r0, #%s' % (xin_fd)
except:
sc += 'mov r0, %s' % (in_fd)
sc += ""... | sigma-random/ARMSCGen | shellcodes/thumb/getdents.py | Python | gpl-2.0 | 403 |
#
# Copyright 2013 Y12Studio
#
# 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, ... | y12studio/pi | testonly/halfsync/m_settings.py | Python | apache-2.0 | 759 |
#!/bin/python3
import random
def getRandom():
# return a random int between 0 and 10
return random.randint(0, 10)
def askQuestion(a, b):
# get user input, answer to the math question
userResponse = int(input("What is {} - {}: ".format(a, b)))
result = a - b
# compare if user input is the same ... | elakamarcus/python | simple_mathgame_01.py | Python | gpl-3.0 | 1,093 |
import unittest
import doctest
__author__ = 'David Hain'
__copyright__ = '2007-2008 ' + __author__
__license__ = 'MIT'
def mod_import(name):
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
modules = (
'webskewer.serve'... | dhain/webskewer | webskewer.serve/tests/testall.py | Python | mit | 986 |
from nes.bus import BusDevice
from nes.processors.registers import Register
from .apu import Sq1Hi, Sq1Lo, Sq1Sweep, Sq1Vol, Sq2Hi, Sq2Lo, Sq2Sweep, Sq2Vol, TriLinear, TriHi, TriLo, NoiseHi, NoiseLo, NoiseVol, DmcRaw, DmcFreq, DmcStart, DmcLen, SndChn
from .joy import Joy1, Joy2
class ApuIoRegisterSet(BusDevice):
... | Hexadorsimal/pynes | nes/bus/devices/apu_io_register_set.py | Python | mit | 1,376 |
from nose.core import collector, main, run, run_exit, runmodule
# backwards compatibility
from nose.exc import SkipTest, DeprecatedTest
from nose.tools import with_setup
__author__ = 'Jason Pellerin'
__versioninfo__ = (1, 0, 0)
__version__ = '.'.join(map(str, __versioninfo__))
__all__ = [
'main', 'run', 'run_exit... | RalphBariz/RalphsDotNet | Old/RalphsDotNet.Apps.OptimizationStudio/Resources/PyLib/nose/__init__.py | Python | gpl-3.0 | 404 |
from flask_restful import Resource, reqparse
import json
import next.utils
import next.broker.broker
import next.api.api_util as api_util
from next.api.api_util import *
from next.api.api_util import APIArgument
from next.api.resource_manager import ResourceManager
resource_manager = ResourceManager()
broker = next.... | nextml/NEXT | next/api/app_handler.py | Python | apache-2.0 | 2,165 |
import os
class pathNavigator(object):
def __pytermconfig__(self):
return {"command":"cd","callback":self.cd}
def cd(self,*args, **kwargs):
pyTerm = kwargs["pyTerm"]
try:
sequence = kwargs["sequence"][0]
except IndexError:
sequence = ""
if sequence == "..": # upward
currentPath = pyTerm.getPath... | jeffersonmourak/pyTerm | plugins/pathNavigator.py | Python | mit | 758 |
import re
from unittest import mock
from dila.application import structures
from dila.frontend.flask import user_tools
def test_login_form(flask_client):
response = flask_client.get('/login/')
assert re.search('<input class="[^"]*" id="username" name="username" type="text" value="">',
re... | socialwifi/dila | tests/test_authentication_views.py | Python | bsd-3-clause | 2,165 |
from django.contrib import admin
from announcements.models import Announcement, Dismissal
# import our user model and determine the field we will use to search by user
# support custom user models & username fields in django 1.5+
try:
from django.contrib.auth import get_user_model
except ImportError:
from dja... | state-hiu/geonode-announcements | announcements/admin.py | Python | mit | 1,380 |
# Copyright 2016 Pinterest, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | lilida/teletraan | deploy-board/deploy_board/webapp/error_views.py | Python | apache-2.0 | 2,210 |
#!/usr/bin/env python3
# Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import os
import sys
import platform
from UM.Platform import Platform
#WORKAROUND: GITHUB-88 GITHUB-385 GITHUB-612
if Platform.isLinux(): # Needed for platform.linux_distribution, which is not avail... | hmflash/Cura | cura_app.py | Python | agpl-3.0 | 3,280 |
"""Some common helper functions."""
import sys
import inspect
def _flush():
sys.stderr.flush()
sys.stdout.flush()
def log(msg, *args):
"""Log to stderr with optional formatting."""
if args:
msg = msg % args
pre = inspect.getfile(sys._getframe(1)) + ": "
sys.stderr.write(pre + msg + ... | CraigKelly/ted-youtube-data | common.py | Python | mit | 339 |
# coding: utf-8
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from archer.views import *
# 这里报红因为没用到 原因就是我们在下面使用了更加面向对象的方法去导入每个应用 app 的后台逻辑
from books import views as books_views
from contact import views as contact_views
# 这里在 index 页面增加 feeds
... | L-Jovi/pra_django | archer/urls.py | Python | gpl-2.0 | 2,644 |
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
count = 0
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imwrite("frame%d.jpg" % count, frame)
count += 1
# Display the result... | MiracleAlga/satpam | source/fragmented.py | Python | mit | 500 |
import process_data
data_folder = '../data/state_data_imports_4d_NAICS/'
output_folder = '../output/state_data_imports_4d_NAICS/'
date = '0902'
process_data.process_ISTNAICS(data_folder, output_folder, date)
print 'task completed'
| YangLiu928/NDP_Projects | Python_Projects/Python_MySQL/Foreign_Trade_Data_Pipe_Delimination/scripts/state_data_imports_4d_NAICS.py | Python | mit | 236 |
# coding: utf-8
"""
Generated by: https://openapi-generator.tech
"""
from dataclasses import dataclass
import re # noqa: F401
import sys # noqa: F401
import typing
import urllib3
from urllib3._collections import HTTPHeaderDict
from openapi_client import api_client, exceptions
import decimal # noqa: F401
fro... | cliffano/swaggy-jenkins | clients/python-experimental/generated/openapi_client/api/blue_ocean_api_endpoints/post_pipeline_runs.py | Python | mit | 5,478 |
import random
from entities import Entity
_player = None
def initPlayer(name):
global _player
if not _player:
_player = Player(name)
def getPlayPos():
global _player
if _player:
return _player.position
def d6(n):
suma = 0
for i in range(n):
suma += random.randint(1... | TheAwesomeTool/Delve | engine/Player.py | Python | gpl-2.0 | 2,089 |
from conans.model import Generator
class MakeGenerator(Generator):
def __init__(self, conanfile):
Generator.__init__(self, conanfile)
self.makefile_newline = "\n"
self.makefile_line_continuation = " \\\n"
self.assignment_if_absent = " ?= "
self.assignment_append = " += "
... | conan-io/conan | conans/client/generators/make.py | Python | mit | 3,777 |
__author__ = '1'
from model.group import Group
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:],"n:f:",["number of groups","file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "data/groups.json"
... | liliasapurina/python_training | generator/group.py | Python | apache-2.0 | 1,010 |
import os
import time
ret = os.fork()
if ret==0:
while True:
print("----1---")
time.sleep(1)
else:
while True:
print("----2---")
time.sleep(1)
| jameswatt2008/jameswatt2008.github.io | python/Python核心编程/系统编程/截图和代码/系统编程1/02-fork.py | Python | gpl-2.0 | 189 |
#!/usr/bin/env python
import datetime
import serial
import time
from multiprocessing import Process
from rebooter import reboot
class P1:
FAIL_THRESHOLD = 100
ELECTRICITY_1_WITHDRAWAL_CUMULATIVE = '1.8.1'
ELECTRICITY_2_WITHDRAWAL_CUMULATIVE = '1.8.2'
ELECTRICITY_1_SUPPLY_CUMULATIVE = '2.8.1'
ELE... | hongaar/meterkast | components/continuousP1.py | Python | mit | 4,600 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import throw, _
import frappe.defaults
from frappe.utils import cint, flt, get_fullname, cstr
from frappe.contacts.doctype.add... | saurabh6790/erpnext | erpnext/shopping_cart/cart.py | Python | gpl-3.0 | 18,152 |
#!/usr/bin/env python
"""
Tests for the singleton scope.py
"""
from snakeguice import inject, scopes, Injector, annotate
import cls_heirarchy as ch
class TestSingletonScope(object):
class DomainObject(object):
@inject(logger_a=ch.Logger, logger_b=ch.Logger, logger_c=ch.Logger)
def set_loggers... | dstanek/snake-guice | tests/test_singletons.py | Python | mit | 2,988 |
# -*- coding: utf-8 -*-
"""
@created: Thu Jul 02 10:56:57 2015
Usage:
main.py
Options:
-h --help # Show this screen.
--version # Show version.
"""
### Imports
# Standard Library
from __future__ import print_function, division
from __future__ import absolute_import
... | dougthor42/TPEdit | tpedit/main.py | Python | gpl-3.0 | 33,403 |
# Copyright 2014 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | zhimin711/nova | nova/api/openstack/compute/schemas/migrate_server.py | Python | apache-2.0 | 1,742 |
# ElasticQuery
# File: elasticquery.py
# Desc: ElasticQuery itself
import json
from .dsl_util import unroll_struct
def _json_date(obj):
if hasattr(obj, 'isoformat'):
return obj.isoformat()
else:
raise TypeError('{0} is not JSON serializable'.format(obj))
class ElasticQuery(object):
'''... | Fizzadar/ElasticQuery | elasticquery/elasticquery.py | Python | mit | 4,341 |
from yuuhpizzakebab import app, admin_required, login_required
from .models import Topping
from flask import render_template, session, redirect, url_for, request
@app.route('/toppings', methods=['GET'])
@admin_required
def list_toppings():
"""Shows a list of toppings"""
return render_template('topping/topping... | lex/yuuh-pizza-kebab | yuuhpizzakebab/topping/views.py | Python | bsd-2-clause | 1,884 |
from django.contrib import admin
from il.models import Agency
class AgencyAdmin(admin.ModelAdmin):
list_display = ('name', 'census_profile_id')
admin.site.register(Agency, AgencyAdmin)
| OpenDataPolicingNC/Traffic-Stops | il/admin.py | Python | mit | 193 |
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for the Earth and Planetary Sciences
# Copyright (C) 2012 - 2017 by the BurnMan team, released under the GNU
# GPL v2 or later.
"""
HP_2011_fluids
^^^^^^^^
Fluids from Holland and Powell 2011 and references therein.
CORK parameters:
CHO gase... | CaymanUnterborn/burnman | burnman/minerals/HP_2011_fluids.py | Python | gpl-2.0 | 5,104 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Eric D Helms <[email protected]>
# 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_version... | tersmitten/ansible | lib/ansible/modules/remote_management/foreman/_katello.py | Python | gpl-3.0 | 20,771 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.contrib.g... | megaserg/pants | contrib/go/src/python/pants/contrib/go/targets/go_library.py | Python | apache-2.0 | 498 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.