code
stringlengths
3
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
3
1.05M
from import1b import var print(var) from import1b import var as var2 print(var2)
kerneltask/micropython
tests/import/import2a.py
Python
mit
84
# -*- coding: utf-8 -*- from datetime import datetime import pytest from mygeotab.ext.entitylist import EntityList class TestEntityList: def test_create(self): type_name = "Device" entitylist = get_entitylist(type_name) assert entitylist.type_name == type_name def test_get(self): ...
Geotab/mygeotab-python
tests/test_api_entitylist.py
Python
apache-2.0
3,588
from setuptools import setup, find_packages setup( name = "entsystem", version = "0.1.1", packages= find_packages(), )
horrorvacui/ent-system
setup.py
Python
mit
131
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-17 17:08 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Creat...
MahdiZareie/VersionMonitoring
project/migrations/0001_initial.py
Python
apache-2.0
1,543
# Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2003-2006 Donald N. Allingham # Copyright (C) 2008 Brian G. Matherly # Copyright (C) 2010 Jakim Friant # Copyright (C) 2012 Paul Franklin # # This program is free software; you can redistribute it and/or modify # it under the terms of ...
Forage/Gramps
gramps/plugins/textreport/custombooktext.py
Python
gpl-2.0
6,210
from abc import ABCMeta, abstractmethod from flask_babel import gettext from sipa.model.fancy_property import ActiveProperty, Capabilities from sipa.units import format_money from sipa.model.misc import compare_all_attributes class BaseFinanceInformation(metaclass=ABCMeta): """A Class providing finance informat...
lukasjuhrich/sipa
sipa/model/finance.py
Python
mit
2,374
#!/usr/bin/env python """ @package mi.dataset.parser.test.test_presf_abc @file marine-integrations/mi/dataset/parser/test/test_presf_abc.py @author Christopher Fortin, Jeff Roy, Rene Gelinas @brief Test code for a presf_abc data parser """ import os from nose.plugins.attrib import attr from mi.core.exceptions impo...
oceanobservatories/mi-dataset
mi/dataset/parser/test/test_presf_abc.py
Python
bsd-2-clause
9,446
# Copyright 2015 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...
tensorflow/tensorflow
tensorflow/python/saved_model/builder_impl.py
Python
apache-2.0
34,532
# The rand7() API is already defined for you. # def rand7(): # @return a random integer in the range 1 to 7 class Solution: def rand10(self): """ :rtype: int """ while True: row = rand7() col = rand7() index = (row - 1) * 7 + col if in...
jiadaizhao/LeetCode
0401-0500/0470-Implement Rand10() Using Rand7()/0470-Implement Rand10() Using Rand7().py
Python
mit
389
""" API operations on the contents of a history. """ from galaxy import exceptions from galaxy import util from galaxy.web import _future_expose_api as expose_api from galaxy.web import _future_expose_api_anonymous as expose_api_anonymous from galaxy.web import url_for from galaxy.web.base.controller import BaseAPIC...
mikel-egana-aranguren/SADI-Galaxy-Docker
galaxy-dist/lib/galaxy/webapps/galaxy/api/history_contents.py
Python
gpl-3.0
25,537
#Global imports from netmiko import ConnectHandler from datetime import datetime import csv, os.path #Local imports import credentials # Begin timing the script start_time = datetime.now() # Define the primary function (to be moved to a separate module some day...) def nc(username, password, secret, customer): wi...
admiralspark/NetSpark-Scripts
Example_Scripts/Cisco/ismyclockokay.py
Python
gpl-3.0
2,567
# coding=utf-8 import unittest """566. Reshape the Matrix https://leetcode.com/problems/reshape-the-matrix/description/ In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. You're given a matrix represented by a two-dim...
openqt/algorithms
leetcode/python/lc566-reshape-the-matrix.py
Python
gpl-3.0
1,792
''' Created on 22/1/2015 @author: PC08 ''' if __name__ == '__main__': pass
tortolin/tortolin
FlaskItsaeUno/ejemplo.py
Python
gpl-2.0
87
import unittest from pyramid import testing class ViewTests(unittest.TestCase): def setUp(self): self.config = testing.setUp() def tearDown(self): testing.tearDown() def test_my_view(self): from .views import my_view request = testing.DummyRequest() info = my_vie...
kellazo/zodiacbauth
src/zodiacbauth/zodiacbauth/tests.py
Python
gpl-2.0
388
# Copyright 2020 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...
tensorflow/tensorflow
tensorflow/python/ops/numpy_ops/__init__.py
Python
apache-2.0
7,453
from django.conf.urls import url from django.shortcuts import render from django.template.response import TemplateResponse def syntax_error(request): return TemplateResponse( request, "syntax.html", {"coconuts": lambda: 42 / 0}, ) def template_strings(request): return TemplateResponse( r...
prestontimmons/project-15053
project_15053/urls.py
Python
mit
1,935
"""These are bad """ # pylint: disable=missing-docstring # pylint: disable=too-few-public-methods import unittest # This is bad class TestCase(unittest.TestCase): def test_one(self): pass class DerivedTestCase(TestCase): def test_two(self): pass # This is bad, but the author seems to know ...
Sveder/edx-lint
test/input/func_layered_tests.py
Python
apache-2.0
1,314
''' Created on Feb 26, 2016 @author: Christopher Elliott ''' import random import numpy import pygame from numpy.ma.core import floor_divide from operator import attrgetter import sys if __name__ == '__main__': pass MAX_SEATS = 159 #maximum seats in the aircraft MAX_FIRST_CLASS = 12 ...
berge35/Seat-Assignment
main.py
Python
mit
11,716
import logging import re import unittest from functools import wraps import pexpect from flexmock import flexmock_teardown from hamcrest import assert_that, equal_to from tests.util.global_reactor import TEST_SWITCHES def with_protocol(test): @wraps(test) def wrapper(self): try: logging....
internap/fake-switches
tests/util/protocol_util.py
Python
apache-2.0
3,985
""" Get data from the GitHub API and stick it in a local MongoDB for querying """ import sys import urllib2 import json from datetime import datetime from dateutil.relativedelta import relativedelta import dateutil.parser from pymongo import Connection from pymongo.errors import ConnectionFailure def main(): # ...
adamlofting/github_contributors
query_local_database.py
Python
mpl-2.0
1,763
#!/usr/bin/env python ############################################################# # ubi_reader/ubi # (c) 2013 Jason Pruitt (jrspruitt@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 Foundatio...
OpenBlackHole/openmultibootmanager
src/ubi_reader/ubi/__init__.py
Python
gpl-2.0
7,519
# Copyright 2008 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
rhyolight/nupic.son
app/soc/models/user.py
Python
apache-2.0
5,797
# This file is part of the Enkel web programming library. # # Copyright (C) 2007 Espen Angell Kristiansen (espen@wsgi.net) # # 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...
espenak/enkel
testsuite/session/backend.py
Python
gpl-2.0
1,329
# -*- coding: UTF-8 """ Client for web browsing Classes ======= WebClient -- Simple high-level HTTP-client for browsing Attributes ========== TYPE_HTML -- text/html TYPE_JSON -- application/json TYPE_TEXT -- text/plain """ from http.client import HTTPConnection, HTTPSConnection, HTTPResponse from ur...
kawashiro/dewyatochka2
src/dewyatochka/core/utils/http.py
Python
gpl-3.0
6,544
#!/usr/bin/env python # Use Netmiko to execute 'show arp' on pynet-rtr1, pynet-rtr2, and juniper-srx. from netmiko import ConnectHandler def main(): # Definition of routers rtr1 = { 'device_type': 'cisco_ios', 'ip': '50.76.53.27', 'username': 'pyclass', 'password': '88newcl...
dprzybyla/python-ansible
week4/netmiko_sh_arp.py
Python
apache-2.0
1,128
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-08-28 06:27 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('pootle_project', '0016_change_treestyle_choices_label'), ] operations = [ migration...
unho/pootle
pootle/apps/pootle_project/migrations/0017_remove_project_treestyle.py
Python
gpl-3.0
416
# -*- coding: utf-8 -*- # Copyright 2015 Metaswitch Networks # # 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...
TrimBiggs/calico
calico/etcddriver/driver.py
Python
apache-2.0
43,284
import os import unittest from tethys_apps.static_finders import TethysStaticFinder class TestTethysStaticFinder(unittest.TestCase): def setUp(self): self.src_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) self.root = os.path.join(self.src_dir, 'tests', 'apps', ...
tethysplatform/tethys
tests/unit_tests/test_tethys_apps/test_static_finders.py
Python
bsd-2-clause
2,361
# 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 from frappe import throw, _ import frappe.defaults from frappe.utils import cint, flt, get_fullname, cstr from frappe.contacts.doctype.add...
bazz-erp/erpnext
erpnext/shopping_cart/cart.py
Python
gpl-3.0
14,415
"""Test UPnP/IGD config flow.""" from datetime import timedelta import pytest from homeassistant import config_entries, data_entry_flow from homeassistant.components import ssdp from homeassistant.components.upnp.const import ( CONFIG_ENTRY_HOSTNAME, CONFIG_ENTRY_SCAN_INTERVAL, CONFIG_ENTRY_ST, CONFI...
jawilson/home-assistant
tests/components/upnp/test_config_flow.py
Python
apache-2.0
8,675
# Copyright 2013: Mirantis 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 b...
vishnu-kumar/PeformanceFramework
rally_os/deployment/serverprovider/providers/virsh.py
Python
apache-2.0
4,892
import re from vee.pipeline.base import PipelineStep from vee.subproc import call from vee.cli import style_note from vee import log from vee.utils import assert_file_checksum class ArchiveExtractor(PipelineStep): factory_priority = 2000 @classmethod def factory(cls, step, pkg): if step != 'ex...
westernx/vee
vee/pipeline/archive.py
Python
bsd-3-clause
1,749
import sys, cStringIO, os, shutil, re __directory__ = os.path.dirname(__file__) sys.path.extend([os.path.abspath(os.path.join(__directory__, '..', '..', '..'))]) from Sycamore import wikiutil, config, request, caching, wikidb, maintenance, buildDB, wikiacl, maintenance from Sycamore.Page import Page #################...
rtucker/sycamore
share/convert/2006_08_29_wikis/merge.py
Python
gpl-2.0
14,491
import _plotly_utils.basevalidators class UidValidator(_plotly_utils.basevalidators.StringValidator): def __init__(self, plotly_name="uid", parent_name="table", **kwargs): super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kw...
plotly/python-api
packages/python/plotly/plotly/validators/table/_uid.py
Python
mit
427
# Copyright (C) 2018 FreeIPA Contributors see COPYING for license from __future__ import absolute_import import tempfile import pytest from ipaclient.install.client import check_ldap_conf from ipapython.admintool import ScriptError @pytest.mark.parametrize("lines,expected", [ (["PORT 389"], "PORT"), (["H...
encukou/freeipa
ipatests/test_install/test_install_checks.py
Python
gpl-3.0
1,062
import platform class Configure: def __init__(self): pass class ConfigureWin(Configure): def __init__(self): pass class ConfigureLinux(Configure): def __init__(self): pass class ConfigureMac(Configure): def __init__(self): pass
ethanwhite/weaver
manager/settings.py
Python
mit
282
# -*- coding: utf-8 -*- import httplib import pprint import json import sys import logging import datetime import os import os.path import codecs class cmdb( object ): def __init__( self, args , info=None ): self.res = {} self.result = {} self.info = info self.args = args ...
hackshel/metaCollecter
src/metaManager/modules/cmdbServer.py
Python
bsd-3-clause
3,610
from .interfaces import IPyContainerConfigValue from .interfaces import ISparcAppPyContainerConfiguration from .interfaces import ISparcPyContainerConfiguredApplication from .interfaces import ISparcPyDictValueIterator
davisd50/sparc.configuration
sparc/configuration/container/__init__.py
Python
mit
218
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
googleads/google-ads-python
google/ads/googleads/v10/enums/types/webpage_condition_operator.py
Python
apache-2.0
1,199
# 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 ...
rdblue/incubator-nifi
nar-bundles/execute-script-bundle/execute-script-processors/src/test/resources/routeTest.py
Python
apache-2.0
1,503
from input_stream import InputStream # '2+3' -> {type:num, value: 2}, {type:op, value:'+'}, {type:num, value: 3} operators = { '+': {'prec': 10, 'assoc': 'left'}, '*': {'prec': 20, 'assoc': 'left'} } class TokenStream: def __init__(self, text): self.input_stream = InputStream(text + '\n') ...
babu-thomas/calculator-parser
token_stream.py
Python
mit
1,954
#!/usr/bin/python # -*- coding: utf-8 -*- import xbmcaddon,xbmcplugin,xbmcgui,sys,urllib,urllib2,re,socket,os socket.setdefaulttimeout(30) pluginhandle = int(sys.argv[1]) addonID = 'plugin.video.vidstatsx_com' xbox = xbmc.getCondVisibility("System.Platform.xbox") addon = xbmcaddon.Addon(addonID) channelFavsFile=xbmc.t...
AddonScriptorDE/plugin.video.vidstatsx_com
default.py
Python
gpl-2.0
16,692
import numpy as np from tentacle.board import Board from tentacle.dnn3 import DCNN3 from tentacle.strategy import Strategy, Auditor from tentacle.utils import attemper from builtins import (super) class StrategyDNN(Strategy, Auditor): def __init__(self, is_train=False, is_revive=True, is_rl=False, from_file=None, ...
splendor-kill/ml-five
tentacle/strategy_dnn.py
Python
mit
6,056
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright (c) 2014,掌阅科技 All rights reserved. 摘 要: zookeeper.py 创 建 者: zhuangshixiong 创建日期: 2015-06-12 说明: 对zookeeper数据操作的简单封装 ''' from kazoo.client import KazooClient from kazoo.handlers.threading import KazooTimeoutError from model.db.zd_zookeeper import ZdZook...
wolfelee/zkdash
service/zookeeper.py
Python
apache-2.0
3,054
############################################################################################## # Copyright 2014-2015 Cloud Media Sdn. Bhd. # # This file is part of Xuan Automation Application. # # Xuan Automation Application is free software: you can redistribute it and/or modify # it under the terms of the GNU G...
TheStackBox/xuansdk
Automation/automationApp/module/controllerModule.py
Python
gpl-3.0
4,985
#!/usr/bin/env python2 # -*- coding: UTF-8 -*- # File: waveseg.py # Author: Yuxin Wu <ppwwyyxx@gmail.com> import numpy as np import os import matlab import matlab.engine eng = matlab.engine.start_matlab() eng.addpath( os.path.join(os.path.dirname(__file__), 'include/waveseg')) def segment(img):...
summivox/riichi-scan
vendor/waveseg.py
Python
gpl-2.0
706
import json from collections import OrderedDict import pytest from sqlalchemy.sql.elements import or_ from sqlalchemy.sql.functions import Function from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, ForeignKey, Table from sqlalchemy.orm import relationship from fal...
Opentopic/falcon-api
falcon_dbapi/resources/tests/test_sqlalchemy.py
Python
mit
16,542
# Lint as: python2, python3 # Copyright 2019 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 # ...
karllessard/tensorflow
tensorflow/tools/tensorflow_builder/config_detector/data/cuda_compute_capability.py
Python
apache-2.0
7,276
class Foo: def __init__(self): pass class Bar(Foo): pass Bar() #<ref>
asedunov/intellij-community
python/testData/codeInsight/controlflow/superclass.py
Python
apache-2.0
79
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry.page import shared_page_state from telemetry import story class PolymerPage(page_module.Page):...
wuhengzhi/chromium-crosswalk
tools/perf/page_sets/polymer.py
Python
bsd-3-clause
10,354
# -*- # # @author: jaumebonet # @email: jaume.bonet@gmail.com # @url: jaumebonet.github.io # # @date: 2016-01-14 16:17:54 # # @last modified by: jaumebonet # @last modified time: 2016-02-11 13:58:58 # # -*- import json from pynion import Manager from pynion import JSONer from pynion import File from pynion imp...
jaumebonet/RGcrawler
RGcrawler/Author.py
Python
mit
4,204
# Copyright 2012-2017, Damian Johnson and The Tor Project # See LICENSE for licensing information """ Parses replies from the control socket. **Module Overview:** :: convert - translates a ControlMessage into a particular response subclass ControlMessage - Message that's read from the control socket. |- Si...
patrickod/stem
stem/response/__init__.py
Python
lgpl-3.0
18,318
#!/usr/bin/env python3 """ To run: python3 nb2to3.py notebook-or-directory """ # Authors: Thomas Kluyver, Fernando Perez # See: https://gist.github.com/takluyver/c8839593c615bb2f6e80 import argparse import pathlib from nbformat import read, write import lib2to3 from lib2to3.refactor import RefactoringTool, get_fixers...
Alexoner/dev-env
bin/2to3_nb.py
Python
mit
2,340
# -*- coding: utf-8 -*- # Copyright 2014 Scalyr 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...
imron/scalyr-agent-2
tests/unit/util/json_util_test.py
Python
apache-2.0
9,708
""" Django settings for R_hire_project project. Generated by 'django-admin startproject' using Django 1.9. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import ...
sahildua2305/R-Hire
R_hire_project/settings.py
Python
mit
3,536
# Copyright (C) 2021 Red Hat, Inc., Pavel Moravec <pmoravec@redhat.com> # This file is part of the sos project: https://github.com/sosreport/sos # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # version 2 of the GNU Gen...
slashdd/sos
sos/report/plugins/rhui.py
Python
gpl-2.0
2,010
# (c) 2014, Chris Church <chris@ninemoreminutes.com> # # This file is part of Ansible. # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any lat...
maurofaccenda/ansible
lib/ansible/plugins/connection/winrm.py
Python
gpl-3.0
25,232
# -*- coding: utf-8 -*- """Windows user profiles collector.""" from winregrc import interface class UserProfile(object): """User profile. Attributes: profile_path (str): path of the users profile. security_identifier (str): security identifier of the user. """ def __init__(self, security_identifier...
libyal/winreg-kb
winregrc/profiles.py
Python
apache-2.0
1,644
import tvm def test_array(): a = tvm.convert([1,2,3]) assert len(a) == 3 def test_array_save_load_json(): a = tvm.convert([1,2,3]) json_str = tvm.save_json(a) a_loaded = tvm.load_json(json_str) assert(a[1].value == 2) def test_map(): a = tvm.var('a') b = tvm.var('b') amap = tvm.co...
phisiart/tvm
tests/python/unittest/test_lang_container.py
Python
apache-2.0
954
"""JWT authentication scheme for use with DRF.""" from django.conf import settings from django.contrib.auth import get_user_model import requests from rest_framework import exceptions from rest_framework.authentication import get_authorization_header, BaseAuthentication from rest_framework.status import HTTP_200_OK fro...
janusnic/ecommerce
ecommerce/extensions/api/authentication.py
Python
agpl-3.0
4,501
# Copyright (c) 2020 PaddlePaddle 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 app...
luotao1/Paddle
python/paddle/fluid/tests/unittests/xpu/test_softmax_op_xpu.py
Python
apache-2.0
2,896
# -*- coding: utf-8 -*- from textwrap import dedent from modules import constants from modules.file_handling import FileHandling class CommandAttributesHeaderFile: """ """ # Initializes command attributes header content with according defines def __init__(self): self.file_path = constants.S...
stwagnr/tpm2simulator
scripts/modules/part3_commands/tpm2_part3_command_attributes_h.py
Python
bsd-2-clause
2,391
import csv import os from argparse import ArgumentParser from ucca import layer0, layer1 from ucca.ioutil import get_passages_with_progress_bar, write_passage from ucca.normalization import fparent, copy_edge, traverse_up_centers desc = """Change articles to Function, complying with UCCA v2 guidelines""" ARTICLES = ...
danielhers/ucca
scripts/convert_articles_and_reflexives.py
Python
gpl-3.0
5,508
import datetime import functools import operator import re import pytz from guardian.shortcuts import get_objects_for_user from api.base import utils from api.base.exceptions import (InvalidFilterComparisonType, InvalidFilterError, InvalidFilterFieldError, ...
aaxelb/osf.io
api/base/filters.py
Python
apache-2.0
22,346
import imaplib import imaplib_connect with imaplib_connect.open_connection() as c: typ, data = c.select('Does-Not-Exist') print(typ, data)
jasonwee/asus-rt-n14uhp-mrtg
src/lesson_email/imaplib_select_invalid.py
Python
apache-2.0
149
# Utopian Tree # Developer: Murillo Grubler # Link: https://www.hackerrank.com/challenges/utopian-tree/problem # Time Complexity = O(n) def cycle(period): height = 1 for i in range(period): if i % 2 == 0: height = height * 2 else: height = height + 1 return height; ...
Murillo/Hackerrank-Algorithms
Algorithms/Implementation/utopian-tree.py
Python
mit
403
#!/usr/bin/python # @file dlnap.py # @author cherezov.pavel@gmail.com # @brief Python over the network media player to playback on DLNA UPnP devices. # Change log: # 0.1 initial version. # 0.2 device renamed to DlnapDevice; DLNAPlayer is disappeared. # 0.3 debug output is added. Extract location url fixed. #...
XenosLu/dlnap
dlnap/dlnap.py
Python
mit
28,739
#!/usr/bin/env python3 ############################################################################### # $Id: get_soundg.py 428d6fbc987332afb0ba6c7b6913390f7386e864 2020-01-17 22:19:28 +0100 Even Rouault $ # # Project: OGR Python samples # Purpose: Extract SOUNDGings from an S-57 dataset, and write them to # ...
grueni75/GeoDiscoverer
Source/Platform/Target/Android/core/src/main/jni/gdal-3.2.1/swig/python/samples/get_soundg.py
Python
gpl-3.0
3,997
# Copyright 2020 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,...
google/clif
clif/testing/python/nonzero_mapping_test.py
Python
apache-2.0
1,180
# author: Fei Gao # # Unique Paths # # A robot is located at the top-left corner of a m x n grid (marked 'Start' in # the diagram below). # The robot can only move either down or right at any point in time. The robot # is trying to reach the bottom-right corner of the grid (marked 'Finish' in # the diagram below). # Ho...
feigaochn/leetcode
p62_unique_paths.py
Python
mit
892
#! /usr/bin/env python3 import math import argparse from collections import defaultdict import logging def main(): parser = argparse.ArgumentParser(description="Compare two clusters for similarity",) parser.add_argument('-f', '--first', help="First file") parser.add_argument('-s', '--second', help="Second...
ExperimentMonty/research-malware-authorship
compare_cluster.py
Python
mit
3,279
from .pipeline import Pipeline from .reshaper import * from .feature_selection import * from .preprocessing import * from .decomposition import * from .hyperopt import *
rafaeltg/pydl
pydl/models/pipeline/__init__.py
Python
mit
170
import numpy as np from mesonh_atm.mesonh_atmosphere import MesoNHAtmosphere import matplotlib.pyplot as plt from scipy.interpolate import RegularGridInterpolator import modules.cloud as ModCloud #Data without advection path = "/net/skyscanner/volume1/data/mesoNH/ARM_OneHour3600files_No_Horizontal_Wind/" mfiles = [p...
DiegoSelle/master_thesis
cloud_exploration_polar.py
Python
mit
5,150
class PlankError(Exception): pass class TaskNotFound(PlankError): pass class CircularDependency(PlankError): pass
atbentley/plank
plank/errors.py
Python
mit
130
# Copyright 2015 Internap. # # 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, so...
mlecours/netman
netman/core/switch_factory.py
Python
apache-2.0
1,970
# -*- coding: utf-8 -*- # HORTON: Helpful Open-source Research TOol for N-fermion systems. # Copyright (C) 2011-2015 The HORTON Development Team # # This file is part of HORTON. # # HORTON is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by th...
eustislab/horton
horton/__init__.py
Python
gpl-3.0
1,650
#!/home/oscar/anaconda3/bin/python3 from card import Card class HandEval: def __init__(self): pass #return 1 if h1>h2,-1 if h2>h1, 0 if draw def compareHands(toEval): hands = [{},{}] duplicates = [{},{}] #get suits for i in range(0,2): for card in toEval[i]: if card.suit in hands[i]: hands[...
scascar/poker
common/handeval.py
Python
gpl-3.0
1,076
import json import os from django.apps import apps from django.conf import settings from django.contrib.staticfiles.templatetags.staticfiles import static from django.utils.six.moves.urllib.parse import urljoin VERSION_KEY = 'assets-manifest-version' DEFAULT_ASSETS_MANIFEST_FILE = os.path.join( settings.BASE_DIR...
opbeat/django-assets-bundles
django_asset_bundles/readers.py
Python
isc
3,598
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
skosukhin/spack
var/spack/repos/builtin/packages/r/package.py
Python
lgpl-2.1
8,024
import boto.ec2 import yaml conn=boto.ec2.connect_to_region("us-west-1") reservations = conn.get_all_instances() for res in reservations: for inst in res.instances: if 'type' in inst.tags: if inst.tags['type'] == 'db': print inst.private_ip_address ...
dennisjay/tutum-docker-wordpress-extsql
create-connection.py
Python
apache-2.0
687
HOST = "172.31.28.140:27017" PORT = "" USER = "" PASSWORD = "" DATABASE = "google" READ_PREFERENCE = "primary" COLLECTION_INPUT = "stats_cpumemory" COLLECTION_OUTPUT = "ratio" PREFIX_COLUMN = "g_" ATTRIBUTES = ["standard deviation cpu", "average cpu","standard deviation memory", "average memory","standard deviation r...
elainenaomi/sciwonc-dataflow-examples
dissertation2017/Experiment 1A/instances/6_workflow_full_10files_primary_1sh_1rs_with_annot_with_proj_3s/calculateratio_2/ConfigDB_Calc_StatsCPUMemory_2.py
Python
gpl-3.0
406
""" A CUDA ND Array is recognized by checking the __cuda_memory__ attribute on the object. If it exists and evaluate to True, it must define shape, strides, dtype and size attributes similar to a NumPy ndarray. """ import math import functools import operator import copy from ctypes import c_void_p import numpy as n...
stonebig/numba
numba/cuda/cudadrv/devicearray.py
Python
bsd-2-clause
26,839
import os import time import telegram from leonard import Leonard telegram_client = telegram.Bot(os.environ['BOT_TOKEN']) bot = Leonard(telegram_client) bot.collect_plugins() def main(): for subscription in bot.subscriptions: try: subscription['send'](bot, subscription['check'](bot)) ...
sevazhidkov/leonard
jobs/send_subscriptions.py
Python
mit
493
## pygame - Python Game Library ## Copyright (C) 2008 Marcus von Appen ## ## This library is free software; you can redistribute it and/or ## modify it under the terms of the GNU Library General Public ## License as published by the Free Software Foundation; either ## version 2 of the License, or (at ...
JulienMcJay/eclock
windows/Python27/Lib/site-packages/pygame/sndarray.py
Python
gpl-2.0
6,219
""" A limited test module is used for a limited spatial database. """ import os, unittest from models import Country, City, State, Feature from django.contrib.gis import gdal from django.contrib.gis.geos import * from django.core.exceptions import ImproperlyConfigured class GeoModelTest(unittest.TestCase): d...
hugs/django
django/contrib/gis/tests/geoapp/tests_mysql.py
Python
bsd-3-clause
7,942
""" Python module for reading and writing 9ML abstraction layer files in XML format. :copyright: Copyright 2010-2017 by the NineML Python team, see AUTHORS. :license: BSD-3, see LICENSE for details. """ from __future__ import absolute_import from .base import BaseALObject, Parameter from . import dynamics from . impor...
INCF/lib9ML
nineml/abstraction/__init__.py
Python
bsd-3-clause
1,005
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysiteproject.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
bitsnbytes7c8/django-site
manage.py
Python
mit
256
import json import logging import datetime from celery import task import mkt from mkt.constants.regions import REGIONS_CHOICES_SLUG from mkt.monolith.models import MonolithRecord from mkt.site.decorators import use_master from mkt.ratings.models import Review from mkt.webapps.models import AddonUser, Webapp from mkt...
ingenioustechie/zamboni
mkt/stats/tasks.py
Python
bsd-3-clause
6,127
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division from collections import OrderedDict from datetime import datetime from itertools import groupby from django.db import models from django.utils.timezone import get_current_timezone fro...
azavea/nyc-trees
src/nyc_trees/apps/users/models.py
Python
agpl-3.0
14,342
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def countUnivalSubtrees(self, root): """ :type root: TreeNode :rtype: int """ if ...
tedye/leetcode
Python/leetcode.250.count-univalue-subtrees.py
Python
mit
1,019
from .base import FloppyFormsTestCase import floppyforms as forms class IntegerFieldTests(FloppyFormsTestCase): def test_parse_int(self): int_field = forms.IntegerField() result = int_field.clean('15') self.assertEqual(15, result) self.assertIsInstance(result, int)
jonashaag/django-floppyforms
floppyforms/tests/fields.py
Python
bsd-3-clause
305
# Copyright 2016 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...
handroissuazo/tensorflow
tensorflow/contrib/rnn/__init__.py
Python
apache-2.0
3,577
"""criss cross puzzle solving (bruting) by Ange Albertini, 2008 layout ! piece ! y ! j 0 1 2 3 ! i 0 1 2 3 4 x ! ! ! ! ! 0 0!0!0!0!1 0 -+-+-+-+- ! -+-+-+-+- ! ! ! ! ! 1 0!1!0!1!0 1 -+-+-+-+- ! ! !X! ! ! 2 ...
angea/corkami
misc/crisscross.py
Python
bsd-2-clause
2,475
import asyncio import logging from functools import partial import signal import os from aiohttp.web import Application from .utils.monkey_patch import monkey_patch_asyncio_task_factory, monkey_patch_aiohttp_client_session_request, \ monkey_patch_aiohttp_response_init from .bus import TCPBus, PubSubBus from vyked....
1mgOfficial/vyked
vyked/host.py
Python
mit
9,060
import numpy as np import matplotlib.pyplot as plt y=np.arange(1,5) plt.plot(y,y*2) plt.grid(True,color='r',linestyle='-.',linewidth='1') plt.show() #Object Oriented import matplotlib.pyplot as plt import numpy as np x=np.arange(0,10,1) y=np.random.randn(len(x)) fig=plt.figure() ax=fig.add_subplot(111) l,=plt.plot...
csunny/blog_project
source/libs/analysis/src/13_网格-grid/homework.py
Python
mit
386
import base64 from collections import defaultdict import json import hashlib import time from urlparse import urljoin from django.conf import settings from django.contrib.sites.models import Site from constance import config import requests from kuma.core.cache import memcache from .constants import KUMASCRIPT_TIME...
biswajitsahu/kuma
kuma/wiki/kumascript.py
Python
mpl-2.0
10,140
from os import path, makedirs from random import shuffle from fileio import mnist_read, misc from flat import model import tensorflow as tf import numpy as np SAVE_PATH = 'X:/mnist/model/flat/model-epoch' SAVE_DIR = '/'.join(SAVE_PATH.split('/')[0:-1]) if not path.isdir(SAVE_DIR): makedirs(SAVE_DIR) N_EPOCHS = ...
agojiya/mnist-digit-classification
flat/train.py
Python
mit
2,230
import pytest from rlp import decode, DecodingError invalid_rlp = ( '', '\x00\xab', '\x00\x00\xff', '\x83dogcat', '\x83do', '\xc7\xc0\xc1\xc0\xc3\xc0\xc1\xc0\xff', '\xc7\xc0\xc1\xc0\xc3\xc0\xc1' '\x81\x02', '\xb8\x00', '\xb9\x00\x00', '\xba\x00\x02\xff\xff', '\x81\x54' ...
vaporry/pyrlp
tests/test_invalid.py
Python
mit
449
""" WSGI config for Hivemind project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
EternalDeiwos/Hivemind
wsgi.py
Python
mit
393
#! /usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2014, Nicolas P. Rougier. All rights reserved. # Distributed under the terms of the new BSD License. # --------------------------------------------------------------------------...
duyuan11/glumpy
examples/geometry-surface.py
Python
bsd-3-clause
5,316