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 |
|---|---|---|---|---|---|---|
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | qiita-spots/qiita_client | qiita_client/util.py | Python | bsd-3-clause | 2,813 | 0 |
from libsaas import http, parsers
from libsaas.services import base
class Products(base.RESTResource):
path = 'products'
@base.apimethod
def get(self, start=None, limit=None):
"""
Lists products attached to a deal.
Upstream documentation:
https://developers.pipedrive.com... | ducksboard/libsaas | libsaas/services/pipedrive/deals.py | Python | mit | 5,710 | 0 |
"""Module with views for the employee feature."""
from django.contrib import messages
from django.contrib.auth import logout
from django.contrib.auth.decorators import login_required, permission_required
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, redirect, render
from... | VirrageS/io-kawiarnie | caffe/employees/views.py | Python | mit | 2,869 | 0 |
# Default Django settings. Override these with settings in the module
# pointed-to by the DJANGO_SETTINGS_MODULE environment variable.
# This is defined here as a do-nothing function because we can't import
# django.utils.translation -- that module depends on the settings.
gettext_noop = lambda s: s
#################... | CollabQ/CollabQ | vendor/django/conf/global_settings.py | Python | apache-2.0 | 14,562 | 0.00206 |
'''This module contains the ComplexityVisitor class which is where all the
analysis concerning Cyclomatic Complexity is done. There is also the class
HalsteadVisitor, that counts Halstead metrics.'''
import ast
import collections
import operator
# Helper functions to use in combination with map()
GET_COMPLEXITY = ope... | rubik/radon | radon/visitors.py | Python | mit | 14,879 | 0 |
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2012> Gabriel Falc達o <gabriel@nacaolivre.org>
#
# 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 Foundatio... | yangming85/lettuce | tests/functional/language_specific_features/test_ja.py | Python | gpl-3.0 | 6,962 | 0.005402 |
#!/usr/bin/env python
"""Output plugins implementations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from grr_response_server import output_plugin
# pylint: disable=unused-import,g-import-not-at-top
try:
from grr_response_server.output_plugins im... | dunkhong/grr | grr/server/grr_response_server/output_plugins/__init__.py | Python | apache-2.0 | 668 | 0.002994 |
"""Helper to help store data."""
from __future__ import annotations
import asyncio
from collections.abc import Callable
from contextlib import suppress
from json import JSONEncoder
import logging
import os
from typing import Any
from homeassistant.const import EVENT_HOMEASSISTANT_FINAL_WRITE
from homeassistant.core i... | aronsky/home-assistant | homeassistant/helpers/storage.py | Python | apache-2.0 | 8,433 | 0.00083 |
# Copyright (c) 2011 Openstack, LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | superstack/nova | nova/scheduler/api.py | Python | apache-2.0 | 9,884 | 0.001012 |
import pytest
import numpy as np
import scipy.linalg
import scipy.sparse
import qutip
if qutip.settings.has_mkl:
from qutip._mkl.spsolve import mkl_splu, mkl_spsolve
pytestmark = [
pytest.mark.skipif(not qutip.settings.has_mkl,
reason='MKL extensions not found.'),
]
class Test_spsolve... | qutip/qutip | qutip/tests/test_mkl.py | Python | bsd-3-clause | 3,447 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most... | mitchcapper/mythbox | resources/lib/mysql-connector-python/python3/examples/engines.py | Python | gpl-2.0 | 1,836 | 0.002179 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# EDPC Mentoring Database documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 28 23:28:25 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are pres... | rjw57/edpcmentoring | docs/conf.py | Python | mit | 10,393 | 0.005966 |
"""
Serialize data to/from JSON
"""
# Avoid shadowing the standard library json module
from __future__ import absolute_import, unicode_literals
import datetime
import decimal
import json
import sys
import uuid
from io import BytesIO
from django.core.serializers.base import DeserializationError
from django.core.seria... | superisaac/django-mljson-serializer | django_mljson/serializer.py | Python | mit | 2,206 | 0.001813 |
# Python - 3.6.0
test.assert_equals(generateShape(3), '+++\n+++\n+++')
test.assert_equals(generateShape(8), '++++++++\n++++++++\n++++++++\n++++++++\n++++++++\n++++++++\n++++++++\n++++++++')
| RevansChen/online-judge | Codewars/7kyu/build-a-square/Python/test.py | Python | mit | 191 | 0.005236 |
# -*- coding: utf-8; fill-column: 78 -*-
import collections
import itertools
import operator
from flatland.schema.paths import pathexpr
from flatland.signals import validator_validated
from flatland.util import (
Unspecified,
assignable_class_property,
class_cloner,
named_int_factory,
symbol,
)
... | jek/flatland | flatland/schema/base.py | Python | mit | 29,692 | 0.000404 |
# -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | TribeMedia/synapse | tests/util/test_lrucache.py | Python | apache-2.0 | 7,584 | 0 |
# 1、`if __name__ == "__main__":`
'''
__name__是指示当前py文件调用方式的方法。
如果它等于"__main__"就表示是直接执行,如果不是,则用来被别的文件调用。
一般写在文件的最后。
查看format.py和wordsCount.py的布局
'''
# 2、函数
'''
查看format.py中的formatLines函数
def xxx():
# 函数体
'''
# 3、if条件语句
'''
if xx:
# xxx
elif xxx:
# xxx
elif xxx:
# xxx
else:
# xxx
`else` 表示剩下的所有情况,该... | inkfountain/learn-py-a-little | lesson_file/lesson.py | Python | gpl-2.0 | 1,662 | 0.011044 |
# Created By: Virgil Dupras
# Created On: 2006/05/02
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/g... | stuckj/dupeguru | core/tests/ignore_test.py | Python | gpl-3.0 | 4,306 | 0.019508 |
import time
import RPi.GPIO as GPIO
from flask import Flask, render_template
# GPIO and Sensors ============================================================
# Objects to represent sensors used to get water level
class WaterLevelSensor:
# how high the sensor is above the top of the fish tank
offset = 0
d... | tvictor20/tvictor-advprog | aquaponics/app.py | Python | gpl-3.0 | 1,404 | 0.003561 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This module defines how cells are stored as tunacell's objects
"""
from __future__ import print_function
import numpy as np
import warnings
import treelib as tlib
from tunacell.base.observable import Observable, FunctionalObservable
from tunacell.base.datatools impo... | LeBarbouze/tunacell | tunacell/base/cell.py | Python | mit | 15,188 | 0.00079 |
from coinpy.model.scripts.opcodes import OP_2DIV, OP_2MUL, OP_AND, OP_CAT,\
OP_DIV, OP_INVERT, OP_LSHIFT, OP_LEFT, OP_MOD, OP_OR, OP_RIGHT, OP_RSHIFT,\
OP_SUBSTR, OP_XOR, OP_MUL
DISABLED_OPCODES=[OP_CAT, OP_SUBSTR, OP_LEFT, OP_RIGHT, OP_INVERT, OP_AND, OP_OR, OP_XOR, OP_2MUL, OP_2DIV, OP_MUL, OP_DIV, OP_MOD, ... | sirk390/coinpy | coinpy-lib/src/coinpy/lib/vm/opcode_impl/disabled.py | Python | lgpl-3.0 | 341 | 0.008798 |
##############################################################################
#
# Copyright (C) Zenoss, Inc. 2009, 2011, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
###############################... | zenoss/ZenPacks.zenoss.Puppet | ZenPacks/zenoss/Puppet/BatchDeviceLoader.py | Python | gpl-2.0 | 26,792 | 0.003844 |
#coding:utf-8
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
# 引入我们创建的表单类
from models import SearchForm,SearchRepoForm,ConnectForm
import requests
import json
from chgithub import GetSearchInfo,SearchRepo,SocialConnect,SearchConnect,nonSocialConnect
def index(request... | ch710798472/GithubRecommended | RecGithub/views.py | Python | mit | 3,774 | 0.014168 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Unit tests for the `iris.fileformats.abf.ABFField` class."""
# Import iris.tests first so that some things can be initialis... | SciTools/iris | lib/iris/tests/unit/fileformats/abf/test_ABFField.py | Python | lgpl-3.0 | 1,558 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/client/mailer.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, th... | guitarmanj/king-phisher | king_phisher/client/mailer.py | Python | bsd-3-clause | 38,476 | 0.023365 |
#!/usr/bin/env python
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | youfoh/webkit-efl | Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py | Python | lgpl-2.1 | 8,511 | 0.005522 |
import vtk
import numpy as np
import matplotlib.pyplot as plt
def vtkmatrix_to_numpy(matrix):
m = np.ones((4, 4))
for i in range(4):
for j in range(4):
m[i, j] = matrix.GetElement(i, j)
return m
"""
Get transformation from viewpoint coordinates to
real-world coordinates. (tmat)
"""
... | lucasplus/MABDI | scripts/Plot_Depth_Image_To_Z.py | Python | bsd-3-clause | 4,777 | 0.000837 |
#!/usr/bin/env python
import sys
import struct
import string
class QcowHeaderExtension:
def __init__(self, magic, length, data):
self.magic = magic
self.length = length
self.data = data
@classmethod
def create(cls, magic, data):
return QcowHeaderExtension(magic, len(da... | nypdmax/NUMA | tools/qemu-xen/tests/qemu-iotests/qcow2.py | Python | gpl-2.0 | 7,287 | 0.009332 |
# Natural Language Toolkit: Interface to Weka Classsifiers
#
# Copyright (C) 2001-2008 University of Pennsylvania
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
#
# $Id: naivebayes.py 2063 2004-07-17 21:02:24Z edloper $
import time, tempfi... | hectormartinez/rougexstem | taln2016/icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk/classify/weka.py | Python | apache-2.0 | 8,796 | 0.004093 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate... | agry/NGECore2 | scripts/mobiles/talus/sickly_decay_mite_queen.py | Python | lgpl-3.0 | 1,557 | 0.026975 |
# coding: utf-8
from django.core.management.base import BaseCommand
from ...fetch.fetchers import VerifyFetcher
class Command(BaseCommand):
"""Updates the stored data about the Twitter user for one or all Accounts.
For one account:
./manage.py fetch_accounts --account=philgyford
For all accounts:
... | philgyford/django-ditto | ditto/twitter/management/commands/fetch_twitter_accounts.py | Python | mit | 1,562 | 0 |
import frappe
def execute():
frappe.reload_doc("selling", "doctype", "sales_order")
docs = frappe.get_all("Sales Order", {
"advance_paid": ["!=", 0]
}, "name")
for doc in docs:
frappe.db.set_value("Sales Order", doc.name, "advance_received", 1, update_modified=False) | neilLasrado/erpnext | erpnext/patches/v13_0/update_advance_received_in_sales_order.py | Python | gpl-3.0 | 300 | 0.01 |
"""
Sphinx plugins for Django documentation.
"""
import docutils.nodes
import docutils.transforms
import sphinx
import sphinx.addnodes
import sphinx.directives
import sphinx.environment
import sphinx.roles
from docutils import nodes
def setup(app):
app.add_crossref_type(
directivename = "setting",
... | Yelp/pyes | docs/_ext/djangodocs.py | Python | bsd-3-clause | 3,769 | 0.011409 |
from dolfin import *
import numpy as np
import pandas as pd
n = 6
Dim = np.zeros((n,1))
ErrorL2 = np.zeros((n,1))
ErrorH1 = np.zeros((n,1))
OrderL2 = np.zeros((n,1))
OrderH1 = np.zeros((n,1))
# parameters['reorder_dofs_serial'] = False
for x in range(1,n+1):
parameters['form_compiler']['quadrature_degree'] = -1
... | wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/Hartman2D/Laplacian.py | Python | mit | 1,981 | 0.014134 |
#!/usr/bin/env python
# coding=utf-8
import threading
import time
class timer(threading.Thread): #The timer class is derived from the class threading.Thread
def __init__(self, num, interval):
threading.Thread.__init__(self)
self.thread_num = num
self.interval = interval
self.thread_... | zhaochl/python-utils | utils/thread/time_thread.py | Python | apache-2.0 | 846 | 0.01773 |
# My computer was failing to recognize wifi networks after being woken up from sleep so this uses the network manager command
# line tool to force my computer to recognize the network I type in to the terminal.
import subprocess
network_name = raw_input("What is the name of your network? ")
subprocess.check_call(['nmc... | caryben/Ubuntu-bug-fixes | hidden_network_workaround.py | Python | mit | 357 | 0.005602 |
"""Tests for the system_log component."""
| fbradyirl/home-assistant | tests/components/system_log/__init__.py | Python | apache-2.0 | 42 | 0 |
import binascii
import sys
class ProtocolTreeNode(object):
def __init__(self, tag, attributes = None, children = None, data = None):
self.tag = tag
self.attributes = attributes or {}
self.children = children or []
self.data = data
assert type(self.children) is list, "Childr... | metis-ai/yowsup | yowsup/structs/protocoltreenode.py | Python | gpl-3.0 | 4,746 | 0.00906 |
import tests.periodicities.period_test as per
per.buildModel((7 , 'M' , 200));
| antoinecarme/pyaf | tests/periodicities/Month/Cycle_Month_200_M_7.py | Python | bsd-3-clause | 81 | 0.049383 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from rest_framework import viewsets, routers
from voting_app.models import Topic
from voting_app.views import Vote
from voting_app.serializer import TopicSerializer
admin.autodiscover()
# ViewSets define the view behavior.
class To... | gc3-uzh-ch/django-simple-poll | voting/urls.py | Python | agpl-3.0 | 833 | 0.003601 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 2013Commons/hue | desktop/libs/libsaml/src/libsaml/conf.py | Python | apache-2.0 | 4,427 | 0.005195 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-05 20:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('opconsole', '0026_auto_20170504_2048'),
]
operations = [
migrations.AddField(... | baalkor/timetracking | opconsole/migrations/0027_device_name.py | Python | apache-2.0 | 468 | 0 |
"""
Module to translate various names (unicode, LaTeX & other text) for characters to encodings in the Symbol font standard encodings.
Also, provide grace markup strings for them.
It recognizes unicode names for the greek alphabet and most of the useful symbols in the Symbol font.
Marcus Mendenhall, Vanderbilt Univer... | bt3gl/Plotting-in-Linux | grace/src/symbol_mapping.py | Python | mit | 8,291 | 0.014353 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for edit widgets.
.. 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.
"""
__au... | NINAnor/QGIS | tests/src/python/test_qgseditwidgets.py | Python | gpl-2.0 | 2,315 | 0.000864 |
# This is the example of main program file which imports entities,
# connects to the database, drops/creates specified tables
# and populate some data to the database
from pony.orm import * # or just import db_session, etc.
import all_entities # This command make sure that all entities are imported
from base_entitie... | kozlovsky/ponymodules | main.py | Python | mit | 707 | 0.004243 |
# -*- coding: utf-8 -*-
#
# exercise 4: variables and names
#
cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print "There are", cars, "cars avali... | zstang/learning-python-the-hard-way | ex4.py | Python | mit | 621 | 0.00161 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | mpasternak/pyglet-fix-issue-552 | pyglet/image/codecs/pypng.py | Python | bsd-3-clause | 41,571 | 0.000385 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import obci_log_model
class DummyLogModel(obci_log_model.LogModel):
def __init__(self):
super(DummyLogModel, self).__init__()
self._ind = 0
self._peers_log = {'amplifier':
{'peer_id': 'amplifier', 'logs'... | BrainTech/openbci | obci/control/gui/obci_log_model_dummy.py | Python | gpl-3.0 | 732 | 0 |
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
import typing
from ... import exc
from ... import util
from ...sql import coercions
from ...sql impo... | sqlalchemy/sqlalchemy | lib/sqlalchemy/dialects/mysql/expression.py | Python | mit | 4,164 | 0 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import urllib2
import json
from plugins.plugin import Plugin
from time import time
from bytebot_config import BYTEBOT_HTTP_TIMEOUT, BYTEBOT_HTTP_MAXSIZE
from bytebot_config import BYTEBOT_PLUGIN_CONFIG
class parking(Plugin):
def __init__(self):
pass
d... | jurkov/Bytebot | plugins/parking.py | Python | mit | 2,182 | 0 |
"""
TODO:
- Handle if file already exists
"""
import ctypes
import io
import os
import struct
from contextlib import contextmanager
import ddt
import mock
from unittest2 import TestCase
import tempfile
from polypype import _MAX_C_FLOAT, _MAX_C_UINT32, PolyPype
from polypype.exceptions import (
PolyPypeArgumen... | dan-f/polypype | tests/test_polypipe.py | Python | mit | 5,061 | 0 |
# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
#
# This module is part of async and is released under
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
"""Contains a queue based channel implementation"""
from Queue import (
Empty,
Full
)
from util import (
... | Conjuro/async | channel.py | Python | bsd-3-clause | 11,309 | 0.041648 |
import asposecellscloud
from asposecellscloud.CellsApi import CellsApi
from asposecellscloud.CellsApi import ApiException
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
apiKey = "XXXXX" #sepcify App Key
appSid = "XXXXX" #sepcify App SID
apiServer = "http://api.aspose.com/v1.1"
data_fol... | asposecells/Aspose_Cells_Cloud | Examples/Python/Examples/DeleteHyperlinksFromExcelWorksheet.py | Python | mit | 1,503 | 0.00998 |
import unittest
from pyramid import testing
class ViewTests(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
def test_my_view(self):
from .views import my_view
request = testing.DummyRequest()
info = my_vie... | Dante83/lexinomicon | lexinomicon/tests.py | Python | gpl-3.0 | 388 | 0 |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import sys
sys.path.append('./MNIST_data')
import os.path
from download import download
have_data = os.path.exists('MNIST_data/train-images-idx3-ubyte.gz')
if not have_data:
download('./MNIST_data')
# load data
mnist = input_data.r... | shucommon/little-routine | python/AI/tensorflow/dropout.py | Python | gpl-3.0 | 2,353 | 0.00742 |
#!/usr/bin/env python
"""Do the final prediction of binding site given all features."""
from __future__ import print_function, absolute_import
import pickle
import os
import optparse
import cryptosite.config
def get_matrix(inputdata, model='linear'):
Res = {'CYS': (0, 0, 1, 0, 0), 'ASP': (0, 0, 0, 1, 1),
... | salilab/cryptosite | lib/cryptosite/predict.py | Python | lgpl-2.1 | 7,574 | 0 |
#!/usr/bin/env python3
import sys
from util import proctal_cli, sleeper
class Error(Exception):
pass
class TestSingleValue:
def __init__(self, type, value):
self.type = type
self.value = value
pass
def run(self, guinea):
address = proctal_cli.allocate(guinea.pid(), self.v... | daniel-araujo/proctal | src/cli/tests/write-binary.py | Python | gpl-3.0 | 1,310 | 0.00458 |
# mxacquisition.py
#
# Copyright (C) 2014 Diamond Light Source, Karl Levik
#
# 2014-09-24
#
# Methods to store MX acquisition data
#
import copy
from ispyb.sp.acquisition import Acquisition
from ispyb.strictordereddict import StrictOrderedDict
class MXAcquisition(Acquisition):
"""MXAcquisition provides metho... | DiamondLightSource/ispyb-api | src/ispyb/sp/mxacquisition.py | Python | apache-2.0 | 9,112 | 0.001097 |
# -*- coding: utf8 -*-
import logging
from logging.handlers import RotatingFileHandler
from babel.dates import format_datetime, datetime
from time import sleep
from traceback import print_exception, format_exception
class LogFile(logging.Logger):
'''rotatively logs erverything
'''
def initself(self):
... | littleDad/mesLucioles | logger_04.py | Python | gpl-2.0 | 2,415 | 0.003313 |
# -*- coding: cp1252 -*-
#Codename Octohax
#To find Octohax offsets on newer versions, dump memory
#in that area, eg 0x10500000 to 0x10700000, open in hex
#editor, search "Tnk_Simple", there are only 2 results
#Also search for Player00
#There should be like a result or two before what you want
#Looks like this:
'''
.k.... | XBigTK13X/wiiu-memshark | vendor/tcpgecko/octoling.py | Python | mit | 5,604 | 0.010171 |
from __future__ import division
import math
import numpy as np
import networkx as nx
from sklearn.preprocessing import normalize
from kilogram import NgramService
class Signature(object):
vector = None
mapping = None
def __init__(self, vector, G, candidate_uris):
"""
:type candidate_uris:... | dragoon/kilogram | kilogram/entity_linking/mention_rw/__init__.py | Python | apache-2.0 | 7,287 | 0.002196 |
# https://projecteuler.net/problem=1
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
# Find the sum of all the multiples of 3 or 5 below 1000.
# = 233168
import sys
def sum(n):
total = 0
for i in range(n):
if (i % 3... | weyw/eulerproject | wey/p1.py | Python | gpl-2.0 | 458 | 0.00655 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals
import copy
import glob
import json
import os
import unittest
from pymatgen import Molecule
from pymatgen.io.qchem import QcTask, QcInput, QcOutput
from pymatgen.util.t... | aykol/pymatgen | pymatgen/io/tests/test_qchem.py | Python | mit | 81,842 | 0.00033 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Dag Wieers <dag@wieers.com>
#
# 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, ... | andreaso/ansible | lib/ansible/modules/remote_management/wakeonlan.py | Python | gpl-3.0 | 4,077 | 0.004415 |
#!/usr/bin/python
#
# Copyright 2007 Google 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/licenses/LICENSE-2.0
#
# Unless required by... | google/python_portpicker | src/tests/portpicker_test.py | Python | apache-2.0 | 16,155 | 0.000371 |
# copies.py - copy detection for Mercurial
#
# Copyright 2008 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import util
import heapq
def _nonoverlap(d1, d2, d3):
"Return list of elements in d1... | vmg/hg-stable | mercurial/copies.py | Python | gpl-2.0 | 12,819 | 0.001872 |
from __future__ import absolute_import
import os
import zmq
import uuid as uuid_pkg
import time
import binascii
import random
import socket
import struct
import marshal
import mmap
from multiprocessing import Manager, Condition
from mmap import ACCESS_WRITE, ACCESS_READ
from dpark.utils.log import get_logger
from dpar... | douban/dpark | dpark/broadcast.py | Python | bsd-3-clause | 24,223 | 0.001238 |
"""
QuarkPlayer, a Phonon media player
Copyright (C) 2008-2009 Tanguy Krotoff <tkrotoff@gmail.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 Software Foundation, either version 3 of the License, or
(at... | tkrotoff/QuarkPlayer | buildbot/upload_package.py | Python | gpl-3.0 | 2,173 | 0.018408 |
from django import forms
from .models import MemberRSVP
class EventAttendeeForm(forms.ModelForm):
id = forms.IntegerField(widget=forms.HiddenInput)
worked_on = forms.CharField(widget=forms.Textarea(attrs={
'cols': '35',
'rows': '5'
}))
class Meta:
model = MemberRSVP
... | DjangoNYC/squid | squid/core/forms.py | Python | mit | 352 | 0 |
"""This program is used to generate the coefficients c00, c01 and c11
used in the demo."""
# Copyright (C) 2007-2009 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free S... | alogg/dolfin | demo/undocumented/tensor-weighted-poisson/python/generate_data.py | Python | gpl-3.0 | 1,642 | 0 |
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de
# Aplicacion de las TIC basadas en Fuentes Abiertas, Spain.
#
# 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... | helix84/activae | src/Type.py | Python | bsd-3-clause | 2,833 | 0.003883 |
# -*- coding: utf-8 -*-
#
# genologics-sql documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 27 15:17:17 2016.
#
# 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... | Galithil/genologics_sql | doc/source/conf.py | Python | mit | 9,443 | 0.006036 |
from unittest import TestCase
from dark.simplify import simplifyTitle
class SimplifyTitle(TestCase):
"""
Tests for the dark.simplify.simplifyTitle function.
"""
def testEmptyTitle(self):
"""
Simplifying an empty title with a non-empty target should return
an empty title.
... | bamueh/dark-matter | test/test_simplify.py | Python | mit | 1,892 | 0 |
from django import forms
from apu.models import Persona
class FormularioContactos(forms.Form):
asunto=forms.CharField()
email=forms.EmailField(required=False)
mensaje=forms.CharField()
class PersonaForm(forms.ModelForm):
nombre = forms.CharField(max_length=50,help_text="nombre Persona")
dni = forms.CharField(max... | javiergarridomellado/ej5 | apu/forms.py | Python | gpl-2.0 | 745 | 0.02953 |
#
# 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... | nathanielvarona/airflow | airflow/providers/google/cloud/example_dags/example_dataflow_flex_template.py | Python | apache-2.0 | 2,774 | 0.001802 |
"""
pygments.lexers._postgres_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Self-updating data files for PostgreSQL lexer.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
# Autogenerated: please edit them if you like wasting your time.... | dscorbett/pygments | pygments/lexers/_postgres_builtins.py | Python | bsd-2-clause | 12,184 | 0.000246 |
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
"""Imports groups from some external tar.gz bundle or plain text list.
External URL should serve *.tar.gz file with the following file structure:
<ext... | pombreda/swarming | appengine/auth_service/common/importer.py | Python | apache-2.0 | 14,804 | 0.010875 |
# Generated by Django 2.2.14 on 2020-07-30 12:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0028_auto_20200615_0811'),
]
operations = [
migrations.AddField(
model_name='user',
name='verified_email',... | taigaio/taiga-back | taiga/users/migrations/0029_user_verified_email.py | Python | agpl-3.0 | 391 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Modules used for ETL - Create User
# Modules required:
import os
import xmlrpclib, sys, csv, ConfigParser
from openerp.tools.status_history import status
from datetime import datetime
# -----------------------------------------------------------------------------
# ... | Micronaet/micronaet-quality | quality/etl/import.py | Python | agpl-3.0 | 101,183 | 0.009172 |
#! /usr/bin/env python
# encoding: utf-8
import os,sys,imp,types,tempfile,optparse
import Logs,Utils
from Constants import*
cmds='distclean configure build install clean uninstall check dist distcheck'.split()
commands={}
is_install=False
options={}
arg_line=[]
launch_dir=''
tooldir=''
lockfile=os.environ.get('WAFLOCK... | tsarnowski/hamster | wafadmin/Options.py | Python | gpl-3.0 | 6,022 | 0.06277 |
#!C:\Python27\python.exe
# Filename: GenericBytecode.py
# -*- coding: utf-8 -*-
import os
import Settings
'''
Generic Bytecode
Simply add, remove or modify bytecode for use in KHMS
'''
createFrame = ['aload_0', 'getfield', 'aload_0', 'dup', 'getfield', 'dup_x1',
'iconst_1', 'iadd', 'putfield', 'il... | injectnique/KnuckleHeadedMcSpazatron | GenericBytecode.py | Python | mit | 46,794 | 0.013506 |
from itertools import permutations
import re
def create_formula(combination,numbers):
formula = ""
index = 0
for op in combination:
formula += str(numbers[index]) + op
index += 1
formula += numbers[index]
return formula
'''
Unnecessary Funtion
'''
def evaluate(form):
result ... | F0lha/UJunior-Projects | DailyProgrammer/Challenge#318/src.py | Python | mit | 2,546 | 0.008641 |
#!/usr/bin/env python
# encoding: utf-8
import re
from tornado.web import UIModule
from conf.config import BT_PAGE_SIZE
#TODO it is may not be good to put it here to make the pager class scattered
class Pagination(UIModule):
def render(self, page, uri, list_rows=BT_PAGE_SIZE):
def gen_page_list(current... | wangjun/BT-Share | web/module/module.py | Python | mit | 955 | 0.006283 |
import os
from os.path import abspath, basename, dirname, join, normpath
from sys import path
import dj_database_url
from .settings import *
DEBUG = True
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_URL = '/static/'
# Extra places for col... | shearichard/django-channels-demo | chnnlsdmo/chnnlsdmo/settings_heroku.py | Python | bsd-3-clause | 510 | 0.005882 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-17 17:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('boards', '0017_card_blocking_cards'),
]
operations = [
migrations.AddField(
... | diegojromerolopez/djanban | src/djanban/apps/boards/migrations/0018_list_position.py | Python | mit | 505 | 0.00198 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 applicabl... | ctrlaltdel/neutrinator | vendor/requestsexceptions/__init__.py | Python | gpl-3.0 | 2,032 | 0 |
#!/usr/bin/python2.7
from nassl._nassl import SSL
from SslClient import SslClient
class DebugSslClient(SslClient):
"""
An SSL client with additional debug methods that no one should ever use (insecure renegotiation, etc.).
"""
def get_secure_renegotiation_support(self):
return self._ssl.get_... | ZenSecurity/nassl | src/DebugSslClient.py | Python | gpl-2.0 | 3,283 | 0.009138 |
import bounds
from py3D import Vector, Ray, Color, Body
class Sphere(Body):
center = Vector()
radius = 0.0
R = 0.0
color = [0.01,0.01,0.01]
def p(self):
"""Returns the name of the type of body this is."""
return 'Sphere'
def set_position(self, c):
self.cen... | dburggie/py3D | bodies/Sphere.py | Python | mit | 2,470 | 0.011741 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TwitterRecentEntriesItem'
db.create_table(u'contentitem_f... | bashu/fluentcms-twitterfeed | fluentcms_twitterfeed/south_migrations/0001_initial.py | Python | apache-2.0 | 7,116 | 0.00801 |
#!/usr/bin/env python
"""Base class for all FAUCET unit tests."""
# pylint: disable=missing-docstring
# pylint: disable=too-many-arguments
import collections
import glob
import ipaddress
import json
import os
import random
import re
import shutil
import subprocess
import time
import unittest
import yaml
import requ... | Bairdo/faucet | tests/faucet_mininet_test_base.py | Python | apache-2.0 | 72,009 | 0.000667 |
import os
from PyQt4.QtCore import pyqtSignal
from PyQt4.QtGui import QComboBox, QDoubleValidator
from configmanager.editorwidgets.core import ConfigWidget
from configmanager.editorwidgets.uifiles.ui_numberwidget_config import Ui_Form
class NumberWidgetConfig(Ui_Form, ConfigWidget):
description = 'Number entry w... | HeatherHillers/RoamMac | src/configmanager/editorwidgets/numberwidget.py | Python | gpl-2.0 | 1,472 | 0.004076 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from datetime import datetime, date
from optionaldict import optionaldict
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatWiFi(BaseWeChatAPI):
API_BASE_URL = 'https://api.weixin.qq.com/bizwifi/'
def list_shops(s... | chenjiancan/wechatpy | wechatpy/client/api/wifi.py | Python | mit | 5,576 | 0 |
#!/usr/bin/env python
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime
import js... | kirklink/udacity-fullstack-p4 | conference.py | Python | apache-2.0 | 40,994 | 0.000488 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ExportGeometryInfo.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************... | GeoCat/QGIS | python/plugins/processing/algs/qgis/ExportGeometryInfo.py | Python | gpl-2.0 | 6,865 | 0.001165 |
#*****************************************************************************
# Copyright (C) 2017 Lee Worden <worden dot lee at gmail dot com>
#
# Distributed under the terms of the GNU General Public License (GPL) v.2
# http://www.gnu.org/licenses/
#************************************************... | tcporco/SageBoxModels | boxmodel/boxmodel.py | Python | gpl-2.0 | 26,560 | 0.041679 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.sitemaps import Sitemap
from . import models
class BlogSitemap(Sitemap):
changefreq = "daily"
priority = 0.5
def items(self):
return models.Post.objects.filter(is_draft=False)
def lastmod(self, obj):
return obj.update... | flyhigher139/mayblog | blog/main/sitemaps.py | Python | gpl-2.0 | 968 | 0.004132 |
from django import forms
from django.conf import settings
from django.contrib.admin.helpers import normalize_fieldsets, AdminReadonlyField, AdminField
from django.contrib.admin.templatetags.admin_static import static
from django.utils.safestring import mark_safe
class AdminForm(object):
def __init__(self, form, fi... | joke2k/django-options | django_options/formset.py | Python | bsd-3-clause | 4,546 | 0.00264 |
import codecs
f = codecs.open("/Users/hjp/Downloads/task/data/dev.txt", 'r', 'utf-8')
for line in f.readlines():
print(line)
sents = line.split('\t')
print(sents[1] + "\t" + sents[3])
for i in range(len(sents)):
print(sents[i])
f.close()
| hjpwhu/Python | src/hjp.edu.nlp.data.task/semeval.py | Python | mit | 269 | 0.003717 |
__author__ = "Johannes Köster"
__copyright__ = "Copyright 2015, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"
import os
import traceback
from tokenize import TokenError
from snakemake.logging import logger
def format_error(ex, lineno,
linemaps=None,
s... | vangalamaheshh/snakemake | snakemake/exceptions.py | Python | mit | 10,433 | 0.000192 |
import maya.cmds as cmds
import maya.utils as utils
import threading
import time
import sys
from PyQt4 import QtCore, QtGui
pumpedThread = None
app = None
def pumpQt():
global app
def processor():
app.processEvents()
while 1:
time.sleep(0.01)
utils.executeDeferred( processor )
def initializePumpThread():
... | lordtangent/arsenalsuite | cpp/apps/absubmit/maya/pumpThread.py | Python | gpl-2.0 | 504 | 0.049603 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.