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 |
|---|---|---|---|---|---|---|
type='TrueType'
name='Calligrapher-Regular'
desc={'Ascent':899,'Descent':-234,'CapHeight':731,'Flags':32,'FontBBox':'[-50 -234 1328 899]','ItalicAngle':0,'StemV':70,'MissingWidth':800}
up=-200
ut=20
cw={
'\x00':800,'\x01':800,'\x02':800,'\x03':800,'\x04':800,'\x05':800,'\x06':800,'\x07':800,'\x08':800,'\t':800,'\n':8... | sesuncedu/bitcurator | tools/py3fpdf/attic/font/calligra.py | Python | gpl-3.0 | 2,763 | 0.199421 |
"""Thin wrapper around the microdata library."""
from __future__ import absolute_import
import microdata
class Item(microdata.Item):
"""Add an "extra" field to microdata Items, so people won't feel the need
to make up ad-hoc properties.
Also add __eq__() and __repr__().
"""
def __init__(self, *a... | davidmarin/pbg | python/pbg/common/microdata.py | Python | apache-2.0 | 1,121 | 0.000892 |
# -*- coding: utf-8 -*-
#
# Copyright (©) 2013 Marcelo Jorge Vieira <metal@alucinados.com>
# Copyright (©) 2013 Gustavo Noronha Silva <gustavo@noronha.eti.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the F... | olhoneles/olhoneles | montanha/util.py | Python | agpl-3.0 | 3,167 | 0.000316 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import unittest
from telemetry import page as page_module
from telemetry.page import page_set
from telemetry.results import base_test_results_unit... | guorendong/iridium-browser-ubuntu | tools/telemetry/telemetry/results/page_test_results_unittest.py | Python | bsd-3-clause | 12,842 | 0.002803 |
from __future__ import absolute_import
from Plugins.Plugin import PluginDescriptor
from Components.PluginComponent import plugins
from enigma import eDBoxLCD
from .qpip import QuadPipScreen, setDecoderMode
def main(session, **kwargs):
session.open(QuadPipScreen)
def autoStart(reason, **kwargs):
if reason == 0:
... | openatv/enigma2 | lib/python/Plugins/Extensions/QuadPip/plugin.py | Python | gpl-2.0 | 682 | 0.030792 |
"""
create_org_data_czar_policy.py
Creates an IAM group for an edX org and applies an S3 policy to that group
that allows for read-only access to the group.
"""
import argparse
import boto3
from botocore.exceptions import ClientError
from string import Template
import sys
template = Template("""{
"Version":"2012-1... | edx/configuration | util/create_data_czar/create_org_data_czar_policy.py | Python | agpl-3.0 | 2,563 | 0.001951 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from .exceptions import TransactionValidationError
AVAIABLE_PAYMENT_METHOD = ['credit_card', 'boleto']
def validate_transaction(attrs):
if len(attrs) <= 0:
raise TransactionValidationError('Need a vali... | devton/pagarme-py | pagarme/transaction.py | Python | mit | 1,490 | 0.000671 |
#encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8') #设置命令行为utf-8,让代码里面的中文正常显示
from flask import Flask #从flask包导入Flask类
from flask import render_template #从flask包导入render_template函数
from flask import request ... | 51reboot/actual_09_homework | 07/xq/app.py | Python | mit | 10,060 | 0.018564 |
import os
from django.core.management.base import CommandError, AppCommand
from django_extensions.management.utils import _make_writeable
from optparse import make_option
class Command(AppCommand):
option_list = AppCommand.option_list + (
make_option('--name', '-n', action='store', dest='command_name', de... | rtucker-mozilla/inventory | vendor-local/src/django-extensions/django_extensions/management/commands/create_command.py | Python | bsd-3-clause | 3,608 | 0.003326 |
#PBS -N UnBalance
#PBS -m ae
#PBS -q long
#PBS -l nodes=1:opteron:ppn=2
"""Test handling of extreme load-unbalancing."""
from asap3 import *
from asap3.md import MDLogger
from ase.lattice.cubic import FaceCenteredCubic
import numpy as np
from asap3.mpi import world
#DebugOutput("UnBalance.%d.out")
#set_verbose(1)
pr... | auag92/n2dm | Asap-3.8.4/Debug/UnBalance.py | Python | mit | 1,763 | 0.01418 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Ponzoni, Nelson"
__copyright__ = "Copyright 2015"
__credits__ = ["Ponzoni Nelson"]
__maintainer__ = "Ponzoni Nelson"
__contact__ = "npcuadra@gmail.com"
__email__ = "npcuadra@gmail.com"
__license__ = "GPL"
__version__ = "1.0.0"
_... | lerker/cupydle | cupydle/dnn/capas.py | Python | apache-2.0 | 8,329 | 0.005043 |
# SecuML
# Copyright (C) 2016 ANSSI
#
# SecuML 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.
#
# SecuML is distributed in the hope t... | ah-anssi/SecuML | SecuML/core/DimensionReduction/Configuration/Projection/SdmlConfiguration.py | Python | gpl-2.0 | 1,670 | 0.001198 |
"""Support for sending data to Emoncms."""
import logging
from datetime import timedelta
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
CONF_API_KEY, CONF_WHITELIST, CONF_URL, STATE_UNKNOWN, STATE_UNAVAILABLE,
CONF_SCAN_INTERVAL)... | MartinHjelmare/home-assistant | homeassistant/components/emoncms_history/__init__.py | Python | apache-2.0 | 2,839 | 0 |
#
# Copyright 2016-2019 Crown Copyright
#
# 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 i... | gchq/gaffer-tools | python-shell/src/example.py | Python | apache-2.0 | 26,676 | 0.000487 |
# encoding: utf-8
# module samba.dcerpc.drsblobs
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/drsblobs.so
# by generator 1.135
""" drsblobs DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class DsCompressedChunk(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs):... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/drsblobs/DsCompressedChunk.py | Python | gpl-2.0 | 1,282 | 0.00702 |
#
# In this file, there are code present for solving this problem using
# several different approaches. The first ones were two slow to be
# valid solution (Project EULER says that it should be possible to
# find an algorithm that solves the problem in less than 60 secs).
#
#
# In the end, method number five ended... | mo/project-euler | python/problem15.py | Python | mit | 8,409 | 0.015816 |
# This file is part of BHMM (Bayesian Hidden Markov Models).
#
# Copyright (c) 2016 Frank Noe (Freie Universitaet Berlin)
# and John D. Chodera (Memorial Sloan-Kettering Cancer Center, New York)
#
# BHMM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Licen... | jchodera/bhmm | bhmm/init/__init__.py | Python | lgpl-3.0 | 859 | 0.001164 |
#!/usr/bin/env python
# coding: utf-8
"""
Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1.
For example, with A = "abcd" and B = "cdabcdab".
Return 3, because by repeating A three times (“abcdabcdabcd”), B is a substrin... | feigaochn/leetcode | p686_repeated_string_match.py | Python | mit | 1,105 | 0.001817 |
from Chip import OpCodeDefinitions
from Tests.OpCodeTests.OpCodeTestBase import OpCodeTestBase
class TestRtiOpCode(OpCodeTestBase):
def test_execute_rti_implied_command_calls_and_method(self):
self.assert_opcode_execution(OpCodeDefinitions.rti_implied_command, self.target.get_rti_command_executed)
| jeroanan/Nes2 | Tests/OpCodeTests/TestRtiOpCode.py | Python | bsd-3-clause | 313 | 0.003195 |
from django.utils.html import format_html
from django.utils.translation import ugettext as _
from django.contrib import admin
from django.urls import reverse
from rdrf.models.definition.models import Registry
from rdrf.models.definition.models import RegistryForm
from rdrf.models.definition.models import QuestionnaireR... | muccg/rdrf | rdrf/rdrf/admin.py | Python | agpl-3.0 | 19,470 | 0.001079 |
import math
def is_palindrome(n):
s = str(n)
return s == s[::-1]
def is_prime(n):
if n <= 1:
return False
if n % 2 == 0 and n != 2:
return False
if n == 2:
return True
root = math.sqrt(n)
i = 3
while i <= root:
if n % i == 0:
return Fa... | durandj/codeeval | python/3_prime_palindrome.py | Python | gpl-3.0 | 521 | 0.009597 |
"""Config flow for Plex."""
import copy
import logging
from aiohttp import web_response
import plexapi.exceptions
from plexapi.gdm import GDM
from plexauth import PlexAuth
import requests.exceptions
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import http
from homeas... | kennedyshead/home-assistant | homeassistant/components/plex/config_flow.py | Python | apache-2.0 | 16,121 | 0.000806 |
# Author: Monnappa K A
# Email : monnappa22@gmail.com
# Twitter: @monnappa22
# Description: Volatility plugin to detect different types of Process Hollowing
import os
import volatility.obj as obj
import volatility.utils as utils
from volatility.plugins.taskmods import PSList
import volatility.plugins.vadinfo as vadin... | etz69/irhelper | vol_plugins/hollowfind.py | Python | gpl-3.0 | 18,182 | 0.00935 |
"""Context processors, these get called and add things to template contexts"""
from .models import Tag
def pinned_tags(request):
""" Adds the list of tags this user has pinned """
out = {}
if request.user.is_authenticated():
out["pinned_tags"] = Tag.by_user(request.user).filter(pinned=True)
... | RossBrunton/BMAT | tags/context_processors.py | Python | mit | 338 | 0.008876 |
import datetime
from django.conf import settings
from django.contrib.auth import get_user_model, login
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from django.views.decorators.csrf import csrf_exempt
from oauth2client import client, crypt
from rest_framework.de... | openjck/distribution-viewer | viewer/api/views.py | Python | mpl-2.0 | 4,165 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py | Python | mit | 10,365 | 0.004824 |
"""Definitions for the `RProcess` class."""
from math import isnan
import numpy as np
from astrocats.catalog.source import SOURCE
from mosfit.constants import C_CGS, DAY_CGS, IPI, KM_CGS, M_SUN_CGS
from mosfit.modules.engines.engine import Engine
from scipy.interpolate import RegularGridInterpolator
# Important: Onl... | guillochon/FriendlyFit | mosfit/modules/engines/rprocess.py | Python | mit | 3,010 | 0.001329 |
from PyQt5.QtCore import QObject, pyqtSignal
class Player(QObject):
updated = pyqtSignal(object, object)
newCurrentGame = pyqtSignal(object, object, object)
"""
Represents a player the client knows about.
"""
def __init__(self,
id_,
login,
gl... | GrotheFAF/client | src/model/player.py | Python | gpl-3.0 | 4,660 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of HEPData.
# Copyright (C) 2016 CERN.
#
# HEPData 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... | eamonnmag/hepdata3 | hepdata/modules/records/api.py | Python | gpl-2.0 | 24,761 | 0.003029 |
# Copyright 2021 The Kubeflow Authors
#
# 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... | kubeflow/pipelines | sdk/python/kfp/deprecated/dsl/artifact_utils.py | Python | apache-2.0 | 3,439 | 0 |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
try:
import ctypes
except MemoryError:
# selinux execmem denial
# https://bugzilla.redhat.com/show_bug.cgi?id=488396
ctypes = None
except ImportError:
# Python on Solaris ... | OneBitSoftware/jwtSample | src/Spa/env1/Lib/site-packages/gunicorn/util.py | Python | mit | 12,319 | 0.001786 |
# https://oj.leetcode.com/problems/add-two-numbers/
# 1555 / 1555 test cases passed.
# You are given two linked lists representing two non-negative numbers.
# The digits are stored in reverse order and each of their nodes contain
# a single digit. Add the two numbers and return it as a linked list.
#
# Input: (2 -> 4 -... | saruberoz/leetcode-oj | leetcode-solutions/python/add_two_numbers.py | Python | mit | 1,303 | 0 |
#! /usr/bin/env python
#################################################################################################
#
# Script Name: bip.py
# Script Usage: This script is the menu system and runs everything else. Do not use other
# files unless you are comfortable with the code.
#
# ... | SSCPS/bip-gam-v1 | bip.py | Python | gpl-3.0 | 1,835 | 0.005995 |
HOST = '127.0.0.1'
PORT = 8080
from Tkinter import *
import tkColorChooser
import socket
import thread
import spots
################################################################################
def main():
global hold, fill, draw, look
hold = []
fill = '#000000'
connect()
root = Tk()
root... | ActiveState/code | recipes/Python/511434_Paint_10/recipe-511434.py | Python | mit | 3,174 | 0.008507 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/ml-metadata | ml_metadata/tools/documentation/build_docs.py | Python | apache-2.0 | 4,411 | 0.005214 |
import difflib, re
from pymongo.objectid import ObjectId
class CollectionDoc(object):
def __init__(self, db, docs, find_links=True):
self._db = db
self._collection_names = db.collection_names()
self._docs = docs
self._find_links = find_links
@property
def text(self):
... | cswank/mongodoc | mongodoc/collection_doc.py | Python | mit | 3,438 | 0.003781 |
# !/usr/bin/python
# -*- coding=utf-8 -*-
import json
import urllib2
from books.models import Book
domain = "http://smartebook.zmapp.com:9026"
# 同步图书详情
def sync_book(bid, cm):
# 完结了的图书不更新信息
if Book.objects.filter(id=bid, status=1).count() == 0:
page = urllib2.urlopen("http://wap.cmread.com/r/p/view... | lnybrave/zzbook | data/sync.py | Python | apache-2.0 | 2,231 | 0.00137 |
# IfcBlender - Blender IFC Importer
# Copyright (C) 2019 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcBlender.
#
# IfcBlender 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 Software Foundation, either v... | IfcOpenShell/IfcOpenShell | src/ifcblender/io_import_scene_ifc/__init__.py | Python | lgpl-3.0 | 13,611 | 0.002057 |
#!python
"""Script for plotting distributions of epitopes per site for two sets of sites.
Uses matplotlib. Designed to analyze output of epitopefinder_getepitopes.py.
Written by Jesse Bloom."""
import os
import sys
import random
import epitopefinder.io
import epitopefinder.plot
def main():
"""Main body of sc... | jbloom/epitopefinder | scripts/epitopefinder_plotdistributioncomparison.py | Python | gpl-3.0 | 3,447 | 0.004642 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | asolntsev/selenium | py/test/runner/run_pytest.py | Python | apache-2.0 | 1,047 | 0 |
#!/usr/bin/env python
import subprocess
import sys
from gi.repository import GLib, Gio
def main():
bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
'org.freedesktop.ScreenSaver', '/ScreenSaver',
'org.freedesktop.ScreenSaver',... | CMaiku/inhibit-screensaver | inhibit-screensaver.py | Python | gpl-2.0 | 851 | 0.007051 |
# Test behaviour of inf and nan in basic float operations
inf = float("inf")
nan = float("nan")
values = (-2, -1, 0, 1, 2, inf, nan)
for x in values:
for y in values:
print(x, y)
print(" + - *", x + y, x - y, x * y)
try:
print(" /", x / y)
except ZeroDivisionError:
... | bvernoux/micropython | tests/float/inf_nan_arith.py | Python | mit | 587 | 0.001704 |
"""DICOM Upper Layer Protocol Data Units (PDUs).
There are seven different PDUs:
- A_ASSOCIATE_RQ
- A_ASSOCIATE_AC
- A_ASSOCIATE_RJ
- P_DATA_TF
- A_RELEASE_RQ
- A_RELEASE_RP
- A_ABORT_RQ
::
from_primitive encode
+----------------+ ------> +------------+ -----> +-------------+
... | scaramallion/pynetdicom3 | pynetdicom/pdu.py | Python | mit | 68,107 | 0.000675 |
# -*- coding: utf-8 -*-
def command():
return "edit-instance-vmware"
def init_argument(parser):
parser.add_argument("--instance-no", required=True)
parser.add_argument("--instance-type", required=True)
parser.add_argument("--key-name", required=True)
parser.add_argument("--compute-resource", requi... | primecloud-controller-org/pcc-cli | src/pcc/api/instance/edit_instance_vmware.py | Python | apache-2.0 | 1,746 | 0.004009 |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
... | HomeRad/TorCleaner | wc/dns/opcode.py | Python | gpl-2.0 | 2,630 | 0.003802 |
import codecs
import sys
from setuptools import setup
version_file = "schema.py"
with open(version_file) as f:
for line in f.read().split("\n"):
if line.startswith("__version__ ="):
version = eval(line.split("=", 1)[1])
break
else:
print("No __version__ attribute found ... | keleshev/schema | setup.py | Python | mit | 1,562 | 0 |
#
# Copyright (c) 2004 Conectiva, Inc.
#
# Written by Gustavo Niemeyer <niemeyer@conectiva.com>
#
# This file is part of Smart Package Manager.
#
# Smart Package Manager 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 Fou... | pierrejean-coudert/winlibre_pm | package_manager/smart/commands/install.py | Python | gpl-2.0 | 6,529 | 0.002144 |
"""
This module contains the final mixin implementation, for whatever version
of Django is present.
"""
from django.db.models import ForeignKey, ManyToManyField
try:
# Django 1.9+
from .iterable import GroupByIterableMixinBase as GroupByMixinBase
except ImportError:
# Django 1.8-
from .queryset import... | kako-nawao/django-group-by | django_group_by/mixin.py | Python | mit | 2,630 | 0.00038 |
# coding: utf-8
from __future__ import unicode_literals
import itertools
import re
from .common import (
InfoExtractor,
SearchInfoExtractor
)
from ..compat import (
compat_HTTPError,
compat_kwargs,
compat_str,
compat_urlparse,
)
from ..utils import (
error_to_compat_str,
ExtractorError... | Orochimarufan/youtube-dl | youtube_dl/extractor/soundcloud.py | Python | unlicense | 29,898 | 0.001138 |
#! /usr/bin/env python
import os
import sys
from barf.barf import BARF
if __name__ == "__main__":
#
# Open file
#
try:
filename = os.path.abspath("../../samples/toy/arm/branch4")
barf = BARF(filename)
except Exception as err:
print err
print "[-] Error opening fil... | ignaeche/barf-project | barf/examples/arm/translate_smt.py | Python | bsd-2-clause | 1,055 | 0.000948 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from foo.hotel.models import Hotel
from foo.hotel.views import HotelLimitListView
from foo.hotel.views import HotelLimitNoOrderListView
urlp... | rodo/django-perf | foo/hotel/urls.py | Python | gpl-3.0 | 544 | 0.003676 |
# Copyright 2015 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 ag... | mikalstill/nova | nova/objects/migration_context.py | Python | apache-2.0 | 3,456 | 0.000289 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fruit', '0003_apple_size'),
('fruit', '0002_cranberry_bacon'),
]
operations = [
]
| donkirkby/djsquash | fruit/migrations/0100_prepare_squash.py | Python | mit | 274 | 0 |
from __future__ import (absolute_import, division, print_function)
from mantid.kernel import logger
import AbinsModules
import six
from mantid.kernel import Atom
class GeneralAbInitioProgramName(type):
def __str__(self):
return self.__name__
# noinspection PyMethodMayBeStatic
@six.add_metaclass(GeneralA... | ScreamingUdder/mantid | scripts/AbinsModules/GeneralAbInitioProgram.py | Python | gpl-3.0 | 10,789 | 0.00482 |
from datetime import date
import datetime
from django.contrib.auth.models import User
from django.test import TestCase
from pagetree.models import Hierarchy, Section, UserPageVisit
from pagetree.tests.factories import HierarchyFactory, ModuleFactory
from factories import SchoolGroupFactory
from nepi.main.models impor... | coati-00/nepi | nepi/main/tests/test_models.py | Python | gpl-2.0 | 11,699 | 0 |
"""
Restores the uplifted horizons while restricting slip along the fault to the
specified azimuth.
"""
import numpy as np
import matplotlib.pyplot as plt
from fault_kinematics.homogeneous_simple_shear import invert_slip
import data
import basic
def main():
azimuth = data.fault_strike + 90
# azimuth = 304 # Pl... | joferkington/oost_paper_code | invert_slip_fixed_azimuth.py | Python | mit | 966 | 0.003106 |
# Copyright (C) 2011 Statoil ASA, Norway.
#
# The file 'fortio.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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,... | Ensembles/ert | python/python/ert/ecl/fortio.py | Python | gpl-3.0 | 7,299 | 0.004384 |
from gi.repository import Gtk
class ChannelWindow:
def __init__(self, sources, client_thread):
self.sources = sources
self.client_thread = client_thread
self.changes = {}
self.widgets = {}
self.gtkwin = Gtk.Window()
self.gtkwin.set_position(Gtk.WindowPosition.CENTER)
self.gtkwin.set_default_size(320,... | krzotr/kismon | kismon/windows/channel.py | Python | bsd-3-clause | 3,856 | 0.038641 |
import gtk
import highgtk.entity
import highgtk.present.default.layout
def add (inquiry):
window = getattr (inquiry, "present_window", None)
if window is None:
inquiry.present_window = gtk.Dialog()
title = getattr (inquiry, "title", None)
if title is None:
root = highgtk.e... | zinnschlag/high-pygtk | highgtk/present/default/inquiry.py | Python | lgpl-3.0 | 2,487 | 0.018898 |
"""kaxabu URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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')
Class-base... | Taiwanese-Corpus/kaxabu-muwalak-misa-a-ahan-bizu | 後端/kaxabu/urls.py | Python | mit | 819 | 0 |
# -*- coding: utf-8 -*-
from uuid import uuid4
from gluon import current
def rlpcm_person_anonymize():
""" Rules to anonymize a case file """
auth = current.auth
s3db = current.s3db
ANONYMOUS = "-"
# Standard anonymizers
from s3db.pr import pr_address_anonymise as anonymous_address, \
... | flavour/eden | modules/templates/BRCMS/RLP/anonymize.py | Python | mit | 7,359 | 0.001223 |
from functools import reduce
from mahjong.constants import HONOR_INDICES, TERMINAL_INDICES
from mahjong.hand_calculating.yaku import Yaku
class Honroto(Yaku):
"""
All tiles are terminals or honours
"""
def __init__(self, yaku_id=None):
super(Honroto, self).__init__(yaku_id)
def set_attr... | MahjongRepository/mahjong | mahjong/hand_calculating/yaku_list/honroto.py | Python | mit | 679 | 0 |
'''Experimental!
This is an experimental module for converting ColumnTS into
dynts.timeseries. It requires dynts_.
.. _dynts: https://github.com/quantmind/dynts
'''
from collections import Mapping
from . import models as columnts
import numpy as ny
from dynts import timeseries, tsname
class ColumnT... | jbking/python-stdnet | stdnet/apps/columnts/npts.py | Python | bsd-3-clause | 1,723 | 0 |
import unittest
import datetime
import uuid
import sys
import json
import sys, os, os.path
root_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', '..')
if root_directory not in sys.path:
sys.path.append(root_directory)
from applicationinsights.channel.contracts import *
from ... | Microsoft/ApplicationInsights-Python | tests/applicationinsights_tests/channel_tests/contracts_tests/TestData.py | Python | mit | 1,545 | 0.006472 |
# -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import pypro
| 0x0AF/lamure | pypro/tests/context.py | Python | bsd-3-clause | 143 | 0.013986 |
from units import runner
import numpy as np
def job_gen():
for N in range(4, 21, 2):
for rate_power in [1, 3/2.]:
rate = np.power(N, rate_power)
test = {
'test': {},
'net': {'topology': 'grid', 'N': N},
'pattern': {'type': 'random_one... | efectivo/network_sim | grid1_basic.py | Python | mit | 755 | 0.006623 |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""Add missing constraints for vendors
Revision ID: 35e5344803b4
Revises: 27684... | prasannav7/ggrc-core | src/ggrc/migrations/versions/20151112145524_35e5344803b4_add_missing_constraints_for_vendors.py | Python | apache-2.0 | 783 | 0.003831 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.middleware.csrf import (
CSRF_KEY_LENGTH, CsrfViewMiddleware, get_token,
)
from django.template import RequestContext, Template
from django.... | jejimenez/django | tests/csrf_tests/tests.py | Python | bsd-3-clause | 19,350 | 0.000413 |
from scrapy.spiders import Spider
from scrapy.selector import Selector
from scrapy.http import HtmlResponse
from FIFAscrape.items import PlayerItem
from urlparse import urlparse, urljoin
from scrapy.http.request import Request
from scrapy.conf import settings
import random
import time
class fifaSpider(Spider... | HashirZahir/FIFA-Player-Ratings | FIFAscrape/spiders/fifa_spider.py | Python | mit | 3,458 | 0.014748 |
#!/usr/bin/env python2
from __future__ import division
import itertools
import math
import sys
import numpy
import scipy.stats
import cligraph
import utils
"""
TODO:
- Auto-detect number of bins
- Fixed width or variable width bins
- Stacked bins, overlapped bins or bins next to each other
- Change which side of bi... | bsmithers/CLIgraphs | histogram.py | Python | agpl-3.0 | 8,515 | 0.003641 |
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# 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... | chitr/neutron | neutron/agent/linux/keepalived.py | Python | apache-2.0 | 15,590 | 0 |
#!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
import sqlite3
def main():
print('connect')
db = sqlite3.connect('db-api.db')
cur = db.cursor()
print('create')
cur.execute("DROP TABLE IF EXISTS test")
cur.execute("""
CREATE TABLE test (
id INTEG... | ketan-analytics/learnpython | IntermediatePython/Lynda_Bill_PYEssential/SQL.py | Python | gpl-2.0 | 1,160 | 0.002586 |
#
# Copyright (C) 2009-2016 Nexedi SA
#
# 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.
#
# This program is distributed... | vpelletier/neoppod | neo/tests/zodb/testRecovery.py | Python | gpl-2.0 | 1,770 | 0.00226 |
import os
from tempfile import TemporaryDirectory
from pathlib import Path
from sqlalchemy import MetaData, create_engine
from cumulusci.tasks.salesforce import BaseSalesforceApiTask
from cumulusci.tasks.bulkdata import LoadData
from cumulusci.tasks.bulkdata.utils import generate_batches
from cumulusci.core.config im... | SalesforceFoundation/CumulusCI | cumulusci/tasks/bulkdata/generate_and_load_data.py | Python | bsd-3-clause | 8,766 | 0.00308 |
from __future__ import unicode_literals
from django.db.models import signals
from django.dispatch import receiver
from django.test import TestCase
from django.utils import six
from .models import Person, Car
# #8285: signals can be any callable
class PostDeleteHandler(object):
def __init__(self, data):
... | denisenkom/django | tests/signals/tests.py | Python | bsd-3-clause | 5,273 | 0.000759 |
#!/usr/bin/env python
import os
import sys
import time
path = 'gh-pages' if len(sys.argv) == 1 else sys.argv[1]
indexName = 'index.html'
template = """<html>
<head><title>large_image_wheels</title></head>
<body>
<h1>large_image_wheels</h1>
<pre>
%LINKS%
</pre>
</body>
"""
link = '<a href="%s" download="%s">%s</a>%s%s... | DigitalSlideArchive/large_image | .circleci/make_index.py | Python | apache-2.0 | 855 | 0 |
# -*- encoding: utf-8 -*-
from __future__ import division
import math
from FrameshiftSite import *
class FrameshiftSequence( object ):
def __init__( self, sequence, path ):
self.path = path
self.path_str = ",".join( map( str, [ a for a,b in path ]))
self.frameshifted_sequence, self.fragments, self.fragment_posi... | polarise/BioClasses | FrameshiftSequence.py | Python | gpl-2.0 | 4,907 | 0.057469 |
from os import listdir
from os.path import isfile, join
from Utilities.Text import Text
from Utilities.TermFrequencyInverseDocumentFrequency import TermFrequencyInverseDocumentFrequency as TFIDF
from sklearn import svm
from pprint import pprint
import numpy as np
from sklearn.decomposition import PCA
def main():
p... | ajkannan/Classics-Research | tf_idf_one_class_svm.py | Python | mit | 2,185 | 0.044394 |
from django.db.models import Prefetch, prefetch_related_objects
from django.test import TestCase
from .models import Author, Book, Reader
class PrefetchRelatedObjectsTests(TestCase):
"""
Since prefetch_related_objects() is just the inner part of
prefetch_related(), only do basic tests to ensure ... | yephper/django | tests/prefetch_related/test_prefetch_related_objects.py | Python | bsd-3-clause | 4,853 | 0.001648 |
#!/usr/bin/env python3
import functools
import struct
KEY_SIZE = 8
BLOCK_SIZE = 8
# yapf: disable
# Note the 1-based indexing in all the following tables.
IP = [
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17... | Qwaz/solved-hacking-problem | GoogleCTF/2018 Quals/dm_collision/not_des.py | Python | gpl-2.0 | 6,722 | 0.012348 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Chrome Cache files parser."""
import unittest
from plaso.parsers import chrome_cache
from tests.parsers import test_lib
class ChromeCacheParserTest(test_lib.ParserTestCase):
"""Tests for the Chrome Cache files parser."""
def testParse(self):
... | joachimmetz/plaso | tests/parsers/chrome_cache.py | Python | apache-2.0 | 1,283 | 0.002338 |
import abc
import datetime
import decimal
import functools
import json
import uuid
import pytz
import msgpack
import six
from lymph.utils import Undefined
@six.add_metaclass(abc.ABCMeta)
class ExtensionTypeSerializer(object):
@abc.abstractmethod
def serialize(self, obj):
raise NotImplementedError
... | itakouna/lymph | lymph/serializers/base.py | Python | apache-2.0 | 3,844 | 0.00026 |
from flask import Flask
# from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_object('config')
# db = SQLAlchemy(app)
from app import views #, models
| anbasile/donderskritikos | app/__init__.py | Python | apache-2.0 | 183 | 0.016393 |
# A comment, this is so you can read your program later.
# Anything after the # is ignored by python.
print "I could have code like this." # and the comment after is ignored
# You can also use a comment to "disable" or comment out a piece of code:
# print "This won't run."
print "This will run."
| ChucklesZeClown/learn-python | Exercises-learn-python-the-hard-way/ex2-comments-and-pound-characters.py | Python | apache-2.0 | 301 | 0 |
# --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2016 by Contributors
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Modified by Yuwen Xiong
# --------------------------------------------------------
impor... | dhzhd1/road_obj_detect | rfcn/core/loader.py | Python | apache-2.0 | 19,594 | 0.001735 |
import collections, unittest
from bibliopixel.colors import closest_colors
closest = closest_colors.closest_colors
class ClosestColorsTest(unittest.TestCase):
def exhaustive(self, metric, start=32, skip=64, report=4):
for color in closest_colors.all_colors(start, skip=skip):
cl = closest(col... | rec/BiblioPixel | test/bibliopixel/colors/closest_colors_test.py | Python | mit | 1,015 | 0.000985 |
# -*- coding: utf-8 -*-
"""This module implements a class that..."""
from __future__ import print_function, unicode_literals
import collections
import pprint
from npfl103.io.document import Document
__version__ = "0.0.1"
__author__ = "Jan Hajic jr."
class DocumentVectorizer:
"""The DocumentVectorizer class tra... | hajicj/FEL-NLP-IR_2016 | npfl103/io/vectorization.py | Python | apache-2.0 | 3,709 | 0.00027 |
# Generated from ChordLabel.g4 by ANTLR 4.7
from antlr4 import *
if __name__ is not None and "." in __name__:
from .ChordLabelParser import ChordLabelParser
else:
from ChordLabelParser import ChordLabelParser
# This class defines a complete listener for a parse tree produced by ChordLabelParser.
class ChordLab... | bzamecnik/chord-labels | chord_labels/parser/ChordLabelListener.py | Python | mit | 3,465 | 0.012987 |
import sys
def inputText():
input = sys.stdin.readline()
return input.strip()
def inputChoices(list, backcmd = "b", backtext = "back"):
repeat = True
while repeat:
repeat = False
count = 0
for item in list:
print count, "-", item
count += 1
print backcmd, "-", backtext
input = inputText()
if inp... | popazerty/beyonwiz-4.1 | tools/host_tools/FormatConverter/input.py | Python | gpl-2.0 | 432 | 0.060185 |
from production import IF, AND, OR, NOT, THEN, run_conditions
import production as lab
from tester import make_test, get_tests, type_encode, type_decode
from zookeeper import ZOOKEEPER_RULES
import random
random.seed()
try:
set()
except NameError:
from sets import Set as set, ImmutableSet as frozenset
### TES... | popuguy/mit-cs-6-034 | lab1/tests.py | Python | unlicense | 15,045 | 0.023862 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('app', '0025_auto_20150923_0843'),
]
operations = [
migrations.CreateMo... | XcomConvent/xcom40k-shades | xcom40k/app/migrations/0026_auto_20120106_2212.py | Python | apache-2.0 | 1,819 | 0.001649 |
#!/usr/local/bin/python3.4
# -*- coding: utf-8 -*-
import threading
import time
import sys
import trace
from inspect import isgeneratorfunction
import format
class KillableThread(threading.Thread):
"""A subclass of threading.Thread, with a kill() method provided by courtsey of Connelly Barnes."""
def __init_... | suut/psychic-happiness | async_core.py | Python | unlicense | 2,381 | 0.00126 |
"""Provide the WikiPage class."""
from ...const import API_PATH
from ...util.cache import cachedproperty
from ..listing.generator import ListingGenerator
from .base import RedditBase
from .redditor import Redditor
class WikiPage(RedditBase):
"""An individual WikiPage object.
**Typical Attributes**
This ... | leviroth/praw | praw/models/reddit/wikipage.py | Python | bsd-2-clause | 8,763 | 0 |
#! /usr/bin/env python
"""
Takes a single hit table file and generates a table (or tables) of
pathway/gene family assignments for the query sequences (aka 'reads').
Assignments can be for gene families, gene classes, or pathways. Multiple
pathway or classification levels can be given. If they are, an assignment
will be... | jmeppley/py-metagenomics | assign_paths.py | Python | mit | 10,699 | 0 |
#!/usr/bin/env python
"""
4c. Create a script that connects to both routers (pynet-rtr1 and pynet-rtr2)
and prints out both the MIB2 sysName and sysDescr.
"""
from snmp_helper import snmp_get_oid, snmp_extract
COMMUNITY_STRING = 'galileo'
SYS_DESCR = '1.3.6.1.2.1.1.1.0'
SYS_NAME = '1.3.6.1.2.1.1.5.0'
def m... | mudzi42/pynet_class | class2/my_snmp.py | Python | apache-2.0 | 747 | 0.004016 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This file is part of the prometeo project.
This program 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 Software Foundation, either version 3 of the License, or (at your
option... | zuck/prometeo-erp | core/menus/signals.py | Python | lgpl-3.0 | 1,904 | 0.004202 |
import requests
import os
print('\n***数据与算法 GitHub自动上传脚本***\n')
username = input('输入你在GitHub上的用户名,如 Robert Ying:')
email = input('输入你注册GitHub用的Email:')
print('\n开始配置Git...')
os.system('git config --global user.name "' + username + '"')
os.system('git config --global user.email ' + email)
print('\n你输入的信息如下:')
os.syst... | ee64/data-and-algorithms | upload.py | Python | mit | 3,932 | 0.003913 |
#!/usr/bin/env python2
import wx
import time
TRAY_TOOLTIP = 'Personal Legend'
TRAY_ICONS = {
'main': 'icon-main.png',
'c1': 'icon-1card.png',
'c2': 'icon-2cards.png',
'c3': 'icon-3cards.png',
'timer': 'icon-zero.png'
}
TRAY_TIMER = 30 * 60
def create_menu_item(menu, label, func):
item = wx.Me... | carlisson/legend | legend.py | Python | gpl-3.0 | 2,150 | 0.001395 |
"""Tests for the login flow."""
from . import async_setup_auth
from tests.async_mock import patch
from tests.common import CLIENT_ID, CLIENT_REDIRECT_URI
async def test_fetch_auth_providers(hass, aiohttp_client):
"""Test fetching auth providers."""
client = await async_setup_auth(hass, aiohttp_client)
re... | nkgilley/home-assistant | tests/components/auth/test_login_flow.py | Python | apache-2.0 | 3,442 | 0.000291 |
from django.core.management.base import BaseCommand
from explorer.models import Author, AuthorExternalResource, ExternalResource
import os
import csv
class Command(BaseCommand):
help = """Load data about external authority records for authors."""
def add_arguments(self, parser):
parser.add_argument... | erickpeirson/jhb-explorer | explorer/management/commands/loadauthorresources.py | Python | gpl-2.0 | 1,837 | 0.002722 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.