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 |
|---|---|---|---|---|---|---|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Mega-DatA-Lab/mxnet | tests/python/unittest/test_metric.py | Python | apache-2.0 | 1,757 | 0.002277 |
import asyncio
import inspect
import logging
from typing import List, Tuple, Callable, NamedTuple
from lightbus.schema.schema import Parameter
from lightbus.message import EventMessage
from lightbus.client.subclients.base import BaseSubClient
from lightbus.client.utilities import validate_event_or_rpc_name, queue_exce... | adamcharnock/lightbus | lightbus/client/subclients/event.py | Python | apache-2.0 | 12,494 | 0.003764 |
def extractShibbsdenCom(item):
'''
Parser for 'shibbsden.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('GOOD CHILD', 'Reborn as a Good Child', 'translated'),
(... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractShibbsdenCom.py | Python | bsd-3-clause | 714 | 0.029412 |
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("projects", "doctype", "project")
frappe.db.sql("""
update `tabProject` p
set total_sales_amount = ifnull((select sum(base_grand_total)
from `tabSales Order` where project=p.name and docstatus=1), 0)
""") | ovresko/erpnext | erpnext/patches/v8_0/update_sales_cost_in_project.py | Python | gpl-3.0 | 303 | 0.026403 |
import logging
from django.utils.html import format_html
import django_tables2 as tables
from django_tables2.rows import BoundPinnedRow, BoundRow
logger = logging.getLogger(__name__)
# A cheat to force BoundPinnedRows to use the same rendering as BoundRows
# otherwise links don't work
# BoundPinnedRow._get_and_ren... | sdolemelipone/django-crypsis | crypsis/tables.py | Python | gpl-3.0 | 4,778 | 0.000209 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QAD Quantum Aided Design plugin ok
classe per gestire il map tool in ambito del comando array
-------------------
begin : 2016-05-31
copyrig... | gam17/QAD | cmd/qad_array_maptool.py | Python | gpl-3.0 | 9,990 | 0.020048 |
from django.conf import settings
from django.utils import timezone
from rest_framework import authentication
from rest_framework import exceptions
import datetime
import jwt
from .models import User
def generate_jwt(user):
payload = {
'user': user.pk,
'exp': timezone.now() + datetime.timedelta... | Jwpe/alexandria-server | alexandria_server/permissions/authentication.py | Python | mit | 2,060 | 0.000485 |
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2010 Tampere University of Technology
#
# 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 r... | tema-mbt/tema-adapterlib | adapterlib/ToolProtocolHTTP.py | Python | mit | 8,508 | 0.012459 |
# encoding: utf-8
# module samba.dcerpc.drsuapi
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/drsuapi.so
# by generator 1.135
""" drsuapi DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class DsReplicaObjMetaData2Ctr(__talloc.Object):
# no doc
def __init__(self, *args, **kwar... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/drsuapi/DsReplicaObjMetaData2Ctr.py | Python | gpl-2.0 | 880 | 0.007955 |
'd'
def x():
print j
j = 0
def y():
for x in []:
print x
| lavjain/incubator-hawq | tools/bin/pythonSrc/pychecker-0.8.18/test_input/test33.py | Python | apache-2.0 | 80 | 0.0375 |
# Copyright 2019 The Sonnet Authors. 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 l... | deepmind/sonnet | sonnet/src/scale_gradient.py | Python | apache-2.0 | 1,288 | 0.002329 |
##
## This copyrighted software is distributed under the GPL v2.0 license.
## See the LICENSE file for more details.
##
## Yeast workspace configuration file
import numpy as np
import WorkspaceModules.YeastApplicatorPlate
import WorkspaceModules.YeastArena
import WorkspaceModules.YeastArena3x3
YeastWorkspace = { 'b... | FlySorterLLC/SantaFeControlSoftware | Examples/ExampleYeastWorkspace.py | Python | gpl-2.0 | 585 | 0.018803 |
"""
Student Views
"""
import datetime
import logging
import uuid
import time
import json
import warnings
from collections import defaultdict
from pytz import UTC
from ipware.ip import get_ip
from django.conf import settings
from django.contrib.auth import logout, authenticate, login
from django.contrib.auth.models imp... | kamalx/edx-platform | common/djangoapps/student/views.py | Python | agpl-3.0 | 88,916 | 0.002553 |
# Copyright Microsoft 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | hglkrijger/WALinuxAgent | tests/ga/test_remoteaccess.py | Python | apache-2.0 | 5,846 | 0.005132 |
# coding: utf-8
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django import forms
from lib.l10n_utils.dotlang import _, _lazy
from bedrock.mozorg.forms import... | mmmavis/lightbeam-bedrock-website | bedrock/legal/forms.py | Python | mpl-2.0 | 4,294 | 0.000699 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 Lice... | nomaro/SickBeard_Backup | sickbeard/webserve.py | Python | gpl-3.0 | 155,575 | 0.006421 |
# coding: utf-8
# Copyright (c) 2015 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE file)
from kivy.uix.label import Label
from gravur.utils import load_widget
@load_widget
class LabelBox(Label):
pass
| F483/gravur | gravur/common/labelbox.py | Python | mit | 232 | 0 |
# Copyright (c) 2015 Tanium Inc
#
# Generated from console.wsdl version 0.0.1
#
#
from .base import BaseType
class SavedActionApproval(BaseType):
_soap_tag = 'saved_action_approval'
def __init__(self):
BaseType.__init__(
self,
simple_properties={'id': int,
... | tanium/pytan | lib/taniumpy/object_types/saved_action_approval.py | Python | mit | 654 | 0.009174 |
import re
import logging
from indra.resources import load_resource_json
logger = logging.getLogger(__name__)
identifiers_url = 'https://identifiers.org'
# These are just special cases of name spaces where the mapping from INDRA to
# identifiers.org is not a question of simplecapitalization.
identifiers_mappings = ... | johnbachman/indra | indra/databases/identifiers.py | Python | bsd-2-clause | 11,854 | 0 |
if x() and y() and z():
a()
else:
b()
| bronikkk/tirpan | tests/test_mir04.py | Python | gpl-3.0 | 46 | 0 |
def action_comment_load_more(context, action, entity_type, entity_id, last_id, parent_id, **args):
try:
entity = IN.entitier.load_single(entity_type, int(entity_id))
if not entity:
return
output = Object()
db = IN.db
connection = db.connection
container_id = IN.commenter.get_container_id(entity)... | vinoth3v/In | In/comment/page/load_more.py | Python | apache-2.0 | 2,050 | 0.054634 |
from couchpotato import get_session
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.request import jsonified, getParams
from couchpotato.core.helpers.variable import mergeDicts, md5, getExt
from couc... | jayme-github/CouchPotatoServer | couchpotato/core/plugins/quality/main.py | Python | gpl-3.0 | 8,674 | 0.007033 |
#coding:utf-8
import numpy as np
from chainer import Variable, FunctionSet
import chainer.functions as F
class LSTM(FunctionSet):
def __init__(self,f_n_units, n_units):
super(LSTM, self).__init__(
l1_x = F.Linear(f_n_units, 4*n_units),
l1_h = F.Linear(n_units, 4*n_units),
... | wbap/Hackathon2015 | Nishida/WBAI_open_code/lstm/lstm.py | Python | apache-2.0 | 1,640 | 0.028571 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | DG-i/openshift-ansible | roles/lib_openshift/library/oc_adm_registry.py | Python | apache-2.0 | 94,103 | 0.001551 |
### Copyright (C) 2002-2006 Stephen Kennedy <stevek@gnome.org>
### Copyright (C) 2010-2012 Kai Willadsen <kai.willadsen@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 v... | pedrox/meld | meld/vcview.py | Python | gpl-2.0 | 35,046 | 0.005364 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-#
# 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... | googlefonts/nototools | nototools/unicode_data.py | Python | apache-2.0 | 57,418 | 0.000871 |
import unittest
import os
import numpy as np
import math
from tables import IsDescription, Int32Col, Float32Col
from pymicro.core.samples import SampleData
from BasicTools.Containers.ConstantRectilinearMesh import ConstantRectilinearMesh
import BasicTools.Containers.UnstructuredMeshCreationTools as UMCT
from config imp... | heprom/pymicro | pymicro/core/tests/test_samples.py | Python | mit | 19,023 | 0.00021 |
import json
import logging
import httplib
import urllib2
from django.core.exceptions import ValidationError
from django.conf import settings
siaUrl=settings.SIA_URL
import re
import string
def sanitize_search_term(term):
# Replace all puncuation with spaces.
allowed_punctuation = set(['&', '|', '"', "'"])
... | xyos/horarios | horarios/helpers.py | Python | mit | 5,854 | 0.005296 |
# Copyright 2007 Matt Chaput. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the... | mozilla/popcorn_maker | vendor-local/lib/python/whoosh/filedb/filewriting.py | Python | bsd-3-clause | 21,271 | 0.000705 |
import sublime
import unittest
import os
import sys
class TestImport(unittest.TestCase):
mpath = None
@classmethod
def setUpClass(cls):
basedir = os.path.dirname(__file__)
mpath = os.path.normpath(os.path.join(
basedir, "..", "st3_{}_{}".format(sublime.platform(), sublime.arc... | dmilith/SublimeText3-dmilith | Packages/Debugger/modules/libs/pywinpty/tests/test_import.py | Python | mit | 909 | 0.0011 |
#!/usr/bin/env python
#
# Copyright 2011 Splunk, 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 ... | rmak/splunk-sdk-python | examples/handlers/handler_urllib2.py | Python | apache-2.0 | 1,492 | 0.002681 |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
"""Tests for reportlab.lib.utils
"""
__version__=''' $Id$ '''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, printLocation
setOutDir(__name__)
import os, time, sys
import reportlab
import unittest
from reportlab.lib impo... | kanarelo/reportlab | tests/test_lib_utils.py | Python | bsd-3-clause | 5,924 | 0.006752 |
# ############################################################################
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business i... | uclouvain/OSIS-Louvain | features/steps/utils/pages.py | Python | agpl-3.0 | 3,065 | 0.000326 |
# -*- coding: utf-8 -*-
#
# tm1640-rpi documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 12 19:52:17 2013.
#
# 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.
#
# ... | micolous/tm1640-rpi | doc/source/conf.py | Python | gpl-3.0 | 8,144 | 0.007859 |
# encoding: utf-8
import json
import time
from kubectl_data import *
from kubectl_ports import *
from kubectl_wrapper import *
TMP_FILEPATH = '/tmp/'
def create_tmp_json(data, service_path):
with open(service_path, 'w') as out:
json.dump(data, out, indent=2)
def sub_start(service_name, data, kube_type):
fil... | snipsco/teleport | src/kubeconfig/kubectl_actions.py | Python | mit | 2,287 | 0.020988 |
"""
Configuration for bookmarks Django app
"""
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from edx_django_utils.plugins import PluginSettings, PluginURLs
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
class BookmarksConfig(AppConfig):
... | eduNEXT/edunext-platform | openedx/core/djangoapps/bookmarks/apps.py | Python | agpl-3.0 | 1,146 | 0.001745 |
import logging
from pylons import config, request, response, session, tmpl_context as c
from pylons.controllers.util import abort
from fmod.lib.base import BaseController, render
from fmod import model
from sqlalchemy import desc
log = logging.getLogger(__name__)
from hashlib import md5
import time, datetime
#usef... | wiredfool/fmod | fmod/controllers/ping.py | Python | gpl-2.0 | 5,311 | 0.046131 |
from api import ServerError,NoAccessError,SimpleTax
| SimpleTax/python-simpletax | simpletax/__init__.py | Python | bsd-3-clause | 52 | 0.038462 |
# !/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
ERP+
"""
__author__ = 'CVtek dev'
__credits__ = []
__version__ = "1.0"
__maintainer__ = "CVTek dev"
__status__ = "Development"
__model_name__ = 'sr_crianca.SRCrianca'
import auth, base_models
from orm import *
from form import *
class SRCrianca(Model, View):
def... | IdeaSolutionsOnline/ERP4R | core/objs/sr_crianca.py | Python | mit | 3,036 | 0.044069 |
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Free University
# Berlin, 14195 Berlin, Germany.
# 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 ... | arokem/PyEMMA | pyemma/coordinates/tests/test_numpyfilereader.py | Python | bsd-2-clause | 5,975 | 0.002343 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-03 08:56
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | DomDomPow/snapventure | snapventure-backend/snapventure/migrations/0005_auto_20161103_0856.py | Python | gpl-3.0 | 1,892 | 0.003171 |
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge... | stonekyx/binary | vendor/scons-local-2.3.4/SCons/Scanner/Dir.py | Python | gpl-3.0 | 3,751 | 0.002399 |
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, mer... | MSEMJEJME/ReAlistair | renpy/lint.py | Python | gpl-2.0 | 13,359 | 0.007411 |
# Copyright 2014 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, s... | tseaver/google-cloud-python | datastore/google/cloud/datastore/batch.py | Python | apache-2.0 | 12,054 | 0.000166 |
# NEVER DO THIS IN SQL!
from Repository.Loader import Loader, LoaderException
from Domain import Grade, Student, Discipline
import sqlite3
class SQLLoader(Loader):
def __init__(self, repo):
self.repo = repo
self.conn = sqlite3.connect(self.repo.getStoragePath() + ".sqlite")
self.cursor = s... | Zephyrrus/ubb | YEAR 1/SEM1/FP/LAB/l6-l9/Repository/SQLLoader.py | Python | mit | 2,336 | 0.003853 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2015- Serge Noiraud
#
# 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 opti... | gramps-project/gramps | gramps/gen/utils/symbols.py | Python | gpl-2.0 | 7,831 | 0.001022 |
import sys
sys.path.insert(0, "../")
import unittest
from dip.typesystem import DNull, DBool, DInteger, DString, DList
from dip.compiler import BytecodeCompiler
from dip.interpreter import VirtualMachine
from dip.namespace import Namespace
class TestInterpreter(unittest.TestCase):
def _execute_simple(... | juddc/Dipper | dip/tests/test_interpreter.py | Python | mit | 5,801 | 0.001896 |
from __future__ import absolute_import
import re
from django import forms
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from uuid import... | jean/sentry | src/sentry/web/frontend/project_settings.py | Python | bsd-3-clause | 12,517 | 0.001997 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1_generated_tensorboard_service_read_tensorboard_blob_data_sync.py | Python | apache-2.0 | 1,581 | 0.001265 |
import os
import re
from . import core
@core.rule
def executable(
name, sources=None, include=None, define=None, flags=None, links=None,
compiler=None, warnings_are_errors=False, scan=True, debug=True,
objects=None, linkflags=None
):
if compiler is None:
compiler, toolchain = _get_default_com... | jachris/cook | cook/cpp.py | Python | mit | 18,097 | 0 |
from scrapy.contrib.exporter import CsvItemExporter
from scrapy.conf import settings
class SlybotCSVItemExporter(CsvItemExporter):
def __init__(self, *args, **kwargs):
kwargs['fields_to_export'] = settings.getlist('CSV_EXPORT_FIELDS') or None
super(SlybotCSVItemExporter, self).__init__(*args, **kwa... | lodow/portia-proxy | slybot/slybot/exporter.py | Python | bsd-3-clause | 325 | 0.006154 |
#!/usr/bin/env python2.7
import sys
for line in open(sys.argv[1]):
cut=line.split('\t')
if len(cut)<11: continue
print ">"+cut[0]
print cut[9]
print "+"
print cut[10]
| ursky/metaWRAP | bin/metawrap-scripts/sam_to_fastq.py | Python | mit | 173 | 0.052023 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Stardust Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test spending coinbase transactions.
# The coinbase transaction in block N can appear in block
# N+1... | ctwiz/stardust | qa/rpc-tests/mempool_spendcoinbase.py | Python | mit | 2,474 | 0.005659 |
import unittest
from unittest.mock import patch
from app.main.service import GitHubUserService
@patch("app.main.service.github")
class TestGitHubUserService(unittest.TestCase):
def setUp(self):
self.test_user = "test"
self.retrieved_repos_return = [
{
"fork": False,
... | darylmathison/github-user-queries | tests/main/test_service.py | Python | gpl-3.0 | 7,359 | 0.001495 |
import _plotly_utils.basevalidators
class BgcolorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="bgcolorsrc", parent_name="histogram.marker.pattern", **kwargs
):
super(BgcolorsrcValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram/marker/pattern/_bgcolorsrc.py | Python | mit | 433 | 0.002309 |
# -*- coding: utf-8 -*-
#
# sympa documentation build configuration file, created by
# sphinx-quickstart on Mon Aug 25 18:11:49 2014.
#
# 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... | unistra/django-sympa | docs/conf.py | Python | gpl-2.0 | 8,528 | 0.00598 |
from distutils.core import setup
setup(
# Application name:
name="streaker",
# Version number (initial):
version="0.0.1",
# Application author details:
author="Aldi Alimucaj",
author_email="aldi.alimucaj@gmail.com",
# Packages
packages=["streaker"],
scripts=['bin/streaker'],... | aldialimucaj/Streaker | setup.py | Python | mit | 680 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# document_csv module for OpenERP, Import structure in CSV
# Copyright (C) 2011 SYLEAM (<http://www.syleam.fr/>)
# Christophe CHAUVET <christophe.chauvet@syleam.fr>
# Copyright (C) 2011 Camptoc... | syleam/document_csv | wizard/launch.py | Python | gpl-3.0 | 3,320 | 0.002711 |
from sklearn.cluster import MiniBatchKMeans
import numpy as np
import json
import os
from texta.settings import MODELS_DIR
class WordCluster(object):
"""
WordCluster object to cluster Word2Vec vectors using MiniBatchKMeans.
: param embedding : Word2Vec object
: param n_clusters, int, number of cluster... | texta-tk/texta | utils/word_cluster.py | Python | gpl-3.0 | 2,505 | 0.007186 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import sys
import zipfile
from pyload.plugin.Extractor import Extractor, ArchiveError, CRCError, PasswordError
from pyload.utils import fs_encode
class UnZip(Extractor):
__name = "UnZip"
__type = "extractor"
__version = "1.12... | ardi69/pyload-0.4.10 | pyload/plugin/extractor/UnZip.py | Python | gpl-3.0 | 1,891 | 0.00899 |
# https://leetcode.com/problems/linked-list-cycle-ii/
from ListNode import ListNode
class Solution(object):
def detectCycle(self, head):
slow,fast = head,head
while True:
if fast == None or fast.next == None : return None
slow = slow.next
fast = fast.next.next
... | menghanY/LeetCode-Python | LinkedList/LinkedListCycleII.py | Python | mit | 474 | 0.018987 |
from pycse.lisp import *
def test_symbol():
assert Symbol('setf').lisp == 'setf'
def test_quote():
assert Quote('setf').lisp == "'setf"
def test_sharpquote():
assert SharpQuote('setf').lisp == "#'setf"
def test_cons():
assert Cons('a', 3).lisp == '("a" . 3)'
def test_Alist():
assert Alist(["a",... | jkitchin/pycse | pycse/tests/test_lisp.py | Python | gpl-2.0 | 720 | 0.013889 |
from django.conf.urls.defaults import *
from tastypie.api import Api
#from tastytools.api import Api
from base.api import BaseResource
from bcmon.api import PlayoutResource as BcmonPlayoutResource
from bcmon.api import ChannelResource as BcmonChannelResource
from alibrary.api import MediaResource, ReleaseResource, ... | hzlf/openbroadcast | website/urls_api.py | Python | gpl-3.0 | 1,715 | 0.002915 |
import socket
import sys
import threading
try:
from Queue import Queue, Empty
except:
from queue import Queue, Empty
from collections import OrderedDict
from . import parseintset
DEFAULT_THREAD_LIMIT = 200
CLOSED_STATUS = 'closed'
OPEN_STATUS = 'open'
if sys.version_info.major >= 3:
unicode = str
class... | LukeMurphey/splunk-network-tools | src/bin/network_tools_app/portscan.py | Python | apache-2.0 | 3,454 | 0.003185 |
"""
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
This file is part of the Smart Developer Hub Project:
http://www.smartdeveloperhub.org
Center for Open Middleware
http://www.centeropenmiddleware.com/
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=... | SmartDeveloperHub/agora-fountain | agora/fountain/vocab/onto.py | Python | apache-2.0 | 4,018 | 0.000249 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
# Copyright 2013 Akretion
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gene... | credativUK/connector-magento | __unported__/magentoerpconnect/magento_model.py | Python | agpl-3.0 | 28,454 | 0 |
"""
OnionShare | https://onionshare.org/
Copyright (C) 2014 Micah Lee <micah@micahflee.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 your option) any l... | kyonetca/onionshare | test/onionshare_web_test.py | Python | gpl-3.0 | 1,129 | 0 |
import sys
from os.path import join, abspath, dirname
# PATH vars
here = lambda *x: join(abspath(dirname(__file__)), *x)
PROJECT_ROOT = here("..")
root = lambda *x: join(abspath(PROJECT_ROOT), *x)
sys.path.insert(0, root('apps'))
ADMINS = (
('Maxime Lapointe', 'maxx@themaxx.ca'),
)
MANAGERS = ADMINS
SHELL_PLUS... | themaxx75/lapare-bijoux | lapare.ca/lapare/settings/base.py | Python | bsd-3-clause | 2,795 | 0.000716 |
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import os
import re
import logging
import tempfile
import argparse
from twisted.internet.defer import inlineCallbacks
import subprocess... | tlevine/alot | alot/commands/thread.py | Python | gpl-3.0 | 42,235 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without lim... | karesansui/karesansui | karesansui/gadget/guesttag.py | Python | mit | 2,641 | 0.004165 |
# Copyright The IETF Trust 2008, All Rights Reserved
from django.conf.urls.defaults import patterns, include
from ietf.wginfo import views, edit, milestones
from django.views.generic.simple import redirect_to
urlpatterns = patterns('',
(r'^$', views.wg_dir),
(r'^summary.txt', redirect_to, { 'url':'/wg/1wg-... | mcr/ietfdb | ietf/wginfo/urls.py | Python | bsd-3-clause | 2,177 | 0.009187 |
"""Admin API urls."""
from rest_framework import routers
from . import viewsets
router = routers.SimpleRouter()
router.register(r"domains", viewsets.DomainViewSet, basename="domain")
router.register(
r"domainaliases", viewsets.DomainAliasViewSet, basename="domain_alias")
router.register(r"accounts", viewsets.Acc... | modoboa/modoboa | modoboa/admin/api/v1/urls.py | Python | isc | 548 | 0.001825 |
#
# Copyright (C) 2012-2014, Quarkslab.
#
# This file is part of qb-sync.
#
# qb-sync 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.
#... | quarkslab/qb-sync | ext_ida/dispatcher.py | Python | gpl-3.0 | 14,364 | 0.00181 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Partially based on AboutMethods in the Ruby Koans
#
from runner.koan import *
def my_global_function(a, b):
return a + b
class AboutMethods(Koan):
def test_calling_a_global_function(self):
self.assertEqual(5, my_global_function(2, 3))
# NOTE: ... | Turivniy/Python_koans | python2/koans/about_methods.py | Python | mit | 5,806 | 0.001206 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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, or
#... | andreaso/ansible | lib/ansible/modules/cloud/ovirt/ovirt_permissions.py | Python | gpl-3.0 | 10,061 | 0.002286 |
#!/usr/bin/env python
# coding=utf-8
# code by kbdancer@92ez.com
from threading import Thread
from telnetlib import Telnet
import requests
import sqlite3
import queue
import time
import sys
import os
def ip2num(ip):
ip = [int(x) for x in ip.split('.')]
return ip[0] << 24 | ip[1] << 16 | ip[2] << 8 | ip[3]
... | kbdancer/TPLINKKEY | scan.py | Python | mit | 5,658 | 0.002301 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007,2008,2011,2012 Red Hat, Inc.
#
# Authors:
# Thomas Woerner <twoerner@redhat.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 2... | hos7ein/firewalld | src/firewall/functions.py | Python | gpl-2.0 | 17,408 | 0.004193 |
import math
def OUT_CIRC(t, b, c, d):
t = float(t)
b = float(b)
c = float(c)
d = float(d)
t = t / d - 1
return c * math.sqrt(1 - t * t) + b
def OUT_QUART(t, b, c, d):
t = float(t)
b = float(b)
c = float(c)
d = float(d)
t = t / d - 1
return -c * (t * t * t * t - 1)... | pyfa-org/Pyfa | gui/utils/anim_effects.py | Python | gpl-3.0 | 1,706 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Microsoft Internet Explorer WebCache database."""
import unittest
from plaso.lib import definitions
from plaso.parsers.esedb_plugins import msie_webcache
from tests.parsers.esedb_plugins import test_lib
class MsieWebCacheESEDBPluginTest(test_lib.ESEDB... | kiddinn/plaso | tests/parsers/esedb_plugins/msie_webcache.py | Python | apache-2.0 | 3,923 | 0.001784 |
# Copyright 2017 The TensorFlow Authors. 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 applica... | jbedorf/tensorflow | tensorflow/python/data/experimental/kernel_tests/serialization/dataset_serialization_test_base.py | Python | apache-2.0 | 26,060 | 0.004298 |
from flappy.display3d.vertexbuffer3d import VertexBuffer3D, VertexBuffer3DFormat
from flappy.display3d.indexbuffer3d import IndexBuffer3D
from flappy.display3d.program3d import Program3D
from flappy.display3d.texture import Texture
from flappy.display3d.scene3d import Scene3D
| wannaphongcom/flappy | flappy/display3d/__init__.py | Python | mit | 279 | 0.003584 |
import asyncio
import logging
import concurrent.futures
class EchoServer(object):
"""Echo server class"""
def __init__(self, host, port, loop=None):
self._loop = loop or asyncio.get_event_loop()
self._server = asyncio.start_server(self.handle_connection, host=host, port=port)
def start(s... | kaefik/zadanie-python | echoserver.py | Python | mit | 1,395 | 0.002867 |
import numpy as np
import numpy.testing as npt
import AFQ.utils.parallel as para
def power_it(num, n=2):
# We define a function of the right form for parallelization
return num ** n
def test_parfor():
my_array = np.arange(100).reshape(10, 10)
i, j = np.random.randint(0, 9, 2)
my_list = list(my_... | arokem/pyAFQ | AFQ/utils/tests/test_parallel.py | Python | bsd-2-clause | 1,135 | 0 |
#!/usr/bin/env python3.4
# dotslash for local
from flask import Flask, render_template, request, redirect
from werkzeug.contrib.fixers import ProxyFix
from urllib.request import urlopen, Request
from urllib.parse import urlparse
from omxplayer import OMXPlayer
from youtube_dl import YoutubeDL
from youtube_dl.utils imp... | aerobit/sparky | sparky.py | Python | unlicense | 5,633 | 0.00213 |
from axiom.test.historic.stubloader import StubbedTest
from xquotient.mail import MailTransferAgent
from axiom.userbase import LoginSystem
class MTAUpgraderTest(StubbedTest):
def testMTA2to3(self):
"""
Make sure MailTransferAgent upgraded OK and that its
"userbase" attribute refers to the s... | twisted/quotient | xquotient/test/historic/test_mta2to3.py | Python | mit | 512 | 0.001953 |
# -*- coding: utf-8 -*-
#
# Gateway documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 25 06:46:30 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | matrixise/gateway | docs/conf.py | Python | bsd-3-clause | 8,914 | 0.00718 |
# force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("../../../../")
import BellZhurkov.Python.TestExamples.TestUtil.Bell_Test_Data as ... | prheenan/BioModel | BellZhurkov/Python/TestExamples/Examples/Bell_Examples.py | Python | gpl-2.0 | 3,266 | 0.013778 |
"""
Models to support Course Surveys feature
"""
import logging
from lxml import etree
from collections import OrderedDict
from django.db import models
from student.models import User
from django.core.exceptions import ValidationError
from model_utils.models import TimeStampedModel
from survey.exceptions import Surv... | ahmadiga/min_edx | lms/djangoapps/survey/models.py | Python | agpl-3.0 | 8,631 | 0.001738 |
import sys
try:
import setuptools
from setuptools import setup
except ImportError:
setuptools = None
from distutils.core import setup
version = '0.0.1'
kwargs = {}
if setuptools is not None:
kwargs['install_requires'] = ['tornado>=4.3']
if sys.version_info < (3, 4):
kwargs['install_... | bdarnell/tornado_http2 | setup.py | Python | apache-2.0 | 702 | 0 |
import io
import os
import unittest
from stango import Stango
from stango.files import Files
from . import StangoTestCase, make_suite, view_value, view_template
dummy_view = view_value('')
class GenerateTestCase(StangoTestCase):
def setup(self):
self.tmp = self.tempdir()
self.manager = Stango()
... | akheron/stango | tests/test_generate.py | Python | mit | 6,958 | 0.000862 |
"""
This module contains transformation functions (clip->clip)
One file for one fx. The file's name is the fx's name
"""
| kerimlcr/ab2017-dpyo | ornek/moviepy/moviepy-0.2.2.12/moviepy/video/fx/__init__.py | Python | gpl-3.0 | 121 | 0 |
#! /usr/bin/env python
import os
import sys
import glob
version = (int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]))
def substitute_file(name):
subst = ''
f = open(name)
for l in f:
if '#define LIBTORRENT_VERSION_MAJOR' in l and name.endswith('.hpp'):
l = '#define LIBTORRENT_VERSION_MAJO... | steeve/libtorrent | set_version.py | Python | bsd-3-clause | 1,975 | 0.021772 |
print "Loading USBDriver : Logitech Cordless RumblePad 2"
class USBDriver :
def __init__(self):
self.componentNextThrottleFrame = "Hat Switch" # Component for throttle frames browsing
self.valueNextThrottleFrame = 0.5
self.componentPreviousThrottleFrame = "Hat Switch"
self.v... | ctag/cpe453 | JMRI/jython/Jynstruments/ThrottleWindowToolBar/USBThrottle.jyn/LogitechCordlessRumblePad2.py | Python | gpl-2.0 | 5,884 | 0.013936 |
from django.conf import settings
from django.core.management import call_command
from django.db import connection
from django.test.utils import _set_autocommit, TEST_DATABASE_PREFIX
import os, re, sys
def getstatusoutput(cmd):
"A simpler version of getstatusoutput that works on win32 platforms."
stdin, stdout,... | paulsmith/geodjango | django/contrib/gis/db/backend/postgis/creation.py | Python | bsd-3-clause | 9,184 | 0.005989 |
import logging
import unittest
from functools import reduce
from ass_parser import StyleInfo, UsageData
from font_loader import TTFFont, FontInfo, FontLoader, TTCFont, FontWeight
from tests.common import get_file_in_test_directory
class FontLoaderTests(unittest.TestCase):
def test_returns_all_not_found_fonts(self)... | tp7/assfc | tests/font_parsing_tests.py | Python | mit | 5,846 | 0.004961 |
# Copyright (c) 2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of G... | jhutar/spacewalk | backend/cdn_tools/manifest.py | Python | gpl-2.0 | 8,783 | 0.001139 |
# ed25519.py - Optimized version of the reference implementation of Ed25519
#
# Written in 2011? by Daniel J. Bernstein <djb@cr.yp.to>
# 2013 by Donald Stufft <donald@stufft.io>
# 2013 by Alex Gaynor <alex.gaynor@gmail.com>
# 2013 by Greg Price <price@mit.edu>
#
# To the extent possible... | vladimir-v-diaz/securesystemslib | securesystemslib/_vendor/ed25519/ed25519.py | Python | mit | 7,618 | 0.000656 |
import os
import json
import numpy as np
try:
from numba.pycc import CC
cc = CC('calculate_numba')
except ImportError:
# Will use these as regular Python functions if numba is not present.
class CCSubstitute(object):
# Make a cc.export that doesn't do anything
def export(*args, **kwar... | ConservationInternational/ldmp-qgis-plugin | LDMP/calculate_numba.py | Python | gpl-2.0 | 4,469 | 0.000671 |
#!/usr/bin/env python
# Copyright 2015 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 or... | isrealconsulting/codepy27 | main.py | Python | apache-2.0 | 3,227 | 0.00093 |
"""
Legalese
--------
Copyright (c) 2015, 2016 Genome Research Ltd.
Author: Colin Nolan <cn13@sanger.ac.uk>
This file is part of Cookie Monster.
Cookie Monster 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; ei... | wtsi-hgi/cookie-monster | cookiemonster/tests/processor/_mocks.py | Python | gpl-3.0 | 2,448 | 0.002451 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.