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 |
|---|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import time
import re
import unittest
zncz_pocz = 'godz_pocz'
zncz_kon = 'godz_kon'
etkt_pocz = 'BEGIN:'
etkt_kon = 'END:'
znak_daty_pocz = 7
znak_daty_kon = 32
rozmiar_daty = 19
wzorcowa_data_pocz = 'BEGIN: 2012.12.29_13.01.23 END: 0000.00.00_00.00.00'
sama_wzorcowa_data =... | kwadrat/ipij_vim | rdzen_vim.py | Python | isc | 6,361 | 0.005823 |
from rest_framework.pagination import PageNumberPagination
from rest_framework.viewsets import ReadOnlyModelViewSet
from apps.splash.api.serializers import SplashEventSerializer
from apps.splash.filters import SplashEventFilter
from apps.splash.models import SplashEvent
class HundredItemsPaginator(PageNumberPaginati... | dotKom/onlineweb4 | apps/splash/api/views.py | Python | mit | 665 | 0 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
sys.path.insert(0,'..')
import tensorflow as tf
import numpy as np
import itertools
import pickle
import os
import re
import inception_v4
os.environ['CUDA_VISIBLE_DEVICES'] = ''
def atoi(text):
... | xwzy/triplet-deep-hash-pytorch | triplet-deep-hash-pytorch/src/extract_feature/convert_weights/convert_weights_to_keras.py | Python | apache-2.0 | 1,736 | 0.035138 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
from pages.base import BasePage, BaseRegion
class ContactPage(BasePage):
... | ericawright/bedrock | tests/pages/contact.py | Python | mpl-2.0 | 2,012 | 0.001988 |
# 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 ... | airbnb/kafka | tests/kafkatest/tests/produce_consume_validate.py | Python | apache-2.0 | 8,828 | 0.003285 |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2016 University of Tuebingen, CERN.
# Copyright (C) 2015 University of Tuebingen.
#
# B2Share 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... | SarahBA/b2share | b2share/modules/communities/views.py | Python | gpl-2.0 | 10,646 | 0.00047 |
import os
import logging
import boto3
import mimetypes
from datetime import datetime
from morphium.util import env, TAG_LATEST
log = logging.getLogger(__name__)
config = {}
class Archive(object):
"""A scraper archive on S3. This is called when a scraper has generated a
file which needs to be backed up to a ... | pudo/morphium | morphium/archive.py | Python | mit | 2,477 | 0 |
"""Forms for the Wiki module."""
from __future__ import annotations
from typing import Any
from wtforms import HiddenField, StringField, TextAreaField, ValidationError
from wtforms.validators import data_required
from abilian.i18n import _, _l
from abilian.web.forms import Form
from abilian.web.forms.filters import ... | abilian/abilian-sbe | src/abilian/sbe/apps/wiki/forms.py | Python | lgpl-2.1 | 1,942 | 0.00103 |
"""Unit tests for the ``usergroups`` paths.
Each ``APITestCase`` subclass tests a single URL. A full list of URLs to be
tested can be found here:
http://theforeman.org/api/1.11/apidoc/v2/usergroups.html
:Requirement: Usergroup
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: API
:TestType: Functi... | elyezer/robottelo | tests/foreman/api/test_usergroup.py | Python | gpl-3.0 | 10,650 | 0 |
from django.urls import reverse
from django.utils.html import format_html, format_html_join
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from wagtail.core import hooks
from wagtail.admin.menu import MenuItem
from wagtail.core.whitelist import attribute_rule, check_url
@hook... | ilendl2/wagtail-cookiecutter-foundation | {{cookiecutter.project_slug}}/pages/wagtail_hooks.py | Python | mit | 1,721 | 0 |
import sys
import math
def getNextEle (X, C, F, i):
res = 0
residue = 0
for j in range(1,i):
t = int ( math.ceil ( (C-residue) / (x+ j*F)))
residue = t * # cosider residue cookies because of integral time seconds
res += X / (x + i*F);
def main():
| ziiin/onjCodes | codejam/2014/B-cookie-clicker.py | Python | mit | 294 | 0.05102 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
import pandas as pd
import zipfile
import statsmodels.api as sm
def link_functions_binomial():
print("Read in prostate data.")
h2o_data = h2o.import_file(path=pyunit_utils.locate("smalldata/prostate/prostate_complete.csv... | madmax983/h2o-3 | h2o-py/tests/testdir_algos/glm/pyunit_DEPRECATED_link_functions_binomialGLM.py | Python | apache-2.0 | 1,473 | 0.033944 |
# -*- coding: utf-8 -*-
# vim: set et sts=4 sw=4 encoding=utf-8:
###############################################################################
#
# This file is part of socketrpc.
#
# Copyright (C) 2011 Rene Jochum <rene@jrit.at>
#
###############################################################################
from ... | pcdummy/socketrpc | socketrpc/gevent_srpc.py | Python | bsd-3-clause | 10,766 | 0.002415 |
# coding: utf-8
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('logger', '0011_add-index-to-instance-uuid_and_xform_uuid'),
]
operations = [
migrations.AddField(
model_name='xform',
name='kpi_asset_uid',
... | kobotoolbox/kobocat | onadata/apps/logger/migrations/0012_add_asset_uid_to_xform.py | Python | bsd-2-clause | 390 | 0 |
#!/usr/bin/env python
import subprocess
import os
import sys
onlyinstances=False
if len(sys.argv) ==1:
print '\nUsage: awsls_admin [region]\n'
print '\nSpecify region (NOT availability zone) that will be displayed for all users\n'
sys.exit()
region=sys.argv[1]
if sys.argv[-1] == '-i':
... | leschzinerlab/AWS | aws/list_all.py | Python | mit | 8,823 | 0.030488 |
# -*- coding: utf-8 -*-
import time
from twisted.internet import defer, reactor
from twisted.web import server
from twisted.web.resource import Resource
from txcaching import cache, keyregistry
cache.load_config(**{"disable": False, "ip": "127.0.0.1", "port": 11212})
header = """
<html>
<head>
<style>
b... | alexgorin/txcaching | examples/cache_render_get_example.py | Python | mit | 3,675 | 0.003265 |
"""
Misc heavy lifting functions for cobbler
Copyright 2006-2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail>
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... | lifanov/cobbler | cobbler/utils.py | Python | gpl-2.0 | 65,236 | 0.001211 |
# -*- coding: utf-8 -*-
# Copyright © 2014-2015 Puneeth Chaganti and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights... | JohnTroony/nikola | nikola/plugins/command/github_deploy.py | Python | mit | 4,476 | 0.000895 |
#!/usr/bin/env python
import glob
import os
import site
from cx_Freeze import setup, Executable
import meld.build_helpers
import meld.conf
site_dir = site.getsitepackages()[1]
include_dll_path = os.path.join(site_dir, "gnome")
missing_dll = [
'libgtk-3-0.dll',
'libgdk-3-0.dll',
'libatk-1.0-0.dll',
... | culots/meld | setup_win32.py | Python | gpl-2.0 | 4,346 | 0.002531 |
#!/usr/bin/env python
# example drawingarea.py
import pygtk
pygtk.require('2.0')
import gtk
import operator
import time
import string
class DrawingAreaExample:
def __init__(self):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_title("Drawing Area Example")
window.connect("destroy", l... | joel-wright/DDRPi | experiments/python/drawingarea.py | Python | mit | 6,432 | 0.007774 |
# -*- coding: utf-8 -*-
from openerp import models, api
class sale_order_line(models.Model):
_inherit = "sale.order.line"
@api.one
def button_confirm(self):
if self.product_id.recurring_invoice and self.order_id.project_id:
invoice_line_ids = [((0, 0, {
'product_id': ... | odoousers2014/odoo | addons/account_analytic_analysis/sale_order.py | Python | agpl-3.0 | 1,018 | 0.000982 |
#A client for testing the bluetooth server running on the pi
import socket
serverMACAddress = 'b8:27:eb:f1:bb:a6'
port = 3
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
s.connect((serverMACAddress,port))
s.send("Hello")
while 1:
#client, address == s.accept()
#data = s.recv(... | contactgsuraj/ICHack2017 | RBP/test_client.py | Python | mit | 390 | 0.017949 |
# This file is part of PyEMMA.
#
# Copyright (c) 2016 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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 o... | gph82/PyEMMA | pyemma/thermo/util/__init__.py | Python | lgpl-3.0 | 790 | 0.001266 |
from electrum.util import print_msg
from .digitalbitbox import DigitalBitboxPlugin
class DigitalBitboxCmdLineHandler:
def stop(self):
pass
def show_message(self, msg):
print_msg(msg)
def get_passphrase(self, msg, confirm):
import getpass
print_msg(msg)
return getpa... | dabura667/electrum | plugins/digitalbitbox/cmdline.py | Python | mit | 415 | 0.004819 |
"""
Because I always forget, here's how to submit to PyPI:
# python setup.py register sdist upload
"""
from distutils.core import setup
import pyspecs
setup(
name='pyspecs',
version=pyspecs.__version__,
packages=['pyspecs'],
scripts=['scripts/run_pyspecs.py'],
url='https://github.com/mdwhatcott... | mdwhatcott/pyspecs | setup.py | Python | mit | 1,353 | 0 |
# correctness: 100%, performance: 0%
def solution(a):
l = len(a)
if l < 3: return reduce(lambda x, y: x * y, a)
products = []
for i in xrange(0, l):
for j in xrange(i+1, l):
for k in xrange (j+1, l):
products.append(a[i] * a[j] * a[k])
return max(products)
if __name__ == '__main__':
a... | nomuna/codility | Lesson_06/max_prod_three.py | Python | mit | 390 | 0.048718 |
#
# This file is part of pySMT.
#
# Copyright 2014 Andrea Micheli and Marco Gario
#
# 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
... | pysmt/pysmt | pysmt/solvers/z3.py | Python | apache-2.0 | 40,275 | 0.003501 |
# -*- coding: utf-8 -*-
"""`tldextract` accurately separates the gTLD or ccTLD (generic or country code
top-level domain) from the registered domain and subdomains of a URL.
>>> import tldextract
>>> tldextract.extract('http://forums.news.cnn.com/')
ExtractResult(subdomain='forums.news', domain='cnn', suff... | nbari/zunzuncito | my_api/default/v0/zun_tld/tldextract/tldextract.py | Python | bsd-3-clause | 14,203 | 0.004224 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@author: Mindaugas Greibus
trancriber mg1.4
'''
import sys, re
import collections
class TranscriberRegexp:
# http://cmusphinx.sourceforge.net/wiki/tutorialam
# Do not use case-sensitive variants like “e” and “E”. Instead, all your phones must be different even in c... | mondhs/heroku_test | transcriber_re_mg14.py | Python | gpl-3.0 | 7,933 | 0.023621 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2008, 2010, 2011, 2012 CERN.
##
## Invenio 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 (a... | fjorba/invenio | modules/websearch/lib/search_engine_query_parser.py | Python | gpl-2.0 | 54,879 | 0.007507 |
import pickle
import traceback
from http.server import SimpleHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
from ray.rllib.utils.annotations import PublicAPI
from ray.rllib.utils.policy_client import PolicyClient
@PublicAPI
class PolicyServer(ThreadingMixIn, HTTPServer):
"""REST server t... | stephanie-wang/ray | rllib/utils/policy_server.py | Python | apache-2.0 | 3,404 | 0 |
# 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 required by applicable ... | openhatch/oh-missions-oppia-beta | core/storage/base_model/gae_models.py | Python | apache-2.0 | 15,533 | 0.000193 |
#!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import runner
import pytest
def test_log_parser():
mock_log = b'''
[PERF] perf block start... | wldcordeiro/servo | etc/ci/performance/test_runner.py | Python | mpl-2.0 | 14,471 | 0.002073 |
# Copyright 2013 The Android Open Source Project
#
# 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 a... | s20121035/rk3288_android5.1_repo | cts/apps/CameraITS/pymodules/its/error.py | Python | gpl-3.0 | 791 | 0.005057 |
from __future__ import print_function
from __future__ import unicode_literals
from django.contrib import admin
from .models import Conference
from .models import Paper
from .models import Author
from .models import Attachment
from .actions import paper_actions
class AttachInline(admin.TabularInline):
model = A... | wadobo/papersplease | papersplease/papers/admin.py | Python | agpl-3.0 | 1,742 | 0.000574 |
"""Working day tools
"""
import warnings
import ephem
import pytz
from calendar import monthrange
from datetime import date, timedelta, datetime
from math import pi
from dateutil import easter
from lunardate import LunarDate
from calverter import Calverter
MON, TUE, WED, THU, FRI, SAT, SUN = range(7)
class Calenda... | shinriyo/workalendar | workalendar/core.py | Python | mit | 17,530 | 0.000057 |
import sys
print >>sys.stdout, 'Hello World'
print >>sys.stdout, 1, 2, 3
print >>sys.stdout, 1, 2, 3,
print >>sys.stdout
| zrax/pycdc | tests/input/test_extendedPrint.py | Python | gpl-3.0 | 122 | 0 |
from os.path import dirname, join
from openmdao.main.api import Assembly
#from openmdao.lib.components.api import GeomComponent
from openmdao.lib.datatypes.api import Float, Int
#hyperloop sizing calculations
from inlet import InletGeom
from battery import Battery
from passenger_capsule import PassengerCapsule
from ... | HyperloopTeam/Hyperloop | src/hyperloop/geometry/pod.py | Python | apache-2.0 | 4,408 | 0.0152 |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2016 CERN.
#
# B2Share 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... | emanueldima/b2share | b2share/modules/files/__init__.py | Python | gpl-2.0 | 908 | 0 |
#!/usr/bin/env python3
# This file is part of the Minecraft Overviewer.
#
# Minecraft Overviewer 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 o... | enaut/Minecraft-Overviewer | overviewer.py | Python | gpl-3.0 | 29,543 | 0.003283 |
"""Client Utilities
Factor out code shared by both the resync and resync-explorer
clients.
Copyright 2012,2013 Simeon Warner
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:/... | dans-er/resync | resync/client_utils.py | Python | apache-2.0 | 4,699 | 0.008725 |
from tdlearner import TDLearner
from collections import defaultdict
import numpy as np
# finds Euclidean norm distance between two lists a, b
def find_dist(a,b):
cumsum = 0.0
for i in xrange(len(a)):
cumsum += (a[i]-b[i])**2
return np.sqrt(cumsum/float(len(a)))
class ModelBased(TDLearner):
''... | kandluis/machine-learning | prac4/practical4-code/modelbased.py | Python | mit | 3,542 | 0.00734 |
#!/usr/bin/env python
from . import dentist
from .watchers import LogNotify, Notifier, Poller
import logging
import os
import sys
def parse():
from optparse import OptionParser
parser = OptionParser()
parser.add_option('-d', '--daemonize', dest='daemonize',
action='store_true', defa... | easies/dentist | dentist/main.py | Python | mit | 2,740 | 0 |
"""
Virtualization test utility functions.
:copyright: 2008-2009 Red Hat Inc.
"""
import time
import string
import random
import socket
import os
import stat
import signal
import re
import logging
import commands
import fcntl
import sys
import inspect
import tarfile
import shutil
import getpass
import ctypes
import t... | Andrei-Stepanov/avocado-vt | virttest/utils_misc.py | Python | gpl-2.0 | 116,705 | 0.000548 |
#!/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.
from copy import deepcopy
from file_system import FileNotFoundError, StatInfo
from test_file_system import TestFileSystem
import un... | plxaye/chromium | src/chrome/common/extensions/docs/server2/test_file_system_test.py | Python | apache-2.0 | 6,461 | 0.002476 |
# -*- test-case-name: twisted.test.test_compat -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Compatibility module to provide backwards compatibility for useful Python
features.
This is mainly for use of internal Twisted code. We encourage you to use
the latest version of Python di... | Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/python/compat.py | Python | gpl-3.0 | 19,303 | 0.001813 |
"""
Comb is a script to comb the extrusion hair of a gcode file.
The default 'Activate Comb' checkbox is on. When it is on, the functions described below will work, when it is off, the functions
will not be called.
Comb bends the extruder travel paths around holes in the carve, to avoid stringers. It moves the extr... | natetrue/ReplicatorG | skein_engines/skeinforge-0006/skeinforge_tools/comb.py | Python | gpl-2.0 | 26,905 | 0.043895 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Compare two conllu files for matches on each field.
"""
from argparse import ArgumentParser, FileType
from sys import stderr
def main():
a = ArgumentParser()
a.add_argument('-H', '--hypothesis', metavar="HYPFILE", type=open, required=True,
... | jiemakel/omorfi | test/conllu-compare.py | Python | gpl-3.0 | 7,037 | 0.001279 |
# -*- coding: utf-8 -*-
# pylint: disable=E265
"""
lantz.drivers.andor.ccd
~~~~~~~~~~~~~~~~~~~~~~~
Low level driver wrapping library for CCD and Intensified CCD cameras.
Only functions for iXon EMCCD cameras were tested.
Only tested in Windows OS.
The driver was written for the single-camera ... | varses/awsch | lantz/drivers/andor/ccd.py | Python | bsd-3-clause | 74,992 | 0.00028 |
# -*- coding: utf-8 -*-
from datetime import datetime, timezone, timedelta
import pytest
class TestStr2Datetime(object):
@pytest.fixture
def target_func(self):
from poco.utils import str2datetime
return str2datetime
@pytest.mark.parametrize(
's,expected',
[
('... | kk6/poco | tests/test_utils.py | Python | mit | 1,427 | 0.000701 |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import absolute_import, print_function
import pytest
from atomic_reactor.rpm_util import rpm_qf_args, parse_rpm_output
FAK... | maxamillion/atomic-reactor | tests/test_rpm_util.py | Python | bsd-3-clause | 2,380 | 0.00042 |
from django.apps import AppConfig
class CreatorConfig(AppConfig):
name = 'creator'
| HenryCorse/Project_Southstar | CharacterApp/creator/apps.py | Python | mit | 89 | 0 |
import hashlib
import libvirt
from django.forms.models import model_to_dict
from utils.common import gen_passwd
from utils.common import gen_user_passwd
from backstage.models import LibvirtPass
from utils.salt_utils import SaltApiHandler
def get_host_passwd(host):
"""
* desc 获取机器的用户名和密码
* input 主机ip
... | hanleilei/note | python/vir_manager/utils/libvirt_utils.py | Python | cc0-1.0 | 3,602 | 0.000943 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
install_requires = [
'pytz',
'requests',
'lxml',
'python-dateutil',
'parsedatetime',
'cached-property',
'click',
'enum34', # backported versions from Python3
'pathlib',
'configparser',
]
console_scripts = ... | marchon/poker | setup.py | Python | mit | 1,020 | 0.025515 |
#!/usr/bin/env python
import itertools
from operator import attrgetter, itemgetter
class ClusterRecommendation(object):
__slots__ = ("cluster_id", "papers")
def __init__(self, cluster_id, papers):
self.cluster_id = cluster_id
self.papers = [(p.pid, p.score) for p in papers]
def __str__(s... | jevinw/rec_utilities | babel_util/recommenders/ef2.py | Python | agpl-3.0 | 1,698 | 0.004122 |
# -*- coding: utf-8 -*-
# Exercise 6: Calculate model performance indexes with PyGeoC
from pygeoc.utils import MathClass
def cal_model_performance(obsl, siml):
"""Calculate model performance indexes."""
nse = MathClass.nashcoef(obsl, siml)
r2 = MathClass.rsquare(obsl, siml)
rmse = MathClass.r... | lreis2415/PyGeoC | examples/ex06_model_performace_index.py | Python | mit | 874 | 0.002288 |
#
# The Python Imaging Library.
# $Id$
#
# MSP file handling
#
# This is the format used by the Paint program in Windows 1 and 2.
#
# History:
# 95-09-05 fl Created
# 97-01-03 fl Read/write MSP images
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fredrik Lundh 1995-97.
#
# See the README fi... | havard024/prego | venv/lib/python2.7/site-packages/PIL/MspImagePlugin.py | Python | mit | 2,173 | 0.004602 |
from gi.repository import Gtk, Gdk, GdkPixbuf
(TARGET_ENTRY_TEXT, TARGET_ENTRY_PIXBUF) = range(2)
(COLUMN_TEXT, COLUMN_PIXBUF) = range(2)
DRAG_ACTION = Gdk.DragAction.COPY
class DragDropWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Drag and Drop")
vbox = Gtk.Box(orien... | Dehyrf/python_gates | window.py | Python | gpl-3.0 | 3,800 | 0.002632 |
import datetime
import re
import sys
from collections import deque
from decimal import Decimal
from enum import Enum
from ipaddress import IPv4Address, IPv4Interface, IPv4Network, IPv6Address, IPv6Interface, IPv6Network
from pathlib import Path
from types import GeneratorType
from typing import Any, Callable, Dict, Typ... | glenngillen/dotfiles | .vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/jedilsp/pydantic/json.py | Python | mit | 3,365 | 0.001189 |
"""
Duplicate entries allowed
this raises the complexity from log n to n/2 log n
key idea:
if mid equal to two ends, there must be constant on
one side and min on the other.
if left end < mid < right: no rotation
if mid less than both ends => min on your left
if min greater than both ends => min on your right
"""
... | urashima9616/Leetcode_Python | Leet154_FindMinRotatedArrayII.py | Python | gpl-3.0 | 1,397 | 0.012169 |
import numpy as np
import pandas as pd
import xarray as xr
from tikon.central import Módulo, SimulMódulo, Modelo, Exper, Parcela
from tikon.central.res import Resultado
from tikon.datos import Obs
from tikon.utils import EJE_TIEMPO, EJE_PARC
f_inic = '2000-01-01'
crds = {'eje 1': ['a', 'b'], 'eje 2': ['x', 'y', 'z']}... | julienmalard/Tikon | pruebas/test_central/rcrs/modelo_valid.py | Python | agpl-3.0 | 1,156 | 0.000877 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import re
from waflib import Utils,Task,TaskGen,Logs
from waflib.TaskGen import feature,before_method,after_method,extension
from waflib.Configure import conf
INC_REGEX="""(?:^|['">]\s*;)\s*(?:|#\s*)... | asljivo1/802.11ah-ns3 | ns-3/.waf-1.8.12-f00e5b53f6bbeab1384a38c9cc5d51f7/waflib/Tools/fc_scan.py | Python | gpl-2.0 | 1,859 | 0.069392 |
# Copyright 2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# Copyright 2018 David Vidal <david.vidal@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class StockMove(models.Model):
_inherit = 'stock.move'
def _create_extra_move(self):
"""
... | Domatix/stock-logistics-workflow | stock_pack_operation_auto_fill/models/stock_move.py | Python | agpl-3.0 | 1,537 | 0 |
# -*- coding: utf-8 -*-
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.imgmath', 'rst2pdf.pdfbuilder']
# The ma... | rst2pdf/rst2pdf | rst2pdf/tests/input/sphinx-issue252/conf.py | Python | mit | 1,417 | 0.002117 |
import cartolafc
api = cartolafc.Api(email='email@email.com', password='s3nh4', attempts=5, redis_url='redis://localhost:6379/0')
print(api.amigos())
print(api.clubes())
print(api.liga(nome='Virtus Premier League'))
print(api.liga(nome='Nacional', page=2))
print(api.liga(nome='Nacional', page=3, order_by=cartolafc.RO... | vicenteneto/python-cartolafc | examples/examples.py | Python | mit | 1,020 | 0.00098 |
# -*- coding: utf-8 -*-
import logging
from moulinette.utils.text import random_ascii
from moulinette.core import MoulinetteError, MoulinetteAuthenticationError
from moulinette.authentication import BaseAuthenticator
logger = logging.getLogger("moulinette.authenticator.yoloswag")
# Dummy authenticator implementation... | YunoHost/moulinette | test/src/authenticators/dummy.py | Python | agpl-3.0 | 2,129 | 0.001409 |
#!/usr/bin/env python
"""
create_counts_lookup.py
"""
print('3)-->files')
import sys,os
import argparse
import pymysql as MySQLdb
import json
import configparser as ConfigParser
"""
SELECT sum(seq_count), dataset_id, domain_id,domain
FROM sequence_pdr_info
JOIN sequence_uniq_info USING(sequence_id)
JOIN silva_t... | avoorhis/vamps-node.js | public/scripts/node_process_scripts/vamps_script_create_json_dataset_files.py | Python | mit | 17,471 | 0.022208 |
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
# PyGithub 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 vers... | sagarsane/abetterportfolio | github/GitTag.py | Python | apache-2.0 | 3,535 | 0.04017 |
import numpy as np
import measurements.all.data
import simulation.model.options
import simulation.model.cache
import simulation.optimization.constants
import simulation.accuracy.linearized
def init_model_options(model_name, time_step=1,
concentrations=None, concentrations_index=None, paramete... | jor-/simulation | simulation/util/args.py | Python | agpl-3.0 | 12,072 | 0.00439 |
import xml.etree.ElementTree as etree
import base64
from struct import unpack, pack
import sys
import io
import os
import time
import itertools
import xbmcaddon
import xbmc
import urllib2,urllib
import traceback
import urlparse
import posixpath
import re
import hmac
import hashlib
import binascii
imp... | pauron/ShaniXBMCWork | script.video.F4mProxy/lib/f4mDownloader.py | Python | gpl-2.0 | 39,022 | 0.016478 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# myapp.urls
##
##
# Copyright (C) $YEAR$, $AUTHOR_NAME$ <$AUTHOR_EMAIL$>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of version 3 of the GNU Affero General Public License as
# published by the Free Software Found... | maaku/django-reuse | templates/apps/basic/myapp/urls.py | Python | agpl-3.0 | 886 | 0 |
# 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)
import copy
import f... | kslundberg/pants | src/python/pants/backend/jvm/tasks/junit_run.py | Python | apache-2.0 | 37,903 | 0.00802 |
from wxPython._controls import wxLIST_MASK_STATE
from wxPython._controls import wxLIST_STATE_SELECTED
import os.path
# Modified by Francois Malan, LUMC / TU Delft
# December 2009
#
# based on the SkeletonAUIViewer:
# skeleton of an AUI-based viewer module
# Copyright (c) Charl P. Botha, TU Delft.
# set to False for 3D... | nagyistoce/devide | modules/viewers/MaskComBinar.py | Python | bsd-3-clause | 62,014 | 0.006305 |
import flask_babel
from flask import request, url_for, current_app, g, session
from flask_nav.elements import View
class LanguageCodeFromPathMiddleware(object):
def __init__(self, app, babel_by_url):
self.app = app
self.babel_by_url = babel_by_url
def __call__(self, environ, start_response):
... | thedod/boilerplate-peewee-flask | application/sitepack/babel_by_url.py | Python | gpl-3.0 | 3,249 | 0.004617 |
#!/usr/bin/python
# -*- coding: ISO-8859-15-*-
import sys
sys.path.append('.') # path to monica.py
import mpi_helper
import monica
import os
import datetime
import numpy
import analyse_monica_outputs
import shutil
import time
import csv
from mpi4py import MPI
# MPI related initialisations
comm = MPI.COMM_WORLD
r... | zalf-lsa/carbiocial-project | monica/monica-cluster-mpi/run_carbiocial_simulation.py | Python | mpl-2.0 | 9,103 | 0.018455 |
# -*- coding: utf-8 -*-
#
# DeepGreen documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 12 18:24:23 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | OA-DeepGreen/sphinx-doc | conf.py | Python | apache-2.0 | 4,810 | 0.000416 |
from mongrel2.config import *
main = Server(
uuid="f400bf85-4538-4f7a-8908-67e313d515c2",
access_log="/logs/access.log",
error_log="/logs/error.log",
chroot="./",
default_host="localhost",
name="test",
pid_file="/run/mongrel2.pid",
port=6767,
hosts = [
Host(name="localhost"... | bnoordhuis/mongrel2 | examples/configs/multi_conf.py | Python | bsd-3-clause | 1,384 | 0.007225 |
# -*- coding: utf-8 -*-
"""
"""
# Copyright (C) 2015 ZetaOps Inc.
#
# This file is licensed under the GNU General Public License v3
# (GPLv3). See LICENSE.txt for details.
from pyoko.conf import settings
from pyoko.db.schema_update import SchemaUpdater
from tests.data.solr_schema import test_data_solr_fields_debug_z... | zetaops/pyoko | tests/test_model_to_solr_schema.py | Python | gpl-3.0 | 1,268 | 0.002366 |
'''
Implementation of the locally greedy approach similar with DuVerle & Predinger
(2009, 2010) (but adapted for SDRT, where the notion of adjacency includes
embedded segments)
July 2012
@author: stergos
'''
from __future__ import print_function
import sys
from .interface import Decoder
from .util import (convert_p... | kowey/attelo | attelo/decoding/greedy.py | Python | gpl-3.0 | 5,290 | 0 |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 14 02:17:11 2017
@author: guida
"""
import json
import requests
def get_url(url):
response = requests.get(url)
content = response.content.decode("utf8")
return content
#Json parser
def get_json_from_url(url):
content = get_url(url)
j... | DiegoGuidaF/telegram-raspy | modules.py | Python | mit | 358 | 0.011173 |
# Constant indices within mmap buffers.
_POS_VALUE_LEN = 8
_READ_POS_IDX = 0
_WRITE_POS_IDX = _POS_VALUE_LEN
_HEADER_LEN = _POS_VALUE_LEN * 2
# Item size constants.
_ITEM_SIZE_LEN = 4
# struct.[un]pack format string for length fields
_POS_VALUE_FORMAT = "q"
_ITEM_SIZE_FORMAT = "i"
| whiskerlabs/mmringbuffer | mmringbuffer/constants.py | Python | mit | 292 | 0.013699 |
#coding=utf-8
import os
# Basic settings
# requests settings
TIMEOUT = 5
VERIFY = False
# directories might be used
LOCATIONS = {
'log': 'log',
'data': 'data',
}
# stderr is redirected to this file
ERR_LOG_FILE = os.path.join(LOCATIONS['log'], 'err.log')
# log in this file
LOGGING_FILE = os.path.join(LOCAT... | Moonshile/fast12306 | src/core/settings.py | Python | apache-2.0 | 2,707 | 0.002277 |
# This code is based on logic from
# http://sqizit.bartletts.id.au/2011/02/14/pseudo-terminals-in-python/
# Licensed under the MIT license:
# Copyright (c) 2011 Joshua D. Bartlett
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ... | polyaxon/polyaxon | core/polyaxon/vendor/shell_pty.py | Python | apache-2.0 | 6,910 | 0.001013 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from typing import TYPE_CHECKING
import msal
from .._internal import AadClient, AsyncContextManager
from .._internal.get_token_mixin import GetTokenMixin
from ..._cred... | Azure/azure-sdk-for-python | sdk/identity/azure-identity/azure/identity/aio/_credentials/certificate.py | Python | mit | 3,645 | 0.003841 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
import traceback
from sis_provisioner.dao.uw_account import get_all_uw_accounts
from sis_provisioner.csv import get_filepath
from sis_provisioner.csv.user_writer import make_import_user_csv_files
from sis_provisioner.... | uw-it-aca/bridge-sis-provisioner | sis_provisioner/csv/writer.py | Python | apache-2.0 | 1,345 | 0 |
# -*- 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/features.py | Python | apache-2.0 | 3,441 | 0.001453 |
'''
Created on Aug 4, 2015
@author: amcmahon
'''
from BasicProcessing import UnispecProcessing
from BasicProcessing import consts
import os.path
import sys
def main():
"""
Main function for generating CSV files from a directory of Unispec data.
Input/Output paths, white plate identifier string and h... | serbinsh/UniSpec_Processing | src/BasicProcessing/Main.py | Python | gpl-2.0 | 2,919 | 0.015416 |
"""
Tests for Molecular Graph data structures.
"""
from __future__ import division
from __future__ import unicode_literals
__author__ = "Han Altae-Tran and Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import unittest
import os
import sys
import numpy as np
from deepche... | ktaneishi/deepchem | deepchem/feat/tests/test_mol_graphs.py | Python | mit | 6,110 | 0.0018 |
import itertools
from whylog.config.investigation_plan import Clue
from whylog.constraints.exceptions import TooManyConstraintsToNegate
from whylog.front.utils import FrontInput
class Verifier(object):
UNMATCHED = Clue(None, None, None, None)
@classmethod
def _create_investigation_result(cls, clues_comb... | andrzejgorski/whylog | whylog/constraints/verifier.py | Python | bsd-3-clause | 8,521 | 0.003286 |
import os.path
import warnings
from glob import glob
from io import BytesIO
from numbers import Number
from pathlib import Path
from typing import (
TYPE_CHECKING,
Callable,
Dict,
Hashable,
Iterable,
Mapping,
Tuple,
Union,
)
import numpy as np
from .. import backends, coding, conventio... | xray/xray | xarray/backends/api.py | Python | apache-2.0 | 50,534 | 0.000772 |
"""Wrapper around yamllint that supports YAML embedded in Ansible modules."""
from __future__ import annotations
import ast
import json
import os
import re
import sys
import typing as t
import yaml
from yaml.resolver import Resolver
from yaml.constructor import SafeConstructor
from yaml.error import MarkedYAMLError
f... | bcoca/ansible | test/lib/ansible_test/_util/controller/sanity/yamllint/yamllinter.py | Python | gpl-3.0 | 8,386 | 0.002146 |
from .base import * # noqa
DEBUG = True
# Databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django_learner',
'USER': 'django_learner',
'PASSWORD': 'admin',
'HOST': 'localhost'
}
}
| edouard-lopez/django-learner | django_learner/settings/local.py | Python | bsd-3-clause | 279 | 0 |
#This file is part of vatnumber. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
'''
Check the VAT number depending of the country based on formula from
http://sima-pc.com/nif.php (dead link, was http://web.archive.org/web/20120118023804/http://sima-pc.com... | borni-dhifi/vatnumber | vatnumber/__init__.py | Python | gpl-3.0 | 8,864 | 0.000451 |
"""KDE of Temps."""
import calendar
from datetime import date, datetime
import pandas as pd
from pyiem.plot.util import fitbox
from pyiem.plot import figure
from pyiem.util import get_autoplot_context, get_sqlalchemy_conn
from pyiem.exceptions import NoDataFound
from matplotlib.ticker import MaxNLocator
from scipy.sta... | akrherz/iem | htdocs/plotting/auto/scripts200/p215.py | Python | mit | 7,271 | 0 |
import os
import mock
from uuid import uuid4
from urllib.request import urlopen
import datetime
from django.test import TestCase
from django.core.files.base import ContentFile
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from boto.s3.key import Key
from storag... | peterseymour/django-storages-1.1.8 | storages/tests/s3boto.py | Python | bsd-3-clause | 8,692 | 0.001266 |
if __name__ == "__main__":
import gizeh
import moviepy.editor as mpy
from vectortween.TimeConversion import TimeConversion
from vectortween.PointAnimation import PointAnimation
from vectortween.ColorAnimation import ColorAnimation
W, H = 250, 250 # width, height, in pixels
duration = 10 ... | shimpe/pyvectortween | examples/example_pointandcoloranimation.py | Python | mit | 3,258 | 0.003069 |
#!/usr/bin/python3
import argparse as ap
import shared
ACTIONS = dict()
def action(key):
def wrapper(function):
ACTIONS[key] = function
return function
return wrapper
def get_closed_issues(repo, milestone):
issues_and_prs = repo.get_issues(milestone=milestone, state="closed")
iss... | mpreisler/openscap | release_tools/query-milestones.py | Python | lgpl-2.1 | 1,404 | 0 |
#!/usr/bin/env python3
###############################################################################
# Copyright 2018 The Apollo 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... | msbeta/apollo | scripts/record_map_data.py | Python | apache-2.0 | 6,330 | 0.001106 |
# -*- coding: utf-8 -*-
"""
Tests for the pulp.server.db.model module.
"""
from mock import patch, Mock
from mongoengine import ValidationError, DateTimeField, DictField, Document, IntField, StringField
from pulp.common import error_codes, dateutils
from pulp.common.compat import unittest
from pulp.server.exception... | mibanescu/pulp | server/test/unit/server/db/test_model.py | Python | gpl-2.0 | 22,379 | 0.00219 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | pmisik/buildbot | master/buildbot/test/util/querylog.py | Python | gpl-2.0 | 3,257 | 0.000614 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.