text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import inspect
import os
from functools import partial, wraps
from asgiref.local import Local
from django.template import Context, Template, TemplateSyntaxError
from django.test import SimpleTestCase, override_settings
from django.utils import translation
from django.utils.safestring import mark_safe
from django.util... | elena/django | tests/template_tests/syntax_tests/i18n/test_blocktranslate.py | Python | bsd-3-clause | 27,773 | 0.003497 |
# Copyright 2021 The TensorFlow 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 ... | tensorflow/similarity | tensorflow_similarity/retrieval_metrics/bndcg.py | Python | apache-2.0 | 5,659 | 0.00053 |
import matplotlib.pyplot as plt
from h5py import File
from numpy import array
def launch_plots(): # TODO set activation of different plots
plot3d = plt.figure('Plot 3D')
xy_plane = plt.figure('XY')
xz_plane = plt.figure('XZ')
yz_plane = plt.figure('YZ')
ax_plot3d = plot3d.add_subplot(111, project... | Neluso/SIFPAF | plot.py | Python | gpl-3.0 | 1,454 | 0 |
#!/usr/bin/env python
#
# Cloudlet Infrastructure for Mobile Computing
#
# Author: Kiryong Ha <krha@cmu.edu>
#
# Copyright (C) 2011-2013 Carnegie Mellon University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ob... | cmusatyalab/elijah-provisioning | elijah/provisioning/server.py | Python | apache-2.0 | 46,655 | 0.004758 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x, left = None, right = None):
self.val = x
self.left = left
self.right = right
class Solution(object):
"""
【思路】
1. 这里我们使用hashtable,而python中的dict就是hashtable... | pandaoknight/leetcode | sum_problem_dynamic_programming/two-sum-iv-input-is-a-bst/hash-table.py | Python | gpl-2.0 | 1,485 | 0.005506 |
from __future__ import unicode_literals
import datetime
import os
import subprocess
from django.utils.lru_cache import lru_cache
def get_version(version=None):
"Returns a PEP 386-compliant version number from VERSION."
version = get_complete_version(version)
# Now build the two parts of the version num... | simbha/mAngE-Gin | lib/django/utils/version.py | Python | mit | 2,279 | 0.000878 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
__all__ = [
'Initializer', 'Zeros', 'Ones', 'Constant', 'RandomUniform', 'RandomNormal', 'TruncatedNormal',
'deconv2d_bilinear_upsampling_initializer'
]
class Initializer(object):
"""Initializer base class: all initial... | zsdonghao/tensorlayer | tensorlayer/initializers.py | Python | apache-2.0 | 7,005 | 0.001999 |
# -*- coding:utf-8 -*-
"""
用户消息相关的视图
"""
from rest_framework import generics
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.filters import SearchFilter
from account.serializers.message... | codelieche/codelieche.com | apps/account/views/message.py | Python | mit | 3,318 | 0.000353 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re, os, time
# function: read and parse sensor data file
def read_sensor(path):
value = "U"
try:
f = open(path, "r")
line = f.readline()
if re.match(r"([0-9a-f]{2} ){9}: crc=[0-9a-f]{2} YES", line):
line = f.readline()
m = re.match(r"([0-9a-... | o-unity/lanio | old/lsrv/bin/getTemp.py | Python | gpl-2.0 | 977 | 0.022518 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-Screenshot',
'Author': ['@obscuresec', '@harmj0y'],
'Description': ('Takes a screenshot of the current desktop and '
'returns ... | pierce403/EmpirePanel | lib/modules/collection/screenshot.py | Python | bsd-3-clause | 3,876 | 0.015222 |
import time
from unittest import mock
import DNS
from django.conf import settings
from django.core.exceptions import ValidationError
from django.http import HttpResponse
from zerver.forms import email_is_not_mit_mailing_list
from zerver.lib.rate_limiter import (
RateLimitedUser,
RateLimiterLockingException,
... | brainwane/zulip | zerver/tests/test_external.py | Python | apache-2.0 | 5,500 | 0.003273 |
"""Provides all the generic data related to the personal information."""
from typing import Tuple
BLOOD_GROUPS = (
"O+",
"A+",
"B+",
"AB+",
"O−",
"A−",
"B−",
"AB−",
)
GENDER_SYMBOLS: Tuple[str, str, str] = (
"♂",
"♀",
"⚲",
)
USERNAMES = [
"aaa",
"aaron",
"aban... | lk-geimfari/elizabeth | mimesis/data/int/person.py | Python | mit | 140,388 | 0 |
import argparse
import mlflow
from ax.service.ax_client import AxClient
from iris import IrisClassification
from iris_data_module import IrisDataModule
import pytorch_lightning as pl
def train_evaluate(params, max_epochs=100):
model = IrisClassification(**params)
dm = IrisDataModule()
dm.setup(stage="fit"... | mlflow/mlflow | examples/pytorch/AxHyperOptimizationPTL/ax_hpo_iris.py | Python | apache-2.0 | 2,854 | 0.002803 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2017 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the righ... | alexforencich/python-ivi | ivi/anritsu/anritsuMN9610B.py | Python | mit | 7,432 | 0.005113 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django import forms
from djang... | shawnadelic/shuup | shuup/admin/modules/shops/views/edit.py | Python | agpl-3.0 | 4,592 | 0.001089 |
"""
These test cases can be used to test-drive a solution to the diamond kata, in an interative manner.
The idea is that you iterate towards a full solution, each test cycle you are closer to a full solution
than in the previous one. The thing with iterating is you may delete stuff that was there before,
or add stuff ... | emilybache/DiamondKata | python/test_diamond_centrist_iterative.py | Python | mit | 5,199 | 0.004039 |
# -*- coding: utf-8 -*-
import os
DEBUG = True
SECRET_KEY = '\x0f v\xa5!\xb8*\x14\xfeY[\xaf\x83\xd4}vv*\xfb\x85'
abs_path = os.path.abspath('app.db')
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + abs_path
# config for forms
CSRF_ENABLED = True
CSRF_SESSION_KEY = '\x0f v\xa5!\xb8*\x14\xfeY[\xaf\x83\xd4}vv*\xfb\x85'
UPLO... | coskundeniz/bitirme-projesi | config.py | Python | gpl-2.0 | 370 | 0 |
# Copyright (c) 2011 Intel Corporation
# Copyright (c) 2011 OpenStack Foundation
# 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.... | ge0rgi/cinder | cinder/scheduler/filter_scheduler.py | Python | apache-2.0 | 29,487 | 0 |
# Copyright (c) 2011-2013, ImageCat Inc.
#
# 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 Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is... | gem/sidd | ui/helper/ms_attr_delegate.py | Python | agpl-3.0 | 3,434 | 0.00728 |
"""
Copyright © 2017, Encode OSS Ltd. 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 of conditions and the following dis... | upsight/doctor | doctor/types.py | Python | mit | 33,198 | 0.000151 |
from setuptools import setup, find_packages
from dvc import VERSION
install_requires = [
"ply>=3.9", # See https://github.com/pyinstaller/pyinstaller/issues/1945
"configparser>=3.5.0",
"zc.lockfile>=1.2.1",
"future>=0.16.0",
"colorama>=0.3.9",
"configobj>=5.0.6",
"networkx>=2.1",
"pyy... | dataversioncontrol/dvc | setup.py | Python | apache-2.0 | 1,895 | 0 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'webinterface.view.dashboard.main'),
url(r'^dashboard/$', 'webinterface.view.dashboard.main'),
url(r'^login/$', 'webinterface.view.login.main'),
url(r'^login/ajax/$', 'webinterface.view.login.ajax'),
url(r'^s... | cynja/coffeenator | webinterface/urls.py | Python | gpl-3.0 | 551 | 0.00363 |
# Copyright 2020 - TODAY, Marcel Savegnago - Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class DocumentPage(models.Model):
_inherit = "document.page"
is_public = fields.Boolean(
"Public Page",
help="If true it allows any user of th... | OCA/knowledge | document_page_portal/models/document_page.py | Python | agpl-3.0 | 381 | 0 |
"""HTTP Headers constants."""
from .multidict import upstr
METH_ANY = upstr('*')
METH_CONNECT = upstr('CONNECT')
METH_HEAD = upstr('HEAD')
METH_GET = upstr('GET')
METH_DELETE = upstr('DELETE')
METH_OPTIONS = upstr('OPTIONS')
METH_PATCH = upstr('PATCH')
METH_POST = upstr('POST')
METH_PUT = upstr('PUT')
METH_TRACE = ups... | kehao95/Wechat_LearnHelper | src/env/lib/python3.5/site-packages/aiohttp/hdrs.py | Python | gpl-3.0 | 3,148 | 0 |
"""Test Customize config panel."""
import asyncio
import json
from unittest.mock import patch
from homeassistant.bootstrap import async_setup_component
from homeassistant.components import config
from homeassistant.config import DATA_CUSTOMIZE
@asyncio.coroutine
def test_get_entity(hass, aiohttp_client):
"""Test... | persandstrom/home-assistant | tests/components/config/test_customize.py | Python | apache-2.0 | 3,519 | 0 |
# -*- encoding: utf-8 -*-
"""Implements different locators for UI"""
from selenium.webdriver.common.by import By
from .model import LocatorDict
common_locators = LocatorDict({
# common locators
"body": (By.CSS_SELECTOR, "body"),
# Notifications
"notif.error": (
By.XPATH, "//div[contains(@c... | sghai/robottelo | robottelo/ui/locators/common.py | Python | gpl-3.0 | 9,297 | 0 |
#! /usr/bin/env python
# coding:utf-8
"""html tag attribute"""
from lib.data import BaseXssData
class Attribute(BaseXssData):
"""html tag attribute data"""
def __init__(self):
_data = [
'accesskey',
'class',
'contenteditable',
'contextmenu',
... | blue-bird1/xss_fuzz | data/attribute.py | Python | apache-2.0 | 636 | 0.001572 |
#!/usr/bin/python
import sqlite3
conn = sqlite3.connect('accesslist.db')
conn.execute('''CREATE TABLE USUARIO
(CELLPHONE CHAR(11) PRIMARY KEY NOT NULL,
PASSWD CHAR(138) NOT NULL);''')
print "Table created successfully";
conn.close()
| aepereyra/smslock | creatabla.py | Python | apache-2.0 | 264 | 0.003788 |
# 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, os, json
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.permissions import add_permission
... | tfroehlich82/erpnext | erpnext/regional/india/setup.py | Python | gpl-3.0 | 7,127 | 0.027641 |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
cl... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyKDE4/kdeui/KPassivePopupMessageHandler.py | Python | gpl-2.0 | 584 | 0.008562 |
# coding:utf-8
# 单向循环链表的相关操作:
# is_empty() 判断链表是否为空
# length() 返回链表的长度
# travel() 遍历
# add(item) 在头部添加一个节点
# append(item) 在尾部添加一个节点
# insert(pos, item) 在指定位置pos添加节点
# remove(item) 删除一个节点
# search(item) 查找节点是否存在
class Node(object):
"""节点"""
def __init__(self, item):
self.elem = item
self.next... | coderwjq/adt_python | 02-linked_list/04-single_cycle_linked_list.py | Python | apache-2.0 | 5,206 | 0.000222 |
'''
'''
def printgrid():
print("this will be a grid")
pos = 0
while pos < 11:
if pos % 5 == 0:
print("+----+----+")
pos += 1
else:
print("| | |")
pos += 1
else:
print()
printgrid()
| Baumelbi/IntroPython2016 | students/weidnem/session2/grid.py | Python | unlicense | 289 | 0.010381 |
from __future__ import absolute_import, unicode_literals
from .celery import app
@app.task
def add(x, y):
return x + y
@app.task
def mul(x, y):
return x * y
@app.task
def xsum(numbers):
return sum(numbers)
| ginolhac/tutorials | python/advanced/celery/code/ulhpccelery/tasks.py | Python | gpl-3.0 | 224 | 0 |
# This file is part of Coffee Notes project
#
# Coffee Notes is a crossplatform note-taking application
# inspired by Notational Velocity.
# <https://github.com/dmych/cn>
#
# Copyright (c) Dmitri Brechalov, 2011
#
# Coffee Notes is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | dmych/cn | sync.py | Python | gpl-3.0 | 3,222 | 0.034761 |
from module.plugins.Hoster import Hoster
from module.common.json_layer import json_loads
from module.network.HTTPRequest import BadHeader
class ReloadCc(Hoster):
__name__ = "ReloadCc"
__version__ = "0.5"
__type__ = "hoster"
__description__ = """Reload.Cc hoster plugin"""
# Since we want to allo... | Rusk85/pyload | module/plugins/hoster/ReloadCc.py | Python | gpl-3.0 | 4,866 | 0.003494 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
| alexston/calibre-webserver | src/calibre/devices/teclast/__init__.py | Python | gpl-3.0 | 237 | 0.008439 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import opal.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('opal', '0012_maritalst... | khchine5/opal | opal/migrations/0013_inpatientadmission.py | Python | agpl-3.0 | 1,852 | 0.0027 |
# -*- coding: utf-8 -*-
#
# lewis documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 9 16:42:53 2016.
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
# -- General configuration ------------------------------------------------
needs... | DMSC-Instrument-Data/plankton | docs/conf.py | Python | gpl-3.0 | 1,551 | 0.001934 |
from numpy import *
from cmlib import showMatr
A = matrix([[1, 2, 0],
[0, 2, 2]])
B = matrix([[3, -1],
[-1, 3],
[1, 0]])
res = (A * B).T
showMatr(array(res))
| FeodorM/amm_code | cm/lab_3/2_.py | Python | mit | 205 | 0 |
# Copyright (c) 2015 Cloudera, 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 applicable law o... | kapilrastogi/Impala | tests/util/parse_util.py | Python | apache-2.0 | 1,994 | 0.015045 |
# -*- 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 'UploadVideo'
db.create_table('upload_videos_uploadvideo',... | mjirayu/sit_academy | cms/djangoapps/upload_videos/migrations/0001_initial.py | Python | agpl-3.0 | 1,745 | 0.006877 |
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2013, 2014 Paul Tagliamonte <paultag@debian.org>
# Copyright (c) 2013 Julien Danjou <julien@danjou.info>
# Copyright (c) 2013 Nicolas Dandrimont <nicolas.dandrimont@crans.org>
# Copyright (c) 2013 James King <james@agentultra.com>
# Copyright (c) 2013, 2014 Bob Tolbert <bob@t... | algernon/hy | hy/compiler.py | Python | mit | 90,185 | 0 |
from __future__ import division
balance = 9999999
annualInterestRate = 0.18
min_pay = 10
def pay(m, min_pay):
if m == 1:
ub = (balance - min_pay) * (1 + annualInterestRate / 12)
return ub
else:
last_ub = pay(m - 1, min_pay)
ub = (last_ub - min_pay) * (1 + annualInterestRate / ... | fossilet/6.00x | week2/problemset2/ps2_2.py | Python | mit | 470 | 0.004255 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Avanzosc - Avanced Open Source Consulting
# Copyright (C) 2011 - 2014 Avanzosc <http://www.avanzosc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | mikelarre/odoomrp-wip-1 | product_last_purchase_sale_info/models/sale_order.py | Python | agpl-3.0 | 1,749 | 0 |
#!/usr/bin/python
import unittest
import logging
import common
from autotest.client import utils
class bogusVirshFailureException(unittest.TestCase.failureException):
def __init__(self, *args, **dargs):
self.virsh_args = args
self.virsh_dargs = dargs
def __str__(self):
msg = ("Code... | ypu/virt-test | virttest/virsh_unittest.py | Python | gpl-2.0 | 12,157 | 0.000082 |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Functional tests for ZFS filesystem implementation.
These tests require the ability to create a new ZFS storage pool (using
``zpool``) and the ability to interact with that pool (using ``zfs``).
Further coverage is provided in
:module:`flocker.volume.t... | jml/flocker | flocker/volume/functional/test_filesystems_zfs.py | Python | apache-2.0 | 19,664 | 0 |
# Copyright (C) 2015 Tobias Brink
#
# 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 your option) any later version.
#
# This program is distributed in ... | t-brink/pscic | psciclib/units.py | Python | gpl-3.0 | 1,401 | 0.002143 |
#!/usr/bin/env python
"""
simplepath.py
functions for digesting paths into a simple list structure
Copyright (C) 2005 Aaron Spike, aaron@ekips.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 Foundation; eit... | piyush-jain1/GSoC17OctaveGeometry | inst/io/@svg/simplepath.py | Python | gpl-3.0 | 6,961 | 0.0102 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/python-aiplatform | samples/snippets/model_service/get_model_evaluation_tabular_regression_sample_test.py | Python | apache-2.0 | 1,059 | 0 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | toomoresuch/pysonengine | parts/google_appengine/google/appengine/api/taskqueue/taskqueue.py | Python | mit | 33,902 | 0.006224 |
from setuptools import setup, find_packages
try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
import re, ast
# get version from __version__ variable in bench/__init__.py
_version_re = re.compile(r'__version__\s+=\... | bailabs/bench-v7 | setup.py | Python | gpl-3.0 | 963 | 0.015576 |
"""
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 use this ... | arenadata/ambari | ambari-server/src/main/resources/stacks/ADH/1.0/services/YARN/package/scripts/params_windows.py | Python | apache-2.0 | 2,998 | 0.005337 |
#!/usr/bin/python3
from os.path import expanduser
home = expanduser('~')
file_list = []
for i in range(2048):
with open(home + "/mount_hmfs/orphan_{:d}.txt".format(i), 'w') as file:
file_list.append(file)
file.write("ssssssssssssssssssss")
#hold files
while True:
pass
| timemath/hmfs | fs/hmfs/test/hold_file_open.py | Python | gpl-2.0 | 296 | 0.003378 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from calibre.gui2.actions import InterfaceAction
from calibre.gui2.dialogs.template_dialog import TemplateDialog
from cal... | ashang/calibre | src/calibre/gui2/actions/show_template_tester.py | Python | gpl-3.0 | 1,940 | 0.006701 |
#-*- coding: UTF-8 -*-
# Copyright (c) 2013, Patrick Uiterwijk <puiterwijk@gmail.com>
# 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 ... | puiterwijk/HttpCA | Signer/setup.py | Python | bsd-3-clause | 2,106 | 0.019468 |
def mathem(a,b):
a = a/2
b = b+10
print(a+b)
num1 = 100
num2 = 12
mathem(num1,num2)
print num1
print num2
def mathem2():
print(num1+num2)
mathem2()
print a
print b | janusnic/py-21v | scope/2.py | Python | mit | 188 | 0.047872 |
# Locking mechanism to ensure no two compilations occur simultaneously
# in the same compilation directory (which can cause crashes).
import atexit
import os
import socket # only used for gethostname()
import time
import logging
from contextlib import contextmanager
import numpy as np
from theano import config
fro... | nke001/attention-lvcsr | libs/Theano/theano/gof/compilelock.py | Python | mit | 14,977 | 0.000134 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Licen... | jameschch/Lean | Algorithm.Python/FutureOptionCallITMExpiryRegressionAlgorithm.py | Python | apache-2.0 | 6,809 | 0.006168 |
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import tkMessageBox
except ImportError:
from tkinter import messagebox as tkMessageBox
try:
import tkFileDialog
except ImportError:
from tkinter import filedialog as tkFileDialog
import os
from PIL import Image, ImageTk
... | prando/photoselector | photo.py | Python | mit | 11,323 | 0.012276 |
from django.contrib import admin
from blog.models import Post
class PostAdmin(admin.ModelAdmin):
#fields display on change list
list_display = ('title', 'description')
#fields to filter the change list with
list_filter = ('published', 'created')
#fields to search in change list
search_fields =... | luiseiherrera/jsmd | blog/admin.py | Python | gpl-3.0 | 653 | 0.01072 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class ibus(test.test):
"""
Autotest module for testing basic functionality
of ibus
@author Ramesh YR, rameshyr@linux.vnet.ibm.com ##
"""
version... | PoornimaNayak/autotest-client-tests | linux-tools/ibus/ibus.py | Python | gpl-2.0 | 1,230 | 0.004878 |
# __init__.py - collection of Swedish numbers
# coding: utf-8
#
# Copyright (C) 2012 Arthur de Jong
#
# This library 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 2.1 of the License, ... | arthurdejong/python-stdnum | stdnum/se/__init__.py | Python | lgpl-2.1 | 1,012 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
requests_cache.backends.base
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contains BaseCache class which can be used as in-memory cache backend or
extended to support persistence.
"""
from datetime import datetime
import hashlib
from copy import copy
from alp.request ... | gm2211/vpnAlfredWorkflow | src/alp/request/requests_cache/backends/base.py | Python | gpl-3.0 | 5,357 | 0.001307 |
[('GROUP', 10),
('UNITED STATES SENATOR', 8),
("''", 4),
# media outlet
('NEWS ORGANIZATION', 5),
('NEWSPAPER', 4),
('MAGAZINE', 3),
('TELEVISION SHOW', 2),
('NEWS WEBSITE', 1),
# media person
('BLOGGER, THE WASHINGTON POST', 1),
('ANCHOR, FOX NEWS', 1),
('FOX NEWS ANCHOR', 1),
("CONTRIBUTOR, 'THE VIEW'", 1... | philpot/trump-insult-haiku | nytorg.py | Python | apache-2.0 | 4,644 | 0.004091 |
# -*- coding: utf-8 -*-
#
# This file is part of LoL Server Status
#
# LoL Server Status 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
# any later version.
#
# LoL Server ... | LuqueDaniel/LoL-Server-Status | lol_server_status/gui/widgets/about.py | Python | gpl-3.0 | 2,800 | 0.003214 |
import django_filters
from django.utils.translation import gettext as _
from wagtail.admin.filters import WagtailFilterSet
from wagtail.admin.widgets import ButtonSelect
from wagtail.core.models import Site
class RedirectsReportFilterSet(WagtailFilterSet):
is_permanent = django_filters.ChoiceFilter(
labe... | rsalmaso/wagtail | wagtail/contrib/redirects/filters.py | Python | bsd-3-clause | 828 | 0 |
#!/usr/bin/env python
import argparse
import os
from pathlib import Path
import yaml
import ray
from ray.cluster_utils import Cluster
from ray.tune.config_parser import make_parser
from ray.tune.result import DEFAULT_RESULTS_DIR
from ray.tune.resources import resources_to_json
from ray.tune.tune import _make_schedule... | robertnishihara/ray | rllib/train.py | Python | apache-2.0 | 7,814 | 0 |
import cv2
import sys
#cascPath = sys.argv[1]
#faceCascade = cv2.CascadeClassifier(cascPath)
faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame, cv2... | papajijaat/Face-Detect | code/face_detect.py | Python | mit | 869 | 0.002301 |
# Copyright 2014 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 applicable law or agr... | askdaddy/PerfKitBenchmarker | perfkitbenchmarker/__init__.py | Python | apache-2.0 | 679 | 0 |
from flask import Flask, render_template, flash
from flask_material_lite import Material_Lite
from flask_appconfig import AppConfig
from flask_wtf import Form, RecaptchaField
from flask_wtf.file import FileField
from wtforms import TextField, HiddenField, ValidationError, RadioField,\
BooleanField, SubmitField, Int... | HellerCommaA/flask-material-lite | sample_application/__init__.py | Python | mit | 2,763 | 0.001448 |
from ray.rllib.utils.deprecation import deprecation_warning
from ray.rllib.utils.tf_utils import * # noqa
deprecation_warning(
old="ray.rllib.utils.tf_ops.[...]",
new="ray.rllib.utils.tf_utils.[...]",
error=True,
)
| ray-project/ray | rllib/utils/tf_ops.py | Python | apache-2.0 | 229 | 0 |
from django.forms import ModelForm
from .models import PakistaniPlace
class PakistaniPlaceForm(ModelForm):
""" Form for storing a Pakistani place. """
class Meta:
model = PakistaniPlace
fields = ('state', 'state_required', 'state_default', 'postcode', 'postcode_required', 'postcode_default',
... | infoxchange/django-localflavor | tests/test_pk/forms.py | Python | bsd-3-clause | 355 | 0.002817 |
from django.shortcuts import render, HttpResponseRedirect, redirect
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import CreateView
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from django.forms.models import inlineformset_... | MrCrawdaddy/humans | profiles/views.py | Python | mit | 2,056 | 0.002918 |
"""SCons.Tool.yacc
Tool-specific initialization for yacc.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, ... | EmanueleCannizzaro/scons | src/engine/SCons/Tool/yacc.py | Python | mit | 4,613 | 0.003685 |
"""Test values to test read_all_variables methods.
Used by test in controller and model modulesself.
"""
# TODO: change string format return from serial
values = [
8579, 6.7230000495910645, 6.7230000495910645,
[b'V', b'0', b'.', b'0', b'7', b' ', b'2', b'0', b'1', b'8', b'-', b'0', b'3',
b'-', b'2', b'6',... | lnls-sirius/dev-packages | siriuspy/tests/pwrsupply/variables.py | Python | gpl-3.0 | 3,146 | 0.000638 |
"""
Django settings for geotest project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | johnwoltman/geotest | geotest/settings.py | Python | mit | 2,023 | 0 |
# -*- 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 field 'ExecutionCommandServer.celery_task_id'
db.add_column(u'ta... | gunnery/gunnery | gunnery/task/migrations/0002_auto__add_field_executioncommandserver_celery_task_id.py | Python | apache-2.0 | 12,042 | 0.007806 |
# Create your views here.
from django.contrib.syndication.views import Feed
from q4wine.news.models import News
from django.utils.feedgenerator import Atom1Feed
import string
class RssSiteNewsFeed(Feed):
title = "News related to q4wine development stuff and its community life."
link = "/rss/"
description ... | brezerk/q4wine-web | rss/views.py | Python | gpl-3.0 | 1,075 | 0.005581 |
# -*- coding: utf-8 -*-
"""Test gui."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import logging
import os
import shutil
from ..state import GUIState, _gui_state_path, _get_default_state_p... | kwikteam/phy | phy/gui/tests/test_state.py | Python | bsd-3-clause | 2,810 | 0.001423 |
# -*- coding: utf8 -*-
from .player import PlayerEntity
from .base import MobEntity
from .item import ItemEntity
__all__ = [
'PlayerEntity',
'MobEntity',
'ItemEntity',
] | nosix/PyCraft | src/pycraft/service/composite/entity/__init__.py | Python | lgpl-3.0 | 188 | 0.005319 |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... | geky/pyOCD | pyOCD/flash/flash_kl28z.py | Python | apache-2.0 | 6,139 | 0.018081 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2018 OSGeo
#
# 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 ... | francbartoli/geonode | geonode/maps/management/commands/remove_broken_layers.py | Python | gpl-3.0 | 1,375 | 0 |
"""
Test case for iperf example.
This test case might have problem running on windows:
1. direct use of `make`
2. use `sudo killall iperf` to force kill iperf, didn't implement windows version
The test env Example_ShieldBox do need the following config::
Example_ShieldBox:
ap_list:
- ssid: "ssid"
... | mashaoze/esp-idf | examples/wifi/iperf/iperf_test.py | Python | apache-2.0 | 26,855 | 0.002495 |
"""
Provided code for Application portion of Module 1
Imports physics citation graph
"""
###################################
# Code for loading citation graph
CITATION_URL = "phys-cite_graph.txt"
def load_graph(graph_url):
"""
Function that loads a graph given the URL
for a text representation of the gr... | tsh/coursera-algorithmic-thinking | Week 1/graph_loader.py | Python | apache-2.0 | 908 | 0.005507 |
import detectlanguage
def detect(data):
result = detectlanguage.client.post('detect', { 'q': data })
return result['data']['detections']
def simple_detect(data):
result = detect(data)
return result[0]['language']
def user_status():
return detectlanguage.client.get('user/status')
def languages():
return detect... | detectlanguage/detectlanguage-python | detectlanguage/api.py | Python | mit | 353 | 0.033994 |
class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: Set[str]
:rtype: List[str]
"""
return self.helper(s, wordDict, {})
def helper(self, s, wordDict, memo):
if s in memo: return memo[s]
if not s: return []
... | stuti-rastogi/leetcodesolutions | 140_wordBreak2.py | Python | apache-2.0 | 760 | 0.003947 |
# -*- coding: UTF-8 -*-
#!/usr/bin/env python
# ############################################################################
# ########## Libraries #############
# ##################################
# Standard library
import logging
from os import path
# 3rd party modules
import arrow
from isogeo_pysdk import Isogeo
... | Guts/isogeo-notifier | web/isogeo_notify/management/commands/api2db.py | Python | gpl-3.0 | 2,944 | 0.001359 |
# -*- coding: utf-8 -*-
out = open('wil_orig.words.out', 'w')
for line in open('wil_orig_utf8_slp1.txt').xreadlines():
line = line.strip()
if ".{#" in line:
word = line.split('{#')[1].split('#}')[0].split(' ')[0].split('(')[0].split(',')[0].split('.')[0].split('/')[0].split('\\')[0].split('-')[0].split('{')[0]... | sanskritiitd/sanskrit | dictionary/sanskrit-english/wil.py | Python | gpl-3.0 | 442 | 0.025 |
import ChromaPy32 as Chroma # Import the Chroma Module
from time import sleep
Mouse = Chroma.Mouse() # Initialize a new Mouse Instance
RED = (255, 0, 0) # Initialize a new color by RGB (RED,GREEN,BLUE)
Mouse.setColor(RED) # sets the whole Mouse-Grid to RED
Mouse.applyGrid() # applies the Mouse-Grid to the conn... | Vaypron/ChromaPy | Example Scripts/Mouse/1. setColor.py | Python | mit | 342 | 0 |
#!/usr/bin/env python3
"""
Testing Client for flasktex.
"""
__license__ = 'BSD-3'
__docformat__ = 'reStructuredText'
import os
import urllib.request
def ft_checkalive(url:str):
"""
Check whether given server is alive.
"""
resp = None
try:
resp = urllib.request.urlopen(url+'/ping').read... | hosiet/flasktex | src/client.py | Python | bsd-3-clause | 2,633 | 0.002659 |
from unittest import TestCase, main
from datetime import datetime
from future.utils import viewitems
from qiita_core.exceptions import IncompetentQiitaDeveloperError
from qiita_core.util import qiita_test_checker
from qiita_db.base import QiitaObject
from qiita_db.study import Study, StudyPerson
from qiita_db.investi... | RNAer/qiita | qiita_db/test/test_study.py | Python | bsd-3-clause | 28,241 | 0 |
import sublime, sublime_plugin
class RunOnSave(sublime_plugin.EventListener):
def on_post_save(self, view):
# Check if project has run-on-save enabled.
settings = view.settings()
if settings.get('run_on_save') == 1:
command = settings.get('command')
if command is not None:
option_d... | chrishadi/SublimeRunOnSave | runonsave.py | Python | mit | 830 | 0.015663 |
__author__ = 'Lorenzo'
planet_mapper = {
'<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>': 'planet type', # link to yago category, can be explored more
'<http://live.dbpedia.org/ontology/wikiPageExternalLink>': 'external link', # many
'<http://live.dbpedia.org/property/inclination>': 'inclination', ... | pincopallino93/rdfendpoints | parser/dbpediamap.py | Python | apache-2.0 | 2,410 | 0.007054 |
from setuptools import setup
setup(name='pimad',
version=open('VERSION').read(),
description='Pimad is modeling adaptive dynamics',
url='http://www.eleves.ens.fr/home/doulcier/projects/celladhesion/',
author='Guilhem Doulcier',
long_description=open('README').read(),
author_email='g... | geeklhem/pimad | setup.py | Python | gpl-3.0 | 504 | 0.001984 |
import logging
from couchdbkit import ResourceNotFound
from couchdbkit.ext.django.loading import get_db
from django.http import (
HttpResponseBadRequest,
HttpResponseForbidden,
)
from casexml.apps.case.xform import get_case_updates, is_device_report
from corehq.apps.domain.decorators import (
check_domain_m... | qedsoftware/commcare-hq | corehq/apps/receiverwrapper/views.py | Python | bsd-3-clause | 7,843 | 0.001275 |
# coding=utf-8
# Copyright 2022 The ML Fairness Gym 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 applicab... | google/ml-fairness-gym | runner.py | Python | apache-2.0 | 1,900 | 0.003684 |
# Migrating some useful EE utils from https://code.earthengine.google.com/?accept_repo=users/gena/packages
| gena/qgis-earthengine-plugin | contrib/__init__.py | Python | mit | 108 | 0.018519 |
# -*- coding: iso-8859-1 -*-
"""A lexical analyzer class for simple shell-like syntaxes."""
from __future__ import print_function
# Module and documentation by Eric S. Raymond, 21 Dec 1998
# Input stacking and error message cleanup added by ESR, March 2000
# push_source() and pop_source() made explicit by ESR, January... | looooo/pivy | scons/scons-local-1.2.0.d20090919/SCons/compat/_scons_shlex.py | Python | isc | 11,866 | 0.001517 |
#!/usr/bin/python
"""
This is a simple plugin that does the same deal as the l2t_find_evil.py script does.
It loads up a YARA rule file and runs it against each line in the CSV file and if there
is a match it will fire up an alert.
Copyright 2012 Kristinn Gudjonsson (kristinn ( a t ) log2timeline (d o t) net)
This fi... | kiddinn/l2t-tools | plugins/yara_match.py | Python | gpl-3.0 | 3,103 | 0.003867 |
"""
A python neural network package based on gnumpy.
Yujia Li, 09/2014
TODO:
- right now YNeuralNet I/O only supports NeuralNet as the type for component
nets (network construction and forward/backward prop works for other types
of component nets just fine). Ideally this should be extended to
StackedNeuralNet ... | yujiali/pynn | pynn/nn.py | Python | mit | 20,622 | 0.003831 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.