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
class Solution(object): def minCut(self, s): """ :type s: str :rtype: int """ if not s: return 0 sz = len(s) # dp[i][j] min cut for s[i...j] i, j included dp = [[0 for _ in xrange(sz)] for _ in xrange(sz)] for i in reversed(xrange...
marcogx/algorithms-in-python
dp/lec_132_palindrome_partitioning_II.py
Python
mit
882
# Copyright 2013 Google Inc. All Rights Reserved. """'dns changes get' command.""" from apiclient import errors from googlecloudsdk.calliope import base from googlecloudsdk.calliope import exceptions from googlecloudsdk.core import properties from googlecloudsdk.dns.lib import util class Get(base.Command): """Ge...
harshilasu/LinkurApp
y/google-cloud-sdk/lib/googlecloudsdk/dns/dnstools/changes/get.py
Python
gpl-3.0
1,992
#!/usr/bin/env python3 # encoding: utf-8 """Implements TabStop transformations.""" import re import sys from UltiSnips.text import unescape, fill_in_whitespace from UltiSnips.text_objects.mirror import Mirror def _find_closing_brace(string, start_pos): """Finds the corresponding closing brace after start_pos."...
khatchad/vimrc
sources_non_forked/ultisnips/pythonx/UltiSnips/text_objects/transformation.py
Python
mit
5,641
# coding=utf-8 """Cadasta project update test .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. """ __...
Cadasta/cadasta-qgis-plugin
cadasta/gui/tools/test/test_cadasta_project_update.py
Python
gpl-3.0
2,212
""" Slovak regions according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska """ from django.utils.translation import ugettext_lazy as _ REGION_CHOICES = ( ('BB', _('Banska Bystrica region')), ('BA', _('Bratislava region')), ('KE', _('Kosice region')), ('NR', _('Nitra regi...
ychen820/microblog
y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/contrib/localflavor/sk/sk_regions.py
Python
bsd-3-clause
458
"Test debugobj_r, coverage 56%." from idlelib import debugobj_r import unittest class WrappedObjectTreeItemTest(unittest.TestCase): def test_getattr(self): ti = debugobj_r.WrappedObjectTreeItem(list) self.assertEqual(ti.append, list.append) class StubObjectTreeItemTest(unittest.TestCase): ...
FFMG/myoddweb.piger
monitor/api/python/Python-3.7.2/Lib/idlelib/idle_test/test_debugobj_r.py
Python
gpl-2.0
545
# -*- encoding: utf-8 -*- ############################################################################## # # Moodle Webservice # Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved. # Raimon Esteve <resteve@zikzakmedia.com> # Jesus Martín <j...
zikzakmedia/python-moodle
examples/config.py
Python
agpl-3.0
1,228
# -*- coding: utf-8 -*- """ sphinx.ext.todo ~~~~~~~~~~~~~~~ Allow todos to be inserted into your documentation. Inclusion of todos can be switched of by a configuration variable. The todolist directive collects all todos of your project and lists them along with a backlink to the original loc...
GbalsaC/bitnamiP
venv/lib/python2.7/site-packages/sphinx/ext/todo.py
Python
agpl-3.0
5,764
############################### # This file is part of PyLaDa. # # Copyright (C) 2013 National Renewable Energy Lab # # PyLaDa is a high throughput computational platform for Physics. It aims to # make it easier to submit large numbers of jobs on supercomputers. It # provides a python interface to physical input, ...
pylada/pylada-light
tests/process/test_jobfolder.py
Python
gpl-3.0
8,643
# -*- coding: utf-8 -*- # # Copyright (C) 2013-2017 Gauvain Pocentek <gauvain@pocentek.net> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at you...
ExodusIntelligence/python-gitlab
gitlab/v4/objects.py
Python
lgpl-3.0
81,351
nums = Array.new puts "Enter a number at each prompt" for i in 0...11 print ">" nums[i]= gets.to_i end nums.reverse.each do |x| y = Math.sqrt(x.abs) + 5*x**3 puts " for x=#{x} result is #{(y>400) ? ' too large' : y}" end
walterfan/snippets
python/exam/TPK.py
Python
apache-2.0
228
from pyspark.sql import SparkSession spark = SparkSession\ .builder\ .appName("Signed Network Experiment")\ .getOrCreate() sc = spark.sparkContext sc.setCheckpointDir('.checkpoint') # stackoverflow errors
xiaohan2012/snpp
snpp/utils/spark.py
Python
mit
231
# encoding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import compat_urllib_parse_urlparse from ..utils import ( ExtractorError, HEADRequest, unified_strdate, qualities, int_or_none, ) class CanalplusIE(InfoExtractor): IE_DESC = 'c...
mxamin/youtube-dl
youtube_dl/extractor/canalplus.py
Python
unlicense
6,705
# -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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 appl...
our-city-app/oca-backend
src/rogerthat/bizz/jobs/__init__.py
Python
apache-2.0
17,649
# -*- coding: utf-8 -*- """ python3 listcomp : 0.013 0.015 0.017 listcomp + func : 0.019 0.019 0.019 filter + lambda : 0.020 0.020 0.025 filter + func : 0.019 0.020 0.020 """ import timeit TIMES = 10000 SETUP = """ symbols = '$¢£¥€¤' def non_ascii(c): return c > 127 """ def clock(label, cmd): ...
wuqize/FluentPython
chapter2/listcomp_speed.py
Python
lgpl-3.0
734
#!/usr/bin/env python import os import sys if __name__ == '__main__': os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings') from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
eduardoklosowski/ergo-notes
manage.py
Python
agpl-3.0
243
# Copyright 2014-2015 Tecnativa S.L. - Jairo Llopis # Copyright 2016 Tecnativa S.L. - Vicent Cubells # Copyright 2017 Tecnativa S.L. - David Vidal # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Partner Contact Department", "summary": "Assign contacts to departments", "vers...
OCA/partner-contact
partner_contact_department/__manifest__.py
Python
agpl-3.0
765
#!/usr/bin/env python # 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...
Acimaz/Google_Apple_Financial_Reporter
lib/third_party/apiclient/push.py
Python
mit
7,889
"""The samsungtv component."""
fbradyirl/home-assistant
homeassistant/components/samsungtv/__init__.py
Python
apache-2.0
31
# coding: utf-8 # # Some meta comments # # * My teaching feedback # * References to the future are mostly just abstract without a mental map. # * Same is true with references to other programming languages if you are not # familiar with them. # * Focus on one teaching object at a time. # * Devices in class room ...
CUBoulder-ASTR2600/lectures
lecture_04_for_loops.py
Python
isc
12,315
""" Supplies the internal functions for functools.py in the standard library """ # reduce() has moved to _functools in Python 2.6+. reduce = reduce class partial(object): """ partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. """ def __in...
jedie/pypyjs-standalone
website/js/pypy.js-0.3.0/lib/modules/_functools.py
Python
mit
1,706
# Copyright (c) 2015, Matt Layman import os import sys try: from unittest import SkipTest except ImportError: class SkipTest(object): """SkipTest does not exist earlier than Python 2.7""" pass from nose.plugins import Plugin from nose.suite import ContextSuite from tap.i18n import _ from tap...
blakev/tappy
tap/plugin.py
Python
bsd-2-clause
3,857
#!/usr/bin/env python # -*- coding: utf-8 -*- # portable decryption functions and BSD DB parsing by Laurent Clevy (@lorenzo2472) # from https://github.com/lclevy/firepwd/blob/master/firepwd.py import hmac import json import sqlite3 import struct import traceback import os from lazagne.config.module_info import Module...
AlessandroZ/LaZagne
Linux/lazagne/softwares/browsers/mozilla.py
Python
lgpl-3.0
21,726
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
zgchizi/oppia-uc
extensions/interactions/EndExploration/EndExploration.py
Python
apache-2.0
1,802
#http://www.mhermans.net/from-pdf-to-wordcloud-using-the-python-nltk.html #! /usr/bin/env python # wordcount.py: parse & return word frequency import nltk from hd_jobs.common import * def generateTextBlogFromCounts(counts): text_blob = "" for word,count in counts.items(): for i in range(count): ...
mhfowler/howdoispeak_django
hd_jobs/calculate_word_freq.py
Python
mit
3,174
# -*- coding: utf-8 -*- # 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, softw...
grahamhayes/launchjira
LaunchJira/tests/test_LaunchJira.py
Python
apache-2.0
779
''' TwoSum: Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are no...
cqf1991/LeetCode
twoSum___001(AC).py
Python
mit
1,593
#!/usr/bin/env python ''' File: ScrollingTweets.py Version: 2.2 Date: February 2015 Author: Lynsay A. Shepherd License: MIT License (MIT) Description: Scroll your Twitter feed on an LCD screen connected to the GPIO of a Raspberry Pi. #Requires several libraries... #The Adafruit_CharLCDPlate library- https://...
Lynsay/TweetsScrollingPi
ScrollingTweets.py
Python
mit
4,676
# -*- coding: utf-8 -*- # © 2014 Akretion - Alexis de Lattre <alexis.delattre@akretion.com> # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields, api class AccountInvoice(models.Model): _inherit = 'account.invoic...
hbrunn/bank-payment
account_payment_partner/models/account_invoice.py
Python
agpl-3.0
1,432
from djangobench.utils import run_benchmark from query_values.models import Book def benchmark(): list(Book.objects.values('title')) run_benchmark( benchmark, meta = { 'description': 'A simple Model.objects.values() call.', } )
alex/djangobench
djangobench/benchmarks/query_values/benchmark.py
Python
bsd-3-clause
254
from google.appengine.api import users from google.appengine.ext import db from model import User from model import InputFeed latest_signup = None @db.transactional def create_user(google_user): global latest_signup user = User( google_user=google_user ) user.put() latest_signup = user ...
studyindenmark/newscontrol
utils.py
Python
mit
1,908
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of AudioLazy, the signal processing Python package. # Copyright (C) 2012-2014 Danilo de Jesus da Silva Bellini # # AudioLazy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # ...
antiface/audiolazy
examples/zcross_pitch.py
Python
gpl-3.0
3,452
#!/usr/bin/env python # run a ROS simulator as a child process import sys, os, pexpect, socket import math, time, select, struct, signal, errno sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'pysim')) import util, atexit from pymavlink import fgFDM class control_state(object): ...
Yndal/ArduPilot-SensorPlatform
ardupilot/Tools/autotest/ROS/runsim.py
Python
mit
8,448
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import numpy as np ext_module = Extension( 'cchol', ['cchol.pyx'], include_dirs=[np.get_include()])#, ''' extra_compile_args=['-fopenmp'], ...
pysal/pPysal
chol/setup.py
Python
bsd-3-clause
442
# Copyright (C) 2010 Canonical # # Authors: # Michael Vogt # Gary Lasker # # 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; version 3. # # This program is distributed in the hope that it will b...
gusDuarte/software-center-5.2
softwarecenter/ui/gtk3/views/webkit.py
Python
lgpl-3.0
6,532
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.auth.models import User from django.db import models class Link(models.Model): STATUS_ITEMS = ( (1, '正常'), (2, '删除'), ) title = models.CharField(max_length=50, verbose_name="标题") href = models.URLFiel...
BaskerShu/typeidea
typeidea/config/models.py
Python
mit
2,033
from distutils.core import setup setup( name='EditREPL', version='2013.06.20', author='Philip Bjorge', author_email='philipbjorge@gmail.com', packages=['editrepl'], scripts=[], url='https://github.com/philipbjorge/EditREPL', license='LICENSE.txt', description='Use your CLI text edit...
philipbjorge/EditREPL
setup.py
Python
bsd-3-clause
408
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import serial import time STOP_CODE = "3" FORWARD_CODE = "4" BACKWARD_CODE = "2" RIGHT_CODE = "5" LEFT_CODE = "6" TOWER_LEFT_CODE = "7" TOWER_RIGHT_CODE = "8" ser = serial.Serial("/dev/ttyUSB0", 9600) s = ser.readline() time.sleep(0.5) class AntBody(object): """...
icewind666/fortress
raspberry_test/rasp_to_arduino.py
Python
mit
2,312
# 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...
snnn/tensorflow
tensorflow/python/keras/optimizer_v2/adadelta_test.py
Python
apache-2.0
6,865
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
google/mirandum
alerts/twitchaccount/views.py
Python
apache-2.0
4,442
#!/usr/bin/env python # coding:utf8 #import urllib2 import urllib.request #this is the old urllib2 import re,json,codecs iphoneUrl = "http://search.jd.com/Search?keyword=%E8%8B%B9%E6%9E%9C%E6%89%8B%E6%9C%BA&enc=utf-8&qr=&qrst=UNEXPAND&as_key=title_key%2C%2C%E6%89%8B%E6%9C%BA&rt=1&stop=1&click=&psort=1&page=1" heade...
PythonT/Crawler
JDCrawler.py
Python
apache-2.0
2,253
"""""" from __future__ import annotations from abilian.web.action import FAIcon, Glyphicon, StaticIcon def test_glyphicons(): icon = Glyphicon("ok") assert icon.__html__() == '<i class="glyphicon glyphicon-ok"></i>' def test_faicons(): icon = FAIcon("check") assert icon.__html__() == '<i class="fa ...
abilian/abilian-core
src/abilian/web/tests/test_icons.py
Python
lgpl-2.1
1,388
import copy def go(): max_queens = 0 cols_count = 8 rows_count = 8 matrix = [[0] * cols_count for _ in xrange(rows_count)] init_matrix = [[0] * cols_count for _ in xrange(rows_count)] initial_queens_input = [(0, 3)] new_queens = [] all_queens = copy.deepcopy(initial_queens_input) n...
nimiq/kpn-hackathon-queens
maxqueens/sol2.py
Python
mit
6,311
#!/usr/bin/python3 # launch command for the animation of a MSS # (c) Yukao Nagemi import sys # sys.path.append('/mnt/d/sync.com/Sync/LYM-sources/vv/vv_python/') sys.path.append('D:\\sync.com\\Sync\\LYM-sources\\vv\\vv_python\\') sys.path.append('D:\\sync.com\\Sync\\LYM-sources\\pg-sensors') import pg_sensors from si...
yukao/Porphyrograph
LYM-projects/batFiles/araknit-mss.py
Python
gpl-3.0
869
from lingcod.common import uaparser fh = open('top50.txt','r') for ua in [x.strip() for x in fh.readlines()]: print uaparser.browser_platform(ua)
Alwnikrotikz/marinemap
lingcod/common/uaparser/tests.py
Python
bsd-3-clause
153
from __future__ import print_function import os import sys import subprocess try: # Older Pythons lack this import urllib.request # We'll let them reach the Python from importlib.util import find_spec # check anyway except ImportError: pass...
TwilightDweller/JB-Bot
launcher.py
Python
gpl-3.0
18,415
from taggit.forms import TagField as TaggitTagField from taggit.models import Tag from wagtail.admin.widgets import AdminTagWidget class TagField(TaggitTagField): """ Extends taggit's TagField with the option to prevent creating tags that do not already exist """ widget = AdminTagWidget def __i...
wagtail/wagtail
wagtail/admin/forms/tags.py
Python
bsd-3-clause
1,393
class Battery(object): def __init__(self, capacity_ah): self.capacity_ah = capacity_ah self.available_ah = capacity_ah
MITEVT/soc-modeling
src/battery.py
Python
mit
127
import pickle import time from emonitor.lib.osm.OsmApi import OsmApi def loadOsmData(**kwargs): i = 0 if 'lat' in kwargs: lat = kwargs['lat'] if 'lng' in kwargs: lng = kwargs['lng'] if 'path' in kwargs: path = kwargs['path'] MyApi = OsmApi(debug=True) for x in ra...
digifant/eMonitor
emonitor/lib/osm/loaddata.py
Python
bsd-3-clause
4,841
# Generated by Django 2.2.13 on 2021-03-01 18:37 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('base', '0044_appconfig_sapl_as_sapn'), ] operations = [ migrations.AlterField( model_name='appconfig', name='sapl_a...
interlegis/sapl
sapl/base/migrations/0045_auto_20210301_1537.py
Python
gpl-3.0
483
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import sys def _hex(ch): hv = hex(ord(ch)).replace('0x', '') hv.zfill(2) return hv.upper() # URL escapes the delimiter characters from t...
danakj/chromium
tools/variations/fieldtrial_util.py
Python
bsd-3-clause
3,428
from azure.storage.blob import BlockBlobService from azure.storage.blob import ContentSettings import os import sys def upload_results(buildId): blob_service = BlockBlobService(account_name='gpuvmtemplatedisks530', account_key='9aSfzJqvoasgkzMod9qNJGDabjtSUbibZjjvsnvHaYMatASwF/y9kH2nbTAOKnLb7bLWjdIJUdwzXhTCvO2L/g=='...
wbuchwalter/on-demand-training-cntk
src/helper.py
Python
mit
832
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from six import stri...
tejal29/pants
src/python/pants/base/validation.py
Python
apache-2.0
1,877
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "infolobbyweb.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
ciudadanointeligente/lobby_cplt
manage.py
Python
agpl-3.0
255
# -*- coding: utf-8 -*- # # Copyright 2008 - 2014 Brian R. D'Urso # # This file is part of Python Instrument Control System, also known as Pythics. # # Pythics 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, e...
LunarLanding/Pythics
pythics/mpl.py
Python
gpl-3.0
70,449
"""Initialize migration repo Revision ID: f7c7d7bf5a1 Revises: None Create Date: 2015-10-22 00:37:15.516088 """ # revision identifiers, used by Alembic. revision = 'f7c7d7bf5a1' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please a...
richgieg/auto-store
migrations/versions/f7c7d7bf5a1_initialize_migration_repo.py
Python
mit
1,093
""" This module provides date summary blocks for the Course Info page. Each block gives information about a particular course-run-specific date which will be displayed to the user. """ import datetime from babel.dates import format_timedelta from django.core.urlresolvers import reverse from django.utils.functional imp...
pepeportela/edx-platform
lms/djangoapps/courseware/date_summary.py
Python
agpl-3.0
10,479
# Copyright 2011 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # 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 ...
spring-week-topos/cinder-week
cinder/tests/test_wsgi.py
Python
apache-2.0
10,194
# -*- coding: utf-8 -*- import unittest import wx from test.basetestcases import BaseOutWikerGUIMixin from outwiker.pages.wiki.wikipage import WikiPageFactory from outwiker.pages.wiki.actions.wikistyle import WikiStyleOnlyAction from outwiker.gui.tester import Tester class WikiStyleNameActionTest(unittest.TestCase...
unreal666/outwiker
src/test/actions/test_wikistylename.py
Python
gpl-3.0
3,138
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('portfolio', '0014_auto_20160116_0332'), ] operations = [ migrations.AlterModelOptions( name='canvasappportfolioi...
nino-c/plerp.org
src/portfolio/migrations/0015_auto_20160116_0513.py
Python
mit
877
from twisted.protocols.basic import LineReceiver from pymudclient.escape_parser import EscapeParser import json from pymudclient.metaline import json_to_metaline, metaline_to_json, simpleml,\ Metaline from twisted.internet.task import LoopingCall from operator import attrgetter from zope.interface.declarations impo...
dmoggles/pymudclient
pymudclient/processor.py
Python
gpl-3.0
10,686
#!/usr/bin/env python2 import sys, getopt import re import time def get_option(): opts, args = getopt.getopt(sys.argv[1:], "hi:o:") input_file = "" output_file = "" h = "" for op, value in opts: if op == "-i": input_file = value elif op == "-o": output_file = value elif op == "-h": h = "E-value di...
sdws1983/bioinfo-relate
Blast-relate/E-value-distribution.py
Python
gpl-3.0
1,085
''' Defines containers for starting and managing tasks. @author: Peter Parente <parente@cs.unc.edu> @copyright: Copyright (c) 2008 Peter Parente @license: BSD License All rights reserved. This program and the accompanying materials are made available under the terms of The BSD License which accompanies this distribut...
parente/clique
View/Task/Container.py
Python
bsd-3-clause
28,087
# -*- coding: utf-8 -*- # Given an unsorted integer array, find the first missing positive integer. # # For example, # Given [1,2,0] return 3, # and [3,4,-1,1] return 2. # [1,3,4,2,5,8,9,7] # Your algorithm should run in O(n) time and uses constant space. # 根据题目来看, find the first minimum missing positive integer, 所以一定...
ddu7/PyLC
041First Missing Positive.py
Python
mit
1,058
../../../../../../share/pyshared/Crypto/Random/Fortuna/SHAd256.py
Alberto-Beralix/Beralix
i386-squashfs-root/usr/lib/python2.7/dist-packages/Crypto/Random/Fortuna/SHAd256.py
Python
gpl-3.0
65
#!/usr/bin/env python # -*- coding: utf-8 -*- # Software License Agreement (BSD License) # # Copyright (c) 2014, Ocean Systems Laboratory, Heriot-Watt University, UK. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the follow...
decabyte/vehicle_core
src/node_path.py
Python
bsd-3-clause
18,472
#!/usr/bin/env python2 import abc from operator import attrgetter from ply.lex import LexToken IGNORE_KEYS = {'tokens', '_fields'} class SourceElement(object): """ A SourceElement is the base class for all elements that occur in a Java file parsed by plyj. The "tokens" field is a dictionary of list...
Craxic/plyj
plyj/model/source_element.py
Python
bsd-3-clause
12,203
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Top-level presubmit script for kernel. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the pres...
ArthySundaram/firstrepo
PRESUBMIT.py
Python
gpl-2.0
1,738
import os from modules.computation.Dataset import Dataset def _main(): print "S'han creat els arxius de test i train dins de la carpeta 2_datasets" pathHome = os.path.abspath('C:\Users\Adria\Documents\upc_temp\gdsa\Projecte\proves_proj\emohe-pyxel-deb01cc5202e') pathWork = os.path.join(path...
lau92/GDSA
Visual/2_datasets.py
Python
gpl-3.0
1,121
# -*- coding: utf-8 -*- import os, codecs, re, sys import numpy as np import itertools from sklearn.feature_extraction import DictVectorizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import TfidfVectorize...
jannson/Similar
sklearn_classify.py
Python
mit
624
from ase import Atoms, view from gpaw import FermiDirac, Mixer from gpaw.transport.calculator import Transport from gpaw.atom.basis import BasisMaker from gpaw.poisson import PoissonSolver import pickle import numpy as np Ly=7.0 Lx= 30. Lz= 30. C_C=1.42 C_H=1.1 basis = 'sz' atoms = Atoms('C18H3', pbc=(0, 0, 0), cell=...
qsnake/gpaw
doc/documentation/transport/transport_multi_terminal.py
Python
gpl-3.0
3,975
from pylgn.tools import* import quantities as pq import pytest def test_heaviside_nonlinearity(): rates = np.array([0, 1, 2, 3, 4.5])*pq.Hz assert (heaviside_nonlinearity(rates) == rates).all() rates = np.array([0, -1, -22, -3.1, 1])*pq.Hz assert (heaviside_nonlinearity(rates) == np.array([0, 0, 0, 0...
miladh/pylgn
pylgn/tests/test_tools.py
Python
gpl-3.0
1,417
# -*- coding: utf-8 -*- # # This file is part of INSPIRE-SCHEMAS. # Copyright (C) 2019 CERN. # # INSPIRE-SCHEMAS 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 o...
inspirehep/inspire-schemas
tests/unit/test_conference_reader.py
Python
gpl-2.0
3,208
# This example requires the 'message_content' privileged intent to function. from typing import List from discord.ext import commands import discord # Defines a custom button that contains the logic of the game. # The ['TicTacToe'] bit is for type hinting purposes to tell your IDE or linter # what the type of `self.v...
Rapptz/discord.py
examples/views/tic_tac_toe.py
Python
mit
4,633
from prestans.http import STATUS from prestans import parser from prestans.provider import auth from prestans import rest from prestans import types import json from mock import patch, PropertyMock import pytest import unittest class PersonREST(types.Model): first_name = types.String() last_name = types.Stri...
anomaly/prestans
tests/issues/test_issue155.py
Python
bsd-3-clause
2,775
#! /usr/bin/env python ############################################################################### # # simulavr - A simulator for the Atmel AVR family of microcontrollers. # Copyright (C) 2001, 2002 Theodore A. Roth # # This program is free software; you can redistribute it and/or modify # it under the terms of th...
tmatsuya/milkymist-ml401
cores/softusb/navre_regress/test_opcodes/test_NEG.py
Python
lgpl-3.0
3,107
from __future__ import division, print_function, absolute_import from .basenet import BaseNet import selfsup from selfsup.util import DummyDict import selfsup.alex_bn2 import selfsup.model.alex import selfsup.model.alex_bn import selfsup.model.alex_bn2 import selfsup.model.alex_transposed MEAN = 114.154 / 255.0 class...
gustavla/self-supervision
selfsup/multi/basenets/alex.py
Python
bsd-3-clause
4,018
#!/usr/bin/env python # -*- coding: latin-1 -*- import csv from time import time,sleep import RPi.GPIO as GPIO import os import signal import sys ####################### Fonction Lecture Analogique ############################################## # Lit les données SPI d'une puce MCP3008, 8 canaux disponibles (adcnum de...
kindermoumoute/selfdrivingcar
exemple code/domotique/Debug_Porte.py
Python
apache-2.0
5,567
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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) an...
nrwahl2/ansible
lib/ansible/playbook/included_file.py
Python
gpl-3.0
6,396
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # 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...
asadoughi/python-neutronclient
neutronclient/neutron/v2_0/vpn/utils.py
Python
apache-2.0
4,470
# -*- coding: utf-8 -*- # # ----------------------------------------------------------------------------------- # Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this softw...
xunxunzgq/open-hackathon-bak_01
open-hackathon-server/src/hackathon/docker/hosted_docker.py
Python
mit
24,562
DEBUG = True TEMPLATE_DEBUG = True # This database is for user management. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': '/tmp/app.db' } } # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.5/ref/...
lingxiaoyang/N2O
app/settings.py
Python
mit
3,561
#!/usr/bin/evn python print('#1 Exceptuion class inheritance order') try: int(list()) except TypeError as terr: print('Raised TypeError') except Exception as err: print('Raised Exception') print()
VlasovVitaly/internal
syntax/exceptions.py
Python
mit
211
import re import string import itertools from typing import List from urllib.parse import urlparse import requests import lxml.html from lxml.html import HtmlElement from models import Post, Vote, QuoteSummary _HEADERS = {'user-agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0'...
TripleSnail/mafia_analyze
src/scraper.py
Python
mit
4,014
from .core import analIce
danielwikstrom/Verificacion
sample/__init__.py
Python
mit
25
#!/usr/bin/env python # coding=utf-8 import subprocess import os import shutil import filecmp TEMPLATE_VERSION = 2 new_default_file_path = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File Templates/Source" new_file_category_path = "/Applications/Xcode.app...
spWang/gitHooks
xcodetemplate.py
Python
mit
5,507
#!/usr/bin/python from datetime import datetime,timedelta import time f = open('../btceUSD.csv','r') out = open('out.csv','w') def nextHour(date): d = datetime(year=date.year, month=date.month, day=date.day, hour=date.hour) return d + timedelta(hours=1) lastHour = None lastPrice = None lastDelta = None v...
babsher/ann-indicator
src/sampler.py
Python
mit
1,342
#!/usr/bin/env python import ephem import datetime Boston = ephem.Observer() Boston.lat = "42.3462" Boston.lon = "-71.0978" Boston.date = datetime.datetime.now() # %% these parameters are for super-precise estimates, not necessary. Boston.elevation = 3 # meters Boston.pressure = 1010 # millibar Boston.temp = 25 # d...
scienceopen/python-matlab-examples
sunriseSunset.py
Python
mit
539
# -*- coding: utf-8 -*- """ DrQueue render template for Luxrender Copyright (C) 2011 Andreas Schroeder This file is part of DrQueue. Licensed under GNU General Public License version 3. See LICENSE for details. """ import os import DrQueue from DrQueue import engine_helpers def run_renderer(env_dict): # defi...
jedie/DrQueueIPython
etc/luxrender_sg.py
Python
gpl-3.0
1,338
import unittest class Test_test_PortList(unittest.TestCase): def test_A(self): self.fail("Not implemented") if __name__ == '__main__': unittest.main()
ewascent/PySniffer
Tests/test_PortList.py
Python
apache-2.0
169
#!/usr/bin/env python """ Pymodbus Synchronous Server Example -------------------------------------------------------------------------- The synchronous server is implemented in pure python without any third party libraries (unless you need to use the serial protocols which require pyserial). This is helpful in constra...
jmmoser/node-drivers
test/integration/modbus/server.py
Python
mit
6,675
#!/opt/venvs/securedrop-app-code/bin/python # -*- coding: utf-8 -*- import argparse import io import logging import os import glob import re import signal import subprocess import sys import textwrap from argparse import _SubParsersAction from typing import Optional from typing import Set from typing import List impo...
freedomofpress/securedrop
securedrop/i18n_tool.py
Python
agpl-3.0
24,081
# encoding: UTF-8 ''' vn.ksotp的gateway接入 ''' import os import json from vnksotpmd import MdApi from vnksotptd import TdApi from ksotpDataType import * from vtGateway import * # 以下为一些VT类型和CTP类型的映射字典 # 价格类型映射 priceTypeMap = {} priceTypeMap[PRICETYPE_LIMITPRICE] = defineDict["KS_OTP_OPT_LimitPrice"] priceTypeMap[PRIC...
leechor/vnpy
vn.trader/ksotpGateway.py
Python
mit
68,106
# Copyright (C) 2015 Nippon Telegraph and Telephone 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 appli...
osrg/ops-gobgp
connection.py
Python
apache-2.0
4,886
# -*- encoding: utf-8 -*- """ Групповое присваивание """ v = ('a', 'b', 'e') (x, y, z) = v print x print y print z
h4/fuit-webdev
examples/lesson2/3.1/2.2.4.py
Python
mit
180
class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ pos = 0 max_pos = nums[0] while True: if max_pos >= len(nums)-1: return True next_max_pos = max_pos for i in range(pos+1, min(max_pos+1, len(nums))): next_max_pos = max(next_max_pos, nums[i]+i) ...
xingjian-f/Leetcode-solution
55. Jump Game.py
Python
mit
408
# -*- coding: utf-8 -*- """ 2. Adding __str__() or __unicode__() to models Although it's not a strict requirement, each model should have a ``_str__()`` or ``__unicode__()`` method to return a "human-readable" representation of the object. Do this not only for your own sanity when dealing with the interactive prompt, ...
LethusTI/supportcenter
vendor/django/tests/modeltests/str/models.py
Python
gpl-3.0
1,214
################################################### # This is a basic script to carry on a conversation # with ghost ################################################### # create service ghost = Runtime.start("ghost", "WebGui") ear = Runtime.start("ear", "WebkitSpeechRecognition") ghostchat = Runtime.start("ghostchat"...
MyRobotLab/pyrobotlab
home/Humanoid/ghost.py
Python
apache-2.0
934
#!/usr/bin/env python import json import os import logging from functools import wraps from flask import Flask, request, make_response, abort from weasyprint import HTML, CSS app = Flask('pdf') def authenticate(f): @wraps(f) def checkauth(*args, **kwargs): if 'X_API_KEY' not in request.headers or o...
aquavitae/docker-weasyprint
wsgi.py
Python
gpl-3.0
3,486
"""Benchmarks for peak finding related functions.""" from __future__ import division, print_function, absolute_import try: from scipy.signal import find_peaks, peak_prominences, peak_widths from scipy.misc import electrocardiogram except ImportError: pass from .common import Benchmark class FindPeaks(B...
lhilt/scipy
benchmarks/benchmarks/peak_finding.py
Python
bsd-3-clause
1,586