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 |
|---|---|---|---|---|---|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/__init__.py | Python | mit | 835 |
"""
Support for the Yahoo! Weather service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.yweather/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import (CONF_PLATFORM, TEMP_CELSIUS,
... | deisi/home-assistant | homeassistant/components/sensor/yweather.py | Python | mit | 6,432 |
import os
import traceback
from lib.FileManager.workers.baseWorkerCustomer import BaseWorkerCustomer
class ListFiles(BaseWorkerCustomer):
def __init__(self, path, session, *args, **kwargs):
super(ListFiles, self).__init__(*args, **kwargs)
self.path = os.path.normpath(path)
if self.path =... | LTD-Beget/sprutio-rpc | lib/FileManager/workers/sftp/listFiles.py | Python | gpl-3.0 | 1,305 |
# Copyright 2012, Nachi Ueno, NTT MCL, 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
#
# Unles... | igor-toga/local-snat | neutron/tests/unit/agent/linux/test_iptables_firewall.py | Python | apache-2.0 | 86,232 |
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('suggest', '0001_initial'),
]
operations =... | fnp/wolnelektury | src/suggest/migrations/0002_auto_20151221_1225.py | Python | agpl-3.0 | 1,113 |
import base64
import hashlib
import io
import json
import os
import urllib.request
import invoke
from . import paths
@invoke.task
def authors():
print("[generate.authors] Generating AUTHORS")
# Get our list of authors
print("[generate.authors] Collecting author names")
r = invoke.run("git log --use... | newsteinking/docker | tasks/generate.py | Python | mit | 8,403 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('search', '0008_auto_20151117_1526'),
]
operations = [
migrations.AlterField(
model_name='docket',
na... | brianwc/courtlistener | cl/search/migrations/0009_auto_20151210_1124.py | Python | agpl-3.0 | 734 |
import re
import os
import shutil
import time
from datetime import datetime, timedelta
from gppylib.db import dbconn
from gppylib.commands.gp import get_coordinatordatadir
from contextlib import closing
from test.behave_utils.utils import check_schema_exists, check_table_exists, drop_table_if_exists
from behave import ... | 50wu/gpdb | gpMgmt/test/behave/mgmt_utils/steps/analyzedb_mgmt_utils.py | Python | apache-2.0 | 19,372 |
from PIL import Image
from io import BytesIO
import logging
from fluxclient.scanner.scan_settings import ScanSetting
from fluxclient.robot.errors import RobotError
from fluxclient.hw_profile import HW_PROFILE
from fluxclient.scanner import image_to_pc
from fluxclient.robot import errors
from .control_base import con... | flux3dp/fluxghost | fluxghost/api/scan_control.py | Python | agpl-3.0 | 8,721 |
from south.db import db
from django.db import models
from cms.plugins.video.models import *
class Migration:
def forwards(self, orm):
# Adding field 'Video.mute'
db.add_column('cmsplugin_video', 'mute', orm['video.video:mute'])
# Adding field 'Video.controller_style'... | team-xue/xue | xue/cms/plugins/video/migrations/0002_color_mute_controller.py | Python | bsd-3-clause | 8,413 |
########################################################################
#
# Copyright 2014 Johns Hopkins University
#
# 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... | idies/pyJHTDB | pyJHTDB/__init__.py | Python | apache-2.0 | 3,420 |
#/usr/bin/python
import sys
from telemeta.util.kdenlive.fade import AutoFade
path = sys.argv[-1]
fade = AutoFade(path)
data = fade.run()
f = open(path, 'w')
f.write(data)
f.close()
| ANR-kamoulox/Telemeta | scripts/kdenlive/auto_fade.py | Python | agpl-3.0 | 183 |
import re
def load_yaml(filename):
"""
Reads any yaml file and returns it as object.
"""
import yaml
stream = file(filename)
return yaml.load(stream)
debug=False
import unicodedata
def unescape_unicode_charnames(s):
"""
Takes \N{charname} in production rule and turns to Unico... | seanpue/graphparser | myparser.py | Python | mit | 7,268 |
#
# Module which deals with pickling of objects.
#
# multiprocessing/reduction.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
import copyreg
import functools
import io
import os
try:
import dill as pickle
except ImportError:
import pickle
import socket
import sys
... | seishei/multiprocess | py3.4/multiprocess/reduction.py | Python | bsd-3-clause | 8,163 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dataplex | samples/generated_samples/dataplex_v1_generated_dataplex_service_delete_task_async.py | Python | apache-2.0 | 1,540 |
#!/usr/bin/env python3
from __future__ import division, print_function
from monosat import *
import functools
import math
from monosat import *
import os
from random import shuffle
import random
import random
import sys
import itertools
import bz2
#note: for testing purposes, not recommended for practical pb solving!
M... | sambayless/monosat | tests/python/read_pb.py | Python | mit | 4,745 |
# -*- coding: UTF8 -*-
import time
import logging
from datetime import datetime, timedelta
from handlers.misc import HtmlCache
LOG = logging.getLogger(__name__)
class WhoScoredProvider():
global cache
cache = HtmlCache('/temp/whoscored/')
timeout = 365 * 24 * 60 * 60
canResolve = False
whoscored... | nkwsqyyzx/bet.statistic | handlers/statistics/tool/WhoScoredProvider.py | Python | apache-2.0 | 5,917 |
#!/usr/bin/python
from Tkinter import *
class Search_Frame:
def __init__(self,master,mediathek_root_directory,channel_csv_file):
# Create Search frame
self.search_frame=Frame(master)
self.search_frame.grid(row=1,column=0,sticky="nsew")
self.search_control_frame=Frame(master)
... | mp-pug/pi-alarm | Search_Frame.py | Python | gpl-3.0 | 500 |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Event(models.Model):
name = models.CharField(max_length=255)
description = models.TextField(blank=True)
timelapse = models.CharField(blank=True, max_length=255)
photo_book_id = models.IntegerField... | XeryusTC/lanciesite | pubsite/models.py | Python | gpl-2.0 | 2,412 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sharebox.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| somethingnew2-0/CS739-ShareBox | django-server/manage.py | Python | mit | 251 |
"""
Дефинирайте фунцкия, която пресмята сумата на числата от 1 до N.
"""
def sum_1_to_n(n):
pass
print(sum_1_to_n(3)) # 6
assert sum_1_to_n(3) == 6
| YAtOff/python0-reloaded | week6/tasks/sum.py | Python | mit | 206 |
#!/usr/bin/python
#
# Copyright (C) 2007-2010 TUBITAK/UEKAE
#
# 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.
#
# Please... | forYali/yali | yali/kahya.py | Python | gpl-2.0 | 13,103 |
#coding:utf8
"""
核心:获取到可执行文件
1、startswith以什么开头
2、endswith以什么结尾
"""
import os
import sys
from apis_test.common_methods.mylogs import logger
#获取需要执行的脚本文件路径
path = sys.path[0]
print path
# 获取test开头的PY文件
def del_files(path):
for root , dirs, files in os.walk(path):
for name in files:
if name.start... | renyixiang/auto_test_baby | apis_test/wuliu_select/get_Py_file_name.py | Python | gpl-2.0 | 1,141 |
I am new to programing so Is this code ok? how can i make it faster?
def egcd(a,b): # a > b > 0
""" Extended great common divisor, returns x , y
and gcd(a,b) so ax + by = gcd(a,b) """
if a%b==0: return (0,1,b)
q=[]
while a%b != 0:
q.append(-1*(a//b))
(a,b)=(b,a%b... | ActiveState/code | recipes/Python/474129_extended_great_commdivisor/recipe-474129.py | Python | mit | 405 |
# -*- coding: utf-8 -*-
##
# Copyright 2009-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# Flem... | boegel/easybuild-easyblocks | easybuild/easyblocks/g/gurobi.py | Python | gpl-2.0 | 3,979 |
from sqlalchemy.exc import IntegrityError
from werkzeug.utils import secure_filename
from flask import session, request, g
from flask import render_template, flash
from flask import redirect, url_for, send_from_directory, abort
from flask import Blueprint, current_app
from flask_wtf.csrf import CsrfProtect
from PIL im... | DiscordEmotes/website | website/views.py | Python | mit | 6,866 |
# -*- coding: utf-8 -*-
# IMPORTANT CONFIGURE YOUR TEXT EDITOR/IDE TO utf-8 !!!
# @author: "Evert Provoost"
# @nickname: "ElecProg"
# @pack: "Math Processing Layer (MPL)"
# @part: "Visualization system (MPL.V)"
# @version: "v5.0.0"
# @license: "GNU General Public License v3"
from fractions import Fraction... | ElecProg/MPL | mpl/v.py | Python | gpl-3.0 | 11,650 |
#!/usr/bin/env python
'''
parse a MAVLink protocol XML file and generate a C# implementation
Copyright Michael Oborne 2018
Released under GNU GPL version 3 or later
'''
import sys, textwrap, os, time, re
from . import mavparse, mavtemplate
t = mavtemplate.MAVTemplate()
enumtypes = {}
map = {
... | diydrones/MissionPlanner | ExtLibs/Mavlink/pymavlink/generator/mavgen_cs.py | Python | gpl-3.0 | 14,273 |
'''
A logistic regression learning algorithm example using TensorFlow library.
This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
# Import MINST data
import input_data
mnist = inpu... | mlmurray/TensorFlow-Experimentation | examples/2 - Basic Classifiers/logistic_regression.py | Python | mit | 2,159 |
# 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... | HaebinShin/tensorflow | tensorflow/contrib/learn/python/learn/estimators/classifier_test.py | Python | apache-2.0 | 2,674 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# django-numerics documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 19 14:51:06 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in t... | huseyinyilmaz/django-numerics | doc/source/conf.py | Python | mit | 9,590 |
from django.contrib.gis.db import models
from mysite.settings import INSTALLED_APPS
from django.contrib.contenttypes.models import ContentType
from django.apps import apps
from django.core.exceptions import ValidationError
from base.models import PaleocoreUser
from ast import literal_eval
# exclude any installed apps ... | paleocore/paleocore | projects/models.py | Python | gpl-2.0 | 5,328 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | tqchen/tvm | python/tvm/tir/buffer.py | Python | apache-2.0 | 9,009 |
import calendar
import datetime
import json
from bson import objectid
class Encoder(json.JSONEncoder):
item_separator = ','
key_separator = ':'
def __init__(self):
super(Encoder, self).__init__(ensure_ascii=False)
def default(self, o):
if type(o) is objectid.ObjectId:
re... | KawashiroNitori/Anubis | anubis/util/json.py | Python | gpl-3.0 | 577 |
import pyqtgraph as pg
class BarSensor(pg.PlotWidget):
def __init__(self, name, magnitude, unit, color='y',
hide_bottom_axis=True, min_y_range=None, y_range=None):
super().__init__()
self.setLimits(minYRange=min_y_range)
if y_range:
self.setRange(yRange=y_range... | CojoCompany/spinete | spinete/bar_sensors.py | Python | gpl-3.0 | 917 |
# (C) British Crown Copyright 2011 - 2018, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option)... | pelson/cartopy | docs/make_projection.py | Python | lgpl-3.0 | 6,210 |
# Standard Library
import argparse
import base64
from datetime import datetime
import os
import re
import textwrap
# external
from stix2validator import validate_string
from stix2validator.validator import FileValidationResults
# internal
from stix2elevator.options import info, warn
def find_string_in_list_case_inse... | oasis-open/cti-stix-elevator | stix2elevator/utils.py | Python | bsd-3-clause | 12,748 |
from django.template.defaulttags import register
from premises.models import get_fallacy_types
from django.conf import settings
from django.utils import timezone
@register.filter
def humanize_fallacy_type(value):
return dict(get_fallacy_types()).get(value)
@register.filter
def check_content_deletion(contention)... | beratdogan/arguman.org | web/premises/templatetags/premise_tags.py | Python | mit | 728 |
"""
Model factories for unit testing views or models.
"""
from __future__ import absolute_import
from django.contrib.sites.models import Site
from factory.django import DjangoModelFactory
from factory import SubFactory, Sequence, SelfAttribute, lazy_attribute
from openedx.core.djangoapps.site_configuration.models imp... | ESOedX/edx-platform | openedx/core/djangoapps/site_configuration/tests/factories.py | Python | agpl-3.0 | 897 |
class DDSDeliveryPreview(object):
"""
A class to represent a delivery preview, without persistence.
Has many of the same properties as a Delivery, and can be provided to the email generation code
"""
def __init__(self, from_user_id, to_user_id, project_id, transfer_id, user_message):
self.f... | Duke-GCB/DukeDSHandoverService | d4s2_api_v2/models.py | Python | mit | 578 |
# -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requi... | nebril/fuel-web | fuel_upgrade_system/fuel_upgrade/fuel_upgrade/tests/test_utils.py | Python | apache-2.0 | 28,240 |
# coding=utf-8
"""
单一的样例
"""
import pytest
from data_packer import DefaultField, OptionalField, PlaceholderField, RequiredField, MagicField
from data_packer import container, err, constant, checker, converter
import data_packer
from _common import run
g_src = {
'a': 1,
'b': 'hello',
'c': ['a', 'b', 'c'],
... | ideascf/data-packer | test/field/test_single.py | Python | mit | 5,915 |
"""
This inline scripts makes it possible to use mitmproxy in scenarios where IP spoofing has been used to redirect
connections to mitmproxy. The way this works is that we rely on either the TLS Server Name Indication (SNI) or the
Host header of the HTTP request.
Of course, this is not foolproof - if an HTTPS conne... | x2Ident/x2Ident_test | mitmproxy/examples/dns_spoofing.py | Python | gpl-3.0 | 1,786 |
import unittest
from unittest.mock import Mock
class MockUtilsTestCase(unittest.TestCase):
def assertEqualMock(self, first, second):
mock_util = Mock()
mock_util(first)
mock_util.assert_called_with(second)
| Mause/pytransperth | tests/helpers/mock_utils_test_case.py | Python | mit | 238 |
import unittest
from pyprint.ConsolePrinter import ConsolePrinter
from coalib.misc.ContextManagers import simulate_console_inputs
from coalib.bears.GlobalBear import GlobalBear
from coalib.bears.LocalBear import LocalBear
from coalib.settings.SectionFilling import fill_section, fill_settings, Setting
from coalib.setti... | SambitAcharya/coala | coalib/tests/settings/SectionFillingTest.py | Python | agpl-3.0 | 3,403 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy... | hbutau/dzidzo | users/models.py | Python | bsd-3-clause | 701 |
# -*-coding:Utf-8 -*
# Copyright (c) 2014 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | stormi/tsunami | src/secondaires/familier/constantes.py | Python | bsd-3-clause | 1,979 |
"""
Retrieve descriptors from popular hidden services. (every 10 min).
"""
import sys
import time
import argparse
import struct
import hashlib
import datetime
import os
import logging
import errno
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarat... | DonnchaC/tor-hs-descriptor-fetcher | descriptor-fetcher.py | Python | gpl-2.0 | 9,414 |
# 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... | code-sauce/tensorflow | tensorflow/python/ops/data_flow_ops.py | Python | apache-2.0 | 65,239 |
# DEMONSTRATION OF THE LATTICE-BOLTZMANN SIMULATION
#
import espresso
#import cProfile, pstats
from espresso import Int3D
from espresso import Real3D
# create default Lennard Jones (WCA) system with 0 particles and cubic box (L=40)
system, integrator = espresso.standard_system.LennardJones(0, box=(20, 20, 20), tempera... | BackupTheBerlios/espressopp | examples/lattice_boltzmann/lattice_boltzmann.py | Python | gpl-3.0 | 2,032 |
# Copyright 2015 OpenStack Foundation.
# 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 requ... | openstack/networking-plumgrid | networking_plumgrid/neutronclient/l2gw_client_ext/_l2_gateway.py | Python | apache-2.0 | 6,014 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import sys
import types
import warnings
from cryptography.utils import d... | sholsapp/cryptography | tests/test_warnings.py | Python | bsd-3-clause | 1,553 |
testProc([1, 2, 3]) # Explicitly passing in a list
testProc() # Using a default empty list
def testProc(n = []):
# Do something with n
print n
| srinivasanmit/all-in-all | interview_qns/testproc.py | Python | gpl-3.0 | 154 |
# Copyright (c) 2015 Vikas Iyengar, iyengar.vikas@gmail.com (http://garage4hackers.com)
# Copyright (c) 2016 Detux Sandbox, http://detux.org
# See the file 'COPYING' for copying permission.
# Import Detux packages
from core.sandbox import Sandbox
from core.report import Report
# import other python packages
import js... | detuxsandbox/detux | detux.py | Python | mit | 1,860 |
# -*- coding: utf-8 -*-
"""script to try out Censored kernel regression
Created on Wed Jan 02 13:43:44 2013
Author: Josef Perktold
"""
import numpy as np
import statsmodels.nonparametric.api as nparam
if __name__ == '__main__':
np.random.seed(500)
nobs = [250, 1000][0]
sig_fac = 1
x = np.random.uni... | yarikoptic/pystatsmodels | statsmodels/examples/ex_kernel_regression3.py | Python | bsd-3-clause | 2,340 |
# coding=utf-8
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | google-research/large_scale_mmdma | lsmmdma/metrics.py | Python | apache-2.0 | 10,204 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-07-19 21:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('plataforma', '0011_auto_20170714_1425'),
]
operations = [
migrations.AlterM... | bodedev/prospera | plataforma/migrations/0012_auto_20170719_2120.py | Python | mit | 1,989 |
"""
Sparse Matrix Types
"""
from sparseMatrix import *
from pysparseMatrix import *
__all__ = filter(lambda s:not s.startswith('_'), dir())
| rspeer/csc-pysparse | pysparse/sparse/__init__.py | Python | bsd-2-clause | 144 |
# -*- coding: utf-8 -*-
"""Factory boy factories for the Dataverse addon."""
from factory import SubFactory, Sequence
from tests.factories import ModularOdmFactory, UserFactory, ProjectFactory, ExternalAccountFactory
from website.addons.dataverse.model import (
AddonDataverseUserSettings,
AddonDataverseNodeSet... | zachjanicki/osf.io | website/addons/dataverse/tests/factories.py | Python | apache-2.0 | 990 |
import sys
sys.path.append('..')
from falcor import *
from helpers import render_frames
exec(open('../../../Source/Mogwai/Data/SceneDebugger.py').read())
# default
render_frames(m, 'default', frames=[64])
# arcade
m.loadScene('Arcade/Arcade.pyscene')
render_frames(m, 'arcade', frames=[64])
exit()
| NVIDIAGameWorks/Falcor | Tests/image_tests/renderscripts/test_SceneDebugger.py | Python | bsd-3-clause | 302 |
# -*- coding: utf-8 -*-
import re
import sys
import urllib
import simplejson
baseUrl = "http://ajax.googleapis.com/ajax/services/language/translate"
def getSplits(text,splitLength=4500):
'''
Translate Api has a limit on length of text(4500 characters) that can be translated at once,
'''
return (text... | ActiveState/code | recipes/Python/576890_PythWrapper_Google_AJAX_Language/recipe-576890.py | Python | mit | 1,480 |
"""
This file stores all possible rolls on all dice, for easy reference in main.py.
"""
SUCCESS = {
"success": 1
}
ADVANTAGE = {
"advantage": 1
}
TRIUMPH = {
"success": 1,
"triumph": 1
}
FAILURE = {
"success": -1
}
THREAT = {
"advantage": -1
}
DESPAIR = {
"success": -1,
"despair": ... | derringt/StarWarsDiceBot | dice_values.py | Python | mit | 1,992 |
# Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de>
# See COPYING for license information.
import os
from tempfile import mkstemp
from lxml import etree
from . import tmpfiles
from . import xmlutil
from . import utils
from . import config
from .utils import ext_cmd, show_dot_graph, page_string
from .msg... | dmuhamedagic/crmsh | crmsh/cibstatus.py | Python | gpl-2.0 | 12,096 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python-sdk | groupdocs/models/SignatureEnvelopeRecipientResponse.py | Python | apache-2.0 | 1,196 |
import re
from pygfa.graph_element.parser import line
from pygfa.graph_element.parser import field_validator as fv
class Edge(line.Line):
def __init__(self):
super().__init__('E')
REQUIRED_FIELDS = { \
'eid' : fv.GFA2_OPTIONAL_ID, \
'sid1' : fv.GFA2_REFERENCE, \
'sid2' : fv.GFA2_REFERENC... | AlgoLab/pygfa | pygfa/graph_element/parser/edge.py | Python | mit | 2,417 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Includes all the test modules from this directory
and runs the tests.
LICENSE:
Braille Grade 2 Translation in Python
Copyright (C) 2016 Antonis Katzourakis
This program is free software: you can redistribute it and/or modify
it under the... | ant0nisk/pyUniBraille | tests/test_all.py | Python | gpl-3.0 | 1,366 |
try:
from urllib.parse import urlparse
from urllib.request import url2pathname
except ImportError: # Python 2
from urllib import url2pathname
from urlparse import urlparse
from django.conf import settings
from django.core.handlers.base import get_path_info
from django.core.handlers.wsgi import WSGI... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/contrib/staticfiles/handlers.py | Python | bsd-3-clause | 2,513 |
#!/usr/local/bin/python
import sys
import subprocess
import re
import argparse
import os
_help = """
Gets the values of debug counters collected with the code in the
CDebugCounter class, see file ../libgpos/include/gpos/common/CDebugCounter.h
"""
# Description:
#
# We start by getting relevant log file lines using g... | 50wu/gpdb | src/backend/gporca/scripts/get_debug_event_counters.py | Python | apache-2.0 | 7,925 |
### 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.
## This program is distributed in the hope that it will be useful,... | portante/sosreport | sos/plugins/dovecot.py | Python | gpl-2.0 | 1,505 |
# Tests of Python-specific parts of the xapian bindings.
#
# Copyright (C) 2007 Lemur Consulting Ltd
# Copyright (C) 2008,2009,2010,2011,2013,2014 Olly Betts
# Copyright (C) 2010,2011 Richard Boulton
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public ... | mespinozas/si | t7/xapian/xapian-bindings/python3/pythontest.py | Python | gpl-2.0 | 56,220 |
import os
import pandas as pd
from igf_data.utils.seqrunutils import get_seqrun_date_from_igf_id
def _count_total_reads(data,seqrun_list):
'''
An internal function for counting total reads
required params:
:param data, A dictionary containing seqrun ids a key an read counts as values
:param seqrun_list, ... | imperial-genomics-facility/data-management-python | igf_data/utils/project_data_display_utils.py | Python | apache-2.0 | 8,493 |
#!/usr/bin/env python
import sys
import os
import re
import GnuPGInterface
import getpass
# sudo apt-get install python-gnupginterface
__version__ = "0.1"
gnupg = GnuPGInterface.GnuPG()
gnupg.options.armor = 1
gnupg.options.meta_interactive = 0
gnupg.options.extra_args.append('--no-secmem-warning')
pwd = re.compil... | rck/pwm | pwm.py | Python | gpl-2.0 | 6,069 |
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | direvus/ansible | lib/ansible/modules/storage/netapp/na_ontap_user.py | Python | gpl-3.0 | 14,895 |
# Generated by Django 2.2.24 on 2021-10-21 02:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("records", "0002_auto_20180819_2314"),
]
operations = [
migrations.AddIndex(
model_name="record",
index=models.Index... | watchdogpolska/feder | feder/records/migrations/0003_auto_20211021_0249.py | Python | mit | 428 |
"""Generic (shallow and deep) copying operations.
Interface summary:
import copy
x = copy.copy(y) # make a shallow copy of y
x = copy.deepcopy(y) # make a deep copy of y
For module specific errors, copy.Error is raised.
The difference between shallow and deep copying is... | kubaszostak/gdal-dragndrop | osgeo/apps/Python27/Lib/copy.py | Python | mit | 11,966 |
import unittest
from pheme.util.lock import Lock
from lockfile import LockTimeout
class TestLock(unittest.TestCase):
lockfilename = 'unittest'
def setUp(self):
self.lock = Lock(self.lockfilename)
def tearDown(self):
if self.lock.is_locked():
self.lock.break_lo... | pbugni/pheme.util | pheme/util/tests/test_lock.py | Python | bsd-3-clause | 864 |
import numpy as np
from scipy.sparse import lil_matrix
from research.three_phase.Engine.general import *
from research.three_phase.Engine.circuit_matrix_results import *
class CircuitMatrixInputs:
def __init__(self, n, m, n_phase):
"""
Class to store the compiled circuit matrices and vectors
... | SanPen/GridCal | src/research/three_phase/Engine/circuit_matrix_inputs.py | Python | lgpl-3.0 | 6,710 |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from .app import summary
from .debug import debug_query
from .collections import (list_collections, create_collections)
from .items import (list_... | huntermatthews/sot | sotd/frontend/__init__.py | Python | apache-2.0 | 393 |
#!/usr/bin/env python
import numpy as np,plot,auger,subprocess,tableio,dump
#OPT: quickly get sorted rundirs
# zb autogen | sort -k1.13 -r
#OPT: fix seed
#np.random.seed(65983247)
np.random.seed(983452324)
addnoise=False
precolli=False #gaan we niet meer doen
pgexit = True #if so, then pgprod_ratio must be set.
pr... | brenthuisman/phd_tools | analysis.lyso4.falloff.py | Python | lgpl-3.0 | 6,376 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Financial contributors: Hasa SA, Open Net SA,
# Prisme Solutions Informatique SA, Quod SA
#
# Translation contributors: brain-te... | addition-it-solutions/project-all | addons/l10n_ch/__openerp__.py | Python | agpl-3.0 | 2,509 |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... | rajalokan/nova | nova/policies/extended_status.py | Python | apache-2.0 | 1,342 |
#!/usr/bin/env python
# coding=utf-8
"""486. Palindrome-containing strings
https://projecteuler.net/problem=486
Let F5(n) be the number of strings s such that:
* s consists only of '0's and '1's,
* s has length at most n, and
* s contains a palindromic substring of length at least 5.
For example, F5(4) = 0... | openqt/algorithms | projecteuler/pe486-palindrome-containing-strings.py | Python | gpl-3.0 | 525 |
#!/usr/bin/env python
import numpy as np
# Traits stuff
from traits.api import HasTraits, Instance, Array, Bool, Dict, Range, \
Color, List, Int, Property, Any, Function, DelegatesTo, Str, Enum, \
on_trait_change, Button, Set, File
from traitsui.api import View, Item, VGroup, HGroup, Group, \
RangeEditor... | mattcieslak/DSI2 | dsi2/ui/browser_builder.py | Python | gpl-3.0 | 6,741 |
# Python - 3.6.0
greet = lambda name: f'Hello, {name} how are you doing today?'
| RevansChen/online-judge | Codewars/8kyu/returning-strings/Python/solution1.py | Python | mit | 81 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Adrien Chardon
# @Date: 2014-08-20 14:50:12
# @Last Modified by: Adrien Chardon
# @Last Modified time: 2014-11-01 14:17:14
# This file is part of iTeam.org.
# Copyright (C) 2014 Adrien Chardon (Nodraak).
#
# iTeam.org is free software: you can redistribute i... | Nodraak/iteam-site | iTeam/events/tests.py | Python | agpl-3.0 | 10,681 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#
# Copyright 2010 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... | nearlyfreeapps/python-googleadwords | tests/adspygoogle/adwords/ad_param_service_unittest.py | Python | apache-2.0 | 6,640 |
from unittest import TestCase
from qdict import *
class ListEqualOperatorTests(TestCase):
def test_equal__find_obj_simple_value__get_obj_correctly(self):
# fixtures
obj = [
{"a": 1, "b": True, "c": {"a": 2}},
{"a": 2, "b": True, "c": {"a": 2}},
{"a": 3, "b": Fa... | Pythonicos/qdict | tests/test_lists.py | Python | mit | 12,067 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2022 Roberto Alsina 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 t... | getnikola/nikola | nikola/plugins/command/serve.py | Python | mit | 10,347 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# LICENSE
#
# Copyright (C) 2010-2022 GEM Foundation, G. Weatherill, M. Pagani,
# D. Monelli.
#
# The Hazard Modeller's Toolkit is free software: you can redistribute
# it and/or modify it under the terms of the GNU Affero General Public
# License a... | gem/oq-engine | openquake/hmtk/tests/strain/test_kreemer_regionalisation.py | Python | agpl-3.0 | 7,560 |
from unittest import TestCase
from mock import Mock, patch
from regulations.generator import notices
class NoticesTest(TestCase):
def test_fetch_all(self):
api = Mock()
api.notices.return_value = {"results": [
{"document_number": "1234"}, {"document_number": "9898"}
]}
... | jeremiak/regulations-site | regulations/tests/notices_tests.py | Python | cc0-1.0 | 8,616 |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import re
import sys
import subprocess
import shlex
from powerline.config import POWERLINE_ROOT, TMUX_CONFIG_DIRECTORY
from powerline.lib.config import ConfigLoader
from powerline import genera... | lukw00/powerline | powerline/bindings/config.py | Python | mit | 9,983 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "edugway.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mgardnerpsu/duke-edu-gateway | manage.py | Python | mit | 250 |
#!/usr/bin/env python
# Copyright (c) 2002 Trent Mick
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, ... | TaherGhasimakbari/CPSCF | tools/python/preprocess-0.6.1/setup.py | Python | gpl-2.0 | 2,774 |
from __future__ import division
import re
import xlrd
import sys
import numpy as np
from scipy.stats.mstats import mquantiles
import matplotlib.pyplot as plt
# ---- COMMENTS ----
# [because we don't care about which sample is greater] Why 2*min(c,1-c) for p-value? I think min(c,1-c) is enough...
# Print out ... | lponnala/glee-py-gui | old-code/glee.py | Python | gpl-2.0 | 17,623 |
# Copyright 2014: 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... | ytsarev/rally | rally/objects/endpoint.py | Python | apache-2.0 | 1,276 |
from django.conf.urls import patterns, url
from django.conf import settings
from views import RecipeList, RecipeDetail, AddRecipe, IngredientList
urlpatterns = patterns('',
url('^recipes/$', RecipeList.as_view(), name='recipe-list'),
url('^recipes/(?P<pk>[0-9]+)/$', RecipeDetail.as_view(), name='recipe-detail... | larmstrong12/portfolio | backend/apps/recipes/urls.py | Python | apache-2.0 | 576 |
# -*- coding: utf-8 -*-
from django.urls import path
from search.views import SearchPageView, SearchProjectView
urlpatterns = [
path(
route='',
view=SearchProjectView.as_view(),
name='index'
),
path(
route='pages/',
view=SearchPageView.as_view(),
name='pages... | srtab/alexandriadocs | alexandriadocs/search/urls.py | Python | apache-2.0 | 331 |
from ..core import globalSystem
from .core import *
class DieIfOffscreen(Component):
"""
An automatic component that kills the bullet if it goes
off-screen.
"""
AUTOMATIC = True
def initialize(self, **config):
# The amount of leeway the bullet has when determining if it is
# offscreen or not. If its value... | FCDM/py-dml | dml/components/death.py | Python | mit | 1,177 |
#===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------... | endlessm/chromium-browser | third_party/llvm/libcxx/test/pretty_printers/gdb_pretty_printer_test.py | Python | bsd-3-clause | 4,087 |
class Square():
"""Creates an appearance for the square"""
def __init__(self):
self.appearance = "."
self.componentList = []
def addComponent(self,component):
self.componentList.append(component)
#if we find out that there exists a real function like this, use that instead TODO tes... | esquishesque/bromance | squares.py | Python | gpl-2.0 | 2,438 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.