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 |
|---|---|---|---|---|---|---|
# coding: utf-8
from __future__ import print_function, absolute_import, division, unicode_literals
import sys
from .compat import no_limit_int # NOQA
if False: # MYPY
from typing import Text, Any, Dict, List # NOQA
__all__ = ["ScalarFloat", "ExponentialFloat", "ExponentialCapsFloat"]
class ScalarFloat(floa... | Samuel789/MediPi | MedManagementWeb/env/lib/python3.5/site-packages/ruamel/yaml/scalarfloat.py | Python | apache-2.0 | 3,378 | 0.00148 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.rdf
~~~~~~~~~~~~~~~~~~~
Lexers for semantic web and RDF query languages and markup.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, bygroups... | wandb/client | wandb/vendor/pygments/lexers/rdf.py | Python | mit | 9,398 | 0.00117 |
from __future__ import print_function
# Time: O(n)
# Space: O(1)
#
# Given a sorted linked list, delete all nodes that have duplicate numbers,
# leaving only distinct numbers from the original list.
#
# For example,
# Given 1->2->3->3->4->4->5, return 1->2->5.
# Given 1->1->1->2->3, return 2->3.
#
# Definition for s... | tudennis/LeetCode---kamyu104-11-24-2015 | Python/remove-duplicates-from-sorted-list-ii.py | Python | mit | 1,452 | 0.004132 |
# Copyright (c) 2012 LE GOFF Vincent
# 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 ... | v-legoff/pa-poc3 | src/service/default/wiki.py | Python | bsd-3-clause | 10,806 | 0.005552 |
"""http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17.
Copyright (c) 2015 Robert Pooley
Copyright (c) 2007, 2008 Johannes Berg
Copyright (c) 2007 Andy Lutomirski
Copyright (c) 2007 Mike Kershaw
Copyright (c) 2008-2009 Luis R. Rodriguez
Permission to use, copy, modify, and/or distribute ... | Robpol86/libnl | libnl/nl80211/iw_scan.py | Python | lgpl-2.1 | 29,804 | 0.001711 |
#
# Project: MXCuBE
# https://github.com/mxcube
#
# This file is part of MXCuBE software.
#
# MXCuBE 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... | IvarsKarpics/mxcube | gui/bricks/TaskToolBoxBrick.py | Python | lgpl-3.0 | 8,196 | 0.000488 |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns(
'',
url(r'^$', views.customer_list, name='customers'),
url(r'^(?P<pk>[0-9]+)/$', views.customer_details, name='customer-details')
)
| hongquan/saleor | saleor/dashboard/customer/urls.py | Python | bsd-3-clause | 234 | 0 |
#!/usr/bin/python
import numpy as np
#a = np.linspace(0.,10.,100)
#b = np.sqrt(a)
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import csv
def import_text(filename, separator):
for line in csv.reader(open(filename), delimiter=separator,
skipinitialspace... | ypzhang/jusha | book/scripts/d2d_kernel/cumemcpy_to_direct_offset1.py | Python | lgpl-3.0 | 5,058 | 0.028865 |
# A Gui interface allowing the binary illiterate to figure out the ip address the Arduino has been assigned.
import os
import re
from PySide.QtCore import QFile, QMetaObject, QSignalMapper, Slot, QRegExp
from PySide.QtGui import QDialog, QPushButton, QRegExpValidator
from PySide.QtUiTools import QUiLoader
class IPHel... | MHendricks/Motionbuilder-Remote | iphelper.py | Python | mit | 3,612 | 0.027409 |
# Author: Nic Wolfe <[email protected]>
# 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... | Pakoach/Sick-Beard | sickbeard/databases/mainDB.py | Python | gpl-3.0 | 33,825 | 0.005026 |
# Copyright 2017 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 agreed to in writing,... | shashankrajput/seq2seq | seq2seq/test/attention_test.py | Python | apache-2.0 | 3,532 | 0.005663 |
# -*- coding: utf-8 -*-
from converters.circle import circle
from converters.currency import currency
from converters.electric import electric
from converters.force import force
from converters.pressure import pressure
from converters.speed import speed
from converters.temperature import temperature
class UnitsManage... | mattgd/UnitConverter | units/__init__.py | Python | mit | 1,001 | 0 |
# Copyright 2012 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.
"""A very very simple mock object harness."""
from types import ModuleType
DONT_CARE = ''
class MockFunctionCall(object):
def __init__(self, name):
se... | hujiajie/chromium-crosswalk | tools/telemetry/telemetry/testing/simple_mock.py | Python | bsd-3-clause | 3,810 | 0.013386 |
# Natural Language Toolkit: Chunked Corpus Reader
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Steven Bird <[email protected]>
# Edward Loper <[email protected]>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A reader for corpora that contain chunked (and optionally tagged)
... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/nltk/corpus/reader/chunked.py | Python | gpl-2.0 | 8,206 | 0.000731 |
import datetime
from dateutil import parser
from .numbers import is_number
from .strings import STRING_TYPES
DATE_TYPES = (datetime.date, datetime.datetime)
def parse_dates(d, default='today'):
""" Parses one or more dates from d """
if default == 'today':
default = datetime.datetime.today()
... | consbio/parserutils | parserutils/dates.py | Python | bsd-3-clause | 989 | 0 |
#!/usr/bin/python
import argparse
import requests,json
from requests.auth import HTTPBasicAuth
from subprocess import call
import time
import sys
import os
from vas_config_sw1 import *
DEFAULT_PORT='8181'
USERNAME='admin'
PASSWORD='admin'
OPER_OVSDB_TOPO='/restconf/operational/network-topology:network-topology/topo... | opendaylight/faas | demos/env_mininet/lsw1Demo.py | Python | epl-1.0 | 6,912 | 0.012297 |
from examples.isomorph import (
get_all_canonicals,
get_canonical,
get_translation_dict,
)
from pokertools import cards_from_str as flop
def test_isomorph():
assert len(get_all_canonicals()) == 1755
assert get_canonical(flop('6s 8d 7c')) == flop('6c 7d 8h')
assert get_translation_dict(flop('6... | mjwestcott/PyPokertools | tests/test_isomorph.py | Python | mit | 533 | 0.003752 |
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You may
# obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | jistr/rejviz | rejviz/tests/test_utils.py | Python | apache-2.0 | 1,998 | 0 |
"""Support for HomematicIP Cloud weather devices."""
import logging
from homematicip.aio.device import (
AsyncWeatherSensor, AsyncWeatherSensorPlus, AsyncWeatherSensorPro)
from homematicip.aio.home import AsyncHome
from homeassistant.components.weather import WeatherEntity
from homeassistant.config_entries impor... | jnewland/home-assistant | homeassistant/components/homematicip_cloud/weather.py | Python | apache-2.0 | 2,991 | 0 |
from bears.yml.RAMLLintBear import RAMLLintBear
from tests.LocalBearTestHelper import verify_local_bear
good_file = """
#%RAML 0.8
title: World Music API
baseUri: http://example.api.com/{version}
version: v1
"""
bad_file = """#%RAML 0.8
title: Failing RAML
version: 1
baseUri: http://example.com
/resource:
descr... | SanketDG/coala-bears | tests/yml/RAMLLintBearTest.py | Python | agpl-3.0 | 602 | 0 |
import sys
import six
import logging
import ooxml
from ooxml import parse, serialize, importer
logging.basicConfig(filename='ooxml.log', level=logging.INFO)
if len(sys.argv) > 1:
file_name = sys.argv[1]
dfile = ooxml.read_from_file(file_name)
six.print_("\n-[HTML]-----------------------------\n")
... | LuoZijun/uOffice | temp/ooxmlx/samples/01_basic/parse.py | Python | gpl-3.0 | 697 | 0.001435 |
from bucket.local import LocalProvider
import config
import statestore
import logging
import os
import threading
import traceback
import messages
from send2trash import send2trash
from worker import BaseWorker
class Download(BaseWorker):
def __init__(self, objectStore, outputQueue):
BaseWorker.__init__(se... | Sybrand/digital-panda | panda-tray/download.py | Python | mit | 12,881 | 0.000854 |
# Nessus results viewing tools
#
# Developed by Felix Ingram, [email protected], @lllamaboy
# http://www.github.com/nccgroup/lapith
#
# Released under AGPL. See LICENSE for more information
import wx
import os
from model.Nessus import NessusFile, NessusTreeItem, MergedNessusReport, NessusReport, NessusItem
... | nccgroup/lapith | controller/viewer_controller.py | Python | agpl-3.0 | 22,502 | 0.004 |
# -*- coding: utf-8 -*-
import re
import logging
from completor.utils import check_subseq
from .utils import parse_uri
word_pat = re.compile(r'([\d\w]+)', re.U)
word_ends = re.compile(r'[\d\w]+$', re.U)
logger = logging.getLogger("completor")
# [
# [{
# u'range': {
# u'start': {u'line': 273, u'ch... | maralla/completor.vim | pythonx/completers/lsp/action.py | Python | mit | 3,344 | 0.000299 |
from ctypes import POINTER
from ctypes import c_long
from ctypes import c_uint32
from ctypes import c_void_p
CFIndex = c_long
CFStringEncoding = c_uint32
CFString = c_void_p
CFArray = c_void_p
CFDictionary = c_void_p
CFError = c_void_p
CFType = c_void_p
CFAllocatorRef = c_void_p
CFStringRef = POINTER(CFString)
CFArra... | vasily-v-ryabov/ui-automation-course | 1_Lyalyushkin/objc_constants.py | Python | bsd-3-clause | 588 | 0 |
#!/usr/bin/env python
from numpy import array, dtype, int32
traindat = '../data/fm_train_real.dat'
testdat = '../data/fm_test_real.dat'
label_traindat = '../data/label_train_multiclass.dat'
# set both input attributes as continuous i.e. 2
feattypes = array([2, 2],dtype=int32)
parameter_list = [[traindat,testdat,labe... | AzamYahya/shogun | examples/undocumented/python_modular/multiclass_chaidtree_modular.py | Python | gpl-3.0 | 1,100 | 0.033636 |
for _ in range(int(input())):
A, B, C, D = map(int, input().split())
if A < B or C + D < B:
print("No")
continue
elif C >= B - 1:
print("Yes")
continue
ret = []
s_set = set()
now = A
while True:
now %= B
if now in s_set:
print("Yes"... | knuu/competitive-programming | atcoder/agc/agc026_b.py | Python | mit | 517 | 0 |
import pytest
import pwny
target_little_endian = pwny.Target(arch=pwny.Target.Arch.unknown, endian=pwny.Target.Endian.little)
target_big_endian = pwny.Target(arch=pwny.Target.Arch.unknown, endian=pwny.Target.Endian.big)
def test_pack():
assert pwny.pack('I', 0x41424344) == b'DCBA'
def test_pack_format_with_e... | edibledinos/pwnypack | tests/test_packing.py | Python | mit | 4,642 | 0.004093 |
from django.conf.urls import include, url
from django.views.generic import TemplateView
from kuma.attachments.feeds import AttachmentsFeed
from kuma.attachments.views import edit_attachment
from . import feeds, views
from .constants import DOCUMENT_PATH_RE
# These patterns inherit (?P<document_path>[^\$]+).
documen... | jgmize/kuma | kuma/wiki/urls.py | Python | mpl-2.0 | 5,894 | 0.00017 |
#!/usr/bin/env python
from datetime import timedelta
import numpy as np
from opendrift.readers import reader_basemap_landmask
from opendrift.readers import reader_netCDF_CF_generic
from opendrift.models.oceandrift import OceanDrift
o = OceanDrift(loglevel=0) # Set loglevel to 0 for debug information
reader_norkys... | knutfrode/opendrift | examples/example_grid_time.py | Python | gpl-2.0 | 1,294 | 0.001546 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | kmee/bank-statement-reconcile | __unported__/account_invoice_reference/__openerp__.py | Python | agpl-3.0 | 6,213 | 0.000161 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""code generator for GL/GLES extension wrangler."""
import os
import collections
import re
import sys
GL_FUNCTIONS = [
{ 'return... | keishi/chromium | ui/gl/generate_bindings.py | Python | bsd-3-clause | 57,794 | 0.014759 |
import sys
import numpy as np
def check_symmetric(a, tol=1e-8):
return np.allclose(a, a.T, atol=tol)
for line in sys.stdin:
a = np.matrix(line)
f = check_symmetric(a)
if not f:
print("Not symmetric")
else:
print("Symmetric")
| DT9/programming-problems | 2017/microsoft17/1.py | Python | apache-2.0 | 262 | 0.007634 |
from diofant import (Derivative, Function, Integral, bell, besselj, cos, exp,
legendre, oo, symbols)
from diofant.printing.conventions import requires_partial, split_super_sub
__all__ = ()
def test_super_sub():
assert split_super_sub('beta_13_2') == ('beta', [], ['13', '2'])
assert spli... | skirpichev/omg | diofant/tests/printing/test_conventions.py | Python | bsd-3-clause | 3,727 | 0.000537 |
#---------------------------------------------------------------------------
# Introdução a Programação de Computadores - IPC
# Universidade do Estado do Amazonas - UEA
# Prof. Jucimar Jr
# Gabriel de Queiroz Sousa 1715310044
# Lucas Gabriel Silveira Duarte 1715310053
# Matheus de Olive... | jucimarjr/IPC_2017-1 | lista06/lista06_lista04_questao14.py | Python | apache-2.0 | 1,317 | 0.006897 |
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Any, cast, List, Optional
from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject
from UM.Application import Application
from UM.Decorators import override
from UM.FlameProfiler import pyqtSlot
from U... | Patola/Cura | cura/Settings/CuraContainerStack.py | Python | lgpl-3.0 | 18,426 | 0.011397 |
import nose
import angr
import logging
l = logging.getLogger("angr_tests.path_groups")
import os
location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests'))
addresses_fauxware = {
'armel': 0x8524,
'armhf': 0x104c9, # addr+1 to force thumb
#'i386': 0x8048524, # comm... | haylesr/angr | tests/test_path_groups.py | Python | bsd-2-clause | 4,184 | 0.00478 |
#!/usr/bin/env python3
import os # makedirs
import sys # argv, exit
import csv # DictReader
def cutoffdict(cdict):
rdict = dict()
for key in cdict.keys():
candi = cdict[key]
top = max(candi, key = candi.get)
if candi[top] > (sum(candi.values())*0.5):
rdict[key] = top
... | munhyunsu/UsedMarketAnalysis | ruliweb_analyzer/db_5th_group.py | Python | gpl-3.0 | 1,617 | 0.009895 |
# -*- coding: utf-8 -*-
"""The EWF image path specification implementation."""
from dfvfs.lib import definitions
from dfvfs.path import factory
from dfvfs.path import path_spec
class EWFPathSpec(path_spec.PathSpec):
"""EWF image path specification."""
TYPE_INDICATOR = definitions.TYPE_INDICATOR_EWF
def __ini... | joachimmetz/dfvfs | dfvfs/path/ewf_path_spec.py | Python | apache-2.0 | 777 | 0.005148 |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from django import forms
from django.utils.translation import ugettext_lazy as _
from envelope.forms import ContactForm
class ContactForm(ContactForm):
template_name = "envelope/contact_email.txt"
html_template_name = "envelope/contact_email.html"... | CacaoMovil/guia-de-cacao-django | cacao_app/configuracion/forms.py | Python | bsd-3-clause | 762 | 0.001316 |
from django import template
register = template.Library()
@register.assignment_tag(takes_context=True)
def has_bookmark_permission(context, action):
"""Checks if the current user can bookmark the action item.
Returns a boolean.
Syntax::
{% has_bookmark_permission action %}
"""
request =... | HMSBeagle1831/rapidscience | rlp/bookmarks/templatetags/bookmarks.py | Python | mit | 990 | 0.00202 |
# Natural Language Toolkit: Clusterer Utilities
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Trevor Cohn <[email protected]>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function, unicode_literals
import copy
from sys import stdout
from math import sqrt
try:... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/nltk/cluster/util.py | Python | gpl-2.0 | 9,689 | 0.001858 |
#!/usr/bin/env python
# REQUIRES both rst2pdf and wikir project from google code.
import sys
import subprocess
sys.path.insert(0, '../../rson/py2x')
from rson import loads
from simplejson import dumps
subprocess.call('../../rst2pdf/bin/rst2pdf manual.txt -e preprocess -e dotted_toc -o manual.pdf'.split())
lines = i... | pmaupin/playtag | doc/make.py | Python | mit | 745 | 0.005369 |
# -*- coding: utf-8 -*-
from requests import (get, post, delete)
from .base import Base
class System(Base):
def __init__(self, host, secret, endpoint='/plugins/restapi/v1/system/properties'):
"""
:param host: Scheme://Host/ for API requests
:param secret: Shared secret key for API request... | etutionbd/openfire-restapi | ofrestapi/system.py | Python | gpl-3.0 | 1,675 | 0.001194 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from django.contrib.auth.models import User
from sentry.constants import MEMBER_USER
from sentry.models import Project
from sentry.web.helpers import get_project_list
from tests.base import TestCase
class GetProjectListTEst(TestCase):
d... | chayapan/django-sentry | tests/sentry/web/helpers/tests.py | Python | bsd-3-clause | 2,132 | 0.002345 |
#!/usr/bin/python
# Written by Stjepan Horvat
# ( [email protected] )
# by the exercises from David Lucal Burge - Perfect Pitch Ear Traning Supercourse
# Thanks to Wojciech M. Zabolotny ( [email protected] ) for snd-virmidi example
# ( [email protected] )
import random
import time
import sys
import re
fname="/de... | schef/schef.github.io | source/11/mc-11-05-sk-mt.py | Python | mit | 3,429 | 0.022164 |
#!/usr/bin/env python
import datetime as dt
import numpy as np
import matplotlib.pyplot as plt
#import matplotlib.dates as mdates
#import matplotlib.cbook as cbook
#from matplotlib import pyplot as plt
from matplotlib.dates import date2num
from statsmodels.distributions.empirical_distribution import ECDF
from colle... | emmdim/guifiAnalyzer | plot/plotsServices.py | Python | gpl-3.0 | 4,467 | 0.004477 |
# -*- coding: utf-8 -*-
import gensim, logging
class SemanticVector:
model = ''
def __init__(self, structure):
self.structure = structure
def model_word2vec(self, min_count=15, window=15, size=100):
print 'preparing sentences list'
sentences = self.structure.prepare_list_of_words... | arashzamani/lstm_nlg_ver1 | language_parser/SemanticVector.py | Python | gpl-3.0 | 679 | 0.002946 |
# 类结构的堆排序
class DLinkHeap(object):
def __init__(self, list=None, N = 0):
self.dList = list
self.lengthSize = N
# 插入数据
def insert_heap(self, data):
self.dList.append(data)
self.lengthSize += 1
# 初始化堆结构
def init_heap(self):
n = self.lengthS... | jinzekid/codehub | 数据结构与算法/heap_sort/类定义操作定义堆结果以及排序.py | Python | gpl-3.0 | 2,192 | 0.008205 |
from . import slide_channel_technology_category
from . import slide_channel_technology
from . import slide_channel
| avanzosc/odoo-addons | slide_channel_technology/models/__init__.py | Python | agpl-3.0 | 115 | 0 |
#!/usr/bin/python3
__author__ = 'ivan.shynkarenka'
import argparse
from TTWebClient.TickTraderWebClient import TickTraderWebClient
def main():
parser = argparse.ArgumentParser(description='TickTrader Web API sample')
parser.add_argument('web_api_address', help='TickTrader Web API address')
args = parser... | SoftFx/TTWebClient-Python | TTWebClientSample/public_currencies.py | Python | mit | 796 | 0.002513 |
from django.contrib import admin
# Register your models here.
from django.contrib import admin
from rango.models import Category, Page
class PageAdmin(admin.ModelAdmin):
list_display = ('title', 'category', 'url')
admin.site.register(Category)
admin.site.register(Page,PageAdmin)
| ramprasathdgl/TangoWithDjango | TangoWithDjango/rango/admin.py | Python | gpl-3.0 | 287 | 0.017422 |
#!/usr/bin/env python
# coding: utf-8
# # rede_gephi_com_ipca_csv
# In[6]:
ano_eleicao = '2014'
rede =f'rede{ano_eleicao}'
csv_dir = f'/home/neilor/{rede}'
# In[7]:
dbschema = f'rede{ano_eleicao}'
table_edges = f"{dbschema}.gephi_edges_com_ipca_2018"
table_nodes = f"{dbschema}.gephi_nodes_com_ipca_2018"
table... | elivre/arfe | e2014/SCRIPTS/055-rede2014_rede_gephi_com_ipca_csv.py | Python | mit | 3,896 | 0.014117 |
import pytest
from django.db import connection, IntegrityError
from .models import MyTree
def flush_constraints():
# the default db setup is to have constraints DEFERRED.
# So IntegrityErrors only happen when the transaction commits.
# Django's testcase thing does eventually flush the constraints but to... | craigds/django-mpathy | tests/test_db_consistency.py | Python | bsd-3-clause | 2,474 | 0.000404 |
"""Unit test for the SNES nonlinear solver"""
# Copyright (C) 2012 Patrick E. Farrell
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the ... | alogg/dolfin | test/unit/nls/python/PETScSNESSolver.py | Python | gpl-3.0 | 2,986 | 0.005023 |
# Copyright (c) 2016-2017 Dustin Doloff
# Licensed under Apache License v2.0
import argparse
import difflib
import hashlib
import os
import subprocess
import zipfile
# Resets color formatting
COLOR_END = '\33[0m'
# Modifies characters or color
COLOR_BOLD = '\33[1m'
COLOR_DISABLED = '\33[02m' # Mostly just means darke... | quittle/bazel_toolbox | assert/scripts/assert_equal.py | Python | apache-2.0 | 4,276 | 0.005847 |
#!/usr/bin/env python3
# Copyright 2015 Dietrich Epp.
# This file is part of SGGL. SGGL is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
import glgen.__main__
glgen.__main__.main()
| depp/sggl | sggl.py | Python | bsd-2-clause | 232 | 0 |
# Copyright 2015 Google Inc. All Rights Reserved.
"""Command for setting target pools of instance group manager."""
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.compute.lib import base_classes
from googlecloudsdk.compute.lib import utils
class SetT... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/instance_groups/managed/set_target_pools.py | Python | apache-2.0 | 3,208 | 0.004364 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Incident',
fields=[
... | vivek8943/tracker_project | tracker_project/tracker/migrations/0001_initial.py | Python | mit | 1,059 | 0.002833 |
"""
/***************************************************************************
Name : ProfileTenureView
Description : A widget for rendering a profile's social tenure
relationship.
Date : 9/October/2016
copyright : John Kahiu
email ... | gltn/stdm | stdm/ui/wizard/profile_tenure_view.py | Python | gpl-2.0 | 67,557 | 0.000148 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
SVM-SVC (Support Vector Classification)
=========================================================
The classification application of the SVM is used below. The
`Iris <http://en.wikipedia.org/wiki/Iris_flower_data_set... | hackliff/domobot | kinect/pySVM/test/plotLinearSVC.py | Python | apache-2.0 | 1,628 | 0.0043 |
"""
Test the pulp.server.db.manage module.
"""
from argparse import Namespace
from cStringIO import StringIO
import os
from mock import call, inPy3k, MagicMock, patch
from mongoengine.queryset import DoesNotExist
from ... import base
from pulp.common.compat import all, json
from pulp.server.db import manage
from pulp... | ulif/pulp | server/test/unit/server/db/test_manage.py | Python | gpl-2.0 | 40,647 | 0.003174 |
from flask import Flask
from flask import request
from flask import jsonify
from flask import abort
import time
app = Flask(__name__)
@app.route('/api/1', defaults={'path': ''}, methods=['GET', 'POST'])
@app.route('/api/1/<path:path>', methods=['GET', 'POST'])
def api1(path):
time.sleep(20)
return jsonify({
... | jie/microgate | test_server.py | Python | mit | 1,151 | 0.001738 |
"""
Simple utility code for animations.
"""
# Author: Prabhu Ramachandran <prabhu at aerodotiitbdotacdotin>
# Copyright (c) 2009, Enthought, Inc.
# License: BSD Style.
import types
from functools import wraps
try:
from decorator import decorator
HAS_DECORATOR = True
except ImportError:
HAS_DECORATOR = Fals... | liulion/mayavi | mayavi/tools/animator.py | Python | bsd-3-clause | 7,087 | 0.000564 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'NewMangaDialog.ui'
#
# Created: Wed Jul 24 19:06:21 2013
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except... | ilbay/PyMangaDownloader | Ui_NewMangaDialog.py | Python | gpl-2.0 | 2,334 | 0.003428 |
"""engine.SCons.Platform.darwin
Platform-specific initialization for Mac OS X systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008... | faarwa/EngSocP5 | zxing/cpp/scons/scons-local-2.0.0.final.0/SCons/Platform/darwin.py | Python | gpl-3.0 | 1,758 | 0.001706 |
# -*- coding: utf-8 -*-
# This file is part of https://github.com/26fe/jsonstat.py
# Copyright (C) 2016-2021 gf <[email protected]>
# See LICENSE file
# stdlib
import time
import os
import hashlib
# packages
import requests
# jsonstat
from jsonstat.exceptions import JsonStatException
class Downloader:
"""Helper clas... | 26fe/jsonstat.py | jsonstat/downloader.py | Python | lgpl-3.0 | 3,966 | 0.001261 |
# Use default debug configuration or local configuration
try:
from .config_local import *
except ImportError:
from .config_default import *
| steelart/ask-navalny | django-backend/config/config.py | Python | mit | 148 | 0 |
#-------------------------------------------------------------------------------
# Name: ModSlaveSettingsRTU
# Purpose:
#
# Author: ElBar
#
# Created: 17/04/2012
# Copyright: (c) ElBar 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
#... | zhanglongqi/pymodslave | ModSlaveSettingsRTU.py | Python | gpl-2.0 | 2,993 | 0.009021 |
"""
Helper for views.py
"""
from base_handler import base_handler
import traceback
import app.model
from flask import g, render_template
class single_access_handler(base_handler):
def __init__(self):
"""
Manages all the operations that are involved with a single port association with EPGs
... | sfloresk/NCA-Container-Builder | NCABase/app/sijax_handlers/single_access_handler.py | Python | apache-2.0 | 13,867 | 0.00786 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 20 12:28:32 2015
@author: boland
"""
import sys
sys.path.append('/home/boland/Anaconda/lib/python2.7/site-packages')
import pickle
import numpy as np
import matplotlib.pyplot as plt
from scipy.cluster.vq import kmeans
import multiprocessing as mp
import pyproj
import os
... | boland1992/SeisSuite | seissuite/sort_later/find_holes.py | Python | gpl-3.0 | 17,030 | 0.021315 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | nkhare/rockstor-core | src/rockstor/storageadmin/views/network.py | Python | gpl-3.0 | 10,047 | 0.001294 |
from unittest import TestCase
from rfxcom.protocol.temperature import Temperature
from rfxcom.exceptions import (InvalidPacketLength, UnknownPacketSubtype,
UnknownPacketType)
class TemperatureTestCase(TestCase):
def setUp(self):
self.data = bytearray(b'\x08\x50\x02\x11\x... | skimpax/python-rfxcom | tests/protocol/test_temperature.py | Python | bsd-3-clause | 3,484 | 0 |
#! /usr/bin/env python3
import sys
in_class = False
for l in sys.stdin:
if l.startswith("class"):
in_class = True
if in_class:
if l.startswith("};"):
in_class = False
continue
else:
print(l, end='')
| ctongfei/nexus | torch/remove_classes.py | Python | mit | 259 | 0.003861 |
"""
Copyright 2013 Shine Wang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | shinexwang/Classy | Main/webParser.py | Python | apache-2.0 | 10,545 | 0.000379 |
# coding=utf-8
'''
cron trigger
@author: Huiyugeng
'''
import datetime
import trigger
class CronTrigger(trigger.Trigger):
def __init__(self, cron):
trigger.Trigger.__init__(self, 0, 1);
self.cron = cron
def _is_match(self):
parser = CronParser(self.cron)
... | interhui/py_task | task/trigger/cron_trigger.py | Python | artistic-2.0 | 3,634 | 0.008255 |
# Copyright (c) 2014, Hubert Kario
#
# Efthimios Iosifidis - Speck Cipher Additions
# See the LICENSE file for legal information regarding use of this file.
"""Implementation of the TLS Record Layer protocol"""
import socket
import errno
import hashlib
from .constants import ContentType, CipherSuite
from .messages i... | ioef/tlslite-ng | tlslite/recordlayer.py | Python | lgpl-2.1 | 29,445 | 0.001834 |
from django.contrib import admin
from django.contrib.admin.filters import RelatedFieldListFilter
from .models import ClientLog, Client, Feedback
def client_id(obj):
return obj.client.externid
class AliveClientsRelatedFieldListFilter(RelatedFieldListFilter):
def __init__(self, field, request, *args, **kwargs):... | ddalex/p9 | sign/admin.py | Python | mit | 1,555 | 0.009646 |
from sqlalchemy import Column, String, BigInteger
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
import time
BaseModel = declarative_base()
class Video(BaseModel):
__tablename__ = 'video'
id = Column(BigInteger, primary_key=True, autoincrement=True)
name = ... | AcerFeng/videoSpider | spider/models.py | Python | apache-2.0 | 2,458 | 0.003211 |
#!/usr/bin/env python
#coding=utf-8
import sys
sys.path.append("..")
import urllib
import myjson
from datetime import datetime, date, timedelta
import time
from define import *
from data_interface.stock_dataset import stock_dataset
class turtle(object):
"""
turtle model
"""
def get_mean(self, data, ... | icemoon1987/stock_monitor | model/turtle.py | Python | gpl-2.0 | 6,761 | 0.00419 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.python.target_types import PythonLibrary, PythonTests
from pants.engine.target import BoolField
class SkipIsortField(BoolField):
alias = "skip_isort"
default =... | benjyw/pants | src/python/pants/backend/python/lint/isort/skip_field.py | Python | apache-2.0 | 542 | 0 |
import requests
import csv
from configparser import ConfigParser
config = ConfigParser()
config.read("config.cfg")
token = config.get("auth", "token")
domain = config.get("instance", "domain")
headers = {"Authorization" : "Bearer %s" % token}
source_course_id = 311693
csv_file = ""
payload = {'migration_type': 'course_... | tylerclair/canvas_admin_scripts | course_copy_csv.py | Python | mit | 684 | 0.00731 |
from django_nose.tools import assert_equal
from pontoon.base.tests import TestCase
from pontoon.base.utils import NewlineEscapePlaceable, mark_placeables
class PlaceablesTests(TestCase):
def test_newline_escape_placeable(self):
"""Test detecting newline escape sequences"""
placeable = NewlineEsca... | Osmose/pontoon | pontoon/base/tests/test_placeables.py | Python | bsd-3-clause | 1,460 | 0.002055 |
# Copyright (C) 2009 - TODAY Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import api, fields, models
class AccountTax(models.Model):
_inherit = 'account.tax'
fiscal_tax_ids = fields.Many2many(
comodel_name='l10n_br_fiscal.tax',
relation='l... | akretion/l10n-brazil | l10n_br_account/models/account_tax.py | Python | agpl-3.0 | 4,286 | 0 |
import struct
import hashlib
magic_number = 0xD9B4BEF9
block_prefix_format = 'I32s32sIII'
def read_uint1(stream):
return ord(stream.read(1))
def read_uint2(stream):
return struct.unpack('H', stream.read(2))[0]
def read_uint4(stream):
return struct.unpack('I', stream.read(4))[0]
def read_uint8(stream):
... | jkthompson/block-chain-analytics | block.py | Python | mit | 10,671 | 0.023803 |
import json
import logging
import webapp2
from datetime import datetime
from google.appengine.ext import ndb
from controllers.api.api_base_controller import ApiBaseController
from database.event_query import EventListQuery
from helpers.award_helper import AwardHelper
from helpers.district_helper import DistrictHelp... | synth3tk/the-blue-alliance | controllers/api/api_event_controller.py | Python | mit | 6,883 | 0.001017 |
"""
Check the measured process sizes. If we are on a platform which supports
multiple measuring facilities (e.g. Linux), check if the reported sizes match.
This should help to protect against scaling errors (e.g. Byte vs KiB) or using
the wrong value for a different measure (e.g. resident in physical memory vs
virtual... | pympler/pympler | test/test_process.py | Python | apache-2.0 | 5,151 | 0.002136 |
"""Collection of fixtures and functions for the HomeKit tests."""
from unittest.mock import patch
def patch_debounce():
"""Return patch for debounce method."""
return patch(
"homeassistant.components.homekit.accessories.debounce",
lambda f: lambda *args, **kwargs: f(*args, **kwargs),
)
| fbradyirl/home-assistant | tests/components/homekit/common.py | Python | apache-2.0 | 317 | 0 |
# python-jinjatools
#
# Various tools for Jinja2,
# including new filters and tests based on python-moretools,
# a JinjaLoader class for Django,
# and a simple JinjaBuilder class for SCons.
#
# Copyright (C) 2011-2015 Stefan Zimmermann <[email protected]>
#
# python-jinjatools is free software: you can redistri... | userzimmermann/python-jinjatools | jinjatools/env.py | Python | gpl-3.0 | 1,555 | 0.001286 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, Steve Gargan <[email protected]>
#
# 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 th... | CenturylinkTechnology/ansible-modules-extras | clustering/consul_session.py | Python | gpl-3.0 | 9,707 | 0.001959 |
"""Tests for asyncio/sslproto.py."""
try:
import ssl
except ImportError:
ssl = None
import trollius as asyncio
from trollius import ConnectionResetError
from trollius import sslproto
from trollius import test_utils
from trollius.test_utils import mock
from trollius.test_utils import unittest
@unittest.skipI... | haypo/trollius | tests/test_sslproto.py | Python | apache-2.0 | 2,350 | 0 |
import tensorflow as tf
from tensorflow.contrib import slim as slim
from avb.ops import *
import math
def encoder(x, config, is_training=True):
df_dim = config['df_dim']
z_dim = config['z_dim']
a_dim = config['iaf_a_dim']
# Center x at 0
x = 2*x - 1
net = flatten_spatial(x)
net = slim.ful... | LMescheder/AdversarialVariationalBayes | avb/iaf/models/full0.py | Python | mit | 698 | 0.004298 |
"""
2015 gupon.jp
Connector for C4D Python Generator
"""
import c4d, math, itertools, random
from c4d.modules import mograph as mo
#userdata id
ID_SPLINE_TYPE = 2
ID_SPLINE_CLOSED = 4
ID_SPLINE_INTERPOLATION = 5
ID_SPLINE_SUB = 6
ID_SPLINE_ANGLE = 8
ID_SPLINE_MAXIMUMLENGTH = 9
ID_USE_SCREEN_DIST = 10
ID_USE_MAXS... | gupon/ConnectorC4D | ConnectorC4D.py | Python | mit | 6,128 | 0.046671 |
import pandas as pd
import numpy as np
from dateutil.relativedelta import relativedelta
#### Utilities
def get_first_visit_date(data_patient):
''' Determines the first visit for a given patient'''
#IDEA Could be parallelized in Dask
data_patient['first_visit_date'] = min(data_patient.visit_date)
retur... | grlurton/hiv_retention_metrics | src/models/cohort_analysis_function.py | Python | mit | 4,874 | 0.008822 |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import latex_plot_inits
parameter_list = [[20, 5, 1., 1000, 1, None, 5], [100, 5, 1., 1000, 1, None, 10]]
def classifier_perceptron_graphical(n=100, distance=5, learn_rate=1., max_iter=1000, num_threads=1, seed=None, nperceptrons=5):
from shog... | MikeLing/shogun | examples/undocumented/python/graphical/classifier_perceptron_graphical.py | Python | gpl-3.0 | 2,302 | 0.032146 |
from typing import Optional
from thinc.api import Model
from .stop_words import STOP_WORDS
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .lex_attrs import LEX_ATTRS
from .lemmatizer import RussianLemmatizer
from ...language import Language
class RussianDefaults(Language.Defaults):
tokenizer_excepti... | spacy-io/spaCy | spacy/lang/ru/__init__.py | Python | mit | 905 | 0.001105 |
#! /usr/bin/env python
# Python script to parse SMStext messages from a Windows 8.0 phone's store.vol file
# Author: [email protected] (Adrian Leong)
#
# Special Thanks to Detective Cindy Murphy (@cindymurph) and the Madison, WI Police Department (MPD)
# for the test data and encouragement.
# Thanks also to Jo... | WindowsPhoneForensics/find_my_texts_wp8 | find_my_texts_wp8/wp8_sms_integrated.py | Python | gpl-3.0 | 24,866 | 0.004987 |
"""Support for tracking consumption over given periods of time."""
from datetime import timedelta
import logging
from croniter import croniter
import voluptuous as vol
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.const import CONF_NAME
from homeassistant.helpers import discov... | jawilson/home-assistant | homeassistant/components/utility_meter/__init__.py | Python | apache-2.0 | 7,390 | 0.000947 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import collections
import logging
import os
import platform
import re
import subprocess
import types
import util
import json
from ebstall.versions import Version
from ebstall.util import normalize_string
logger = logging.getLogger(__n... | EnigmaBridge/ebstall.py | ebstall/osutil.py | Python | mit | 18,396 | 0.002174 |
#!/Users/wuga/Documents/website/wuga/env/bin/python2.7
#
# The Python Imaging Library
# $Id$
#
from __future__ import print_function
import sys
if sys.version_info[0] > 2:
import tkinter
else:
import Tkinter as tkinter
from PIL import Image, ImageTk
#
# an image viewer
class UI(tkinter.Label):
def _... | wuga214/Django-Wuga | env/bin/viewer.py | Python | apache-2.0 | 1,056 | 0.000947 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.