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 |
|---|---|---|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2017 SUSE LLC.
#
# This file is part of openbare.
#
# openbare 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... | openbare/openbare | library/management/commands/aws_setup.py | Python | gpl-3.0 | 4,294 |
#!/usr/bin/python2.6
import os
import tempfile
import unittest
import ScriptWriter
class ScriptWriterTest(unittest.TestCase):
def setUp(self):
self.phosim_bin_dir = '_phosim_bin_dir'
self.phosim_data_dir = '_phosim_data_dir'
self.phosim_output_dir = '_phosim_output_dir'
self.phosim_work_dir = '_phos... | lsst-sims/sims_phosim_pythoncontrol | ScriptWriter_test.py | Python | gpl-3.0 | 924 |
from django.core.exceptions import ObjectDoesNotExist
import pybb.views
import pybb.forms
from catalogue.models import Lesson
from .forms import PostForm
from .models import Topic
class PostEditMixin(pybb.views.PostEditMixin):
def get_form_class(self):
toret = super(PostEditMixin, self).get_form_class(... | fnp/edumed | forum/views.py | Python | agpl-3.0 | 1,763 |
import sys
import os
gitignore_text= '''
LOG/*
*.png
*.hdf5
'''
assert(len(sys.argv) >=2)
tut_numb = int(sys.argv[1])
tut_name = " ".join(sys.argv[2:])
tut_dir = "Tut{0:06}".format(tut_numb)
os.mkdir(tut_dir)
os.mkdir(tut_dir+"/LOG")
f= open(tut_dir+"/.gitignore","w")
f.write(gitignore_text)
f.close()
f= open("log... | nithishdivakar/PyMLTut | new-exp.py | Python | gpl-2.0 | 396 |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt stringdefs so that
they can be picked up by Qt linguist.
'''
from __future__ import division,print_function,unicode_literals
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/diamondstrings.cp... | LIMXTEC/DMDv3 | share/qt/extract_strings_qt.py | Python | mit | 2,164 |
from PyQt4 import QtCore, QtGui
class ColorBox(QtGui.QFrame):
def __init__(self,parent=None):
super(ColorBox,self).__init__(parent)
self.bgColor = QtCore.Qt.white
self.setFixedHeight(20)
self.setFrameStyle(1)
self.setStyleSheet("QWidget { border-color: rgba(0... | janusnic/21v-python | unit_13/colorbox.py | Python | mit | 812 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import sys
import time
import types
import ray
logger = logging.getLogger(__name__)
logger.setLevel("DEBUG")
#
# Each Ray actor corresponds to an operator instance in the physical dataflow
# A... | atumanov/ray | python/ray/experimental/streaming/operator_instance.py | Python | apache-2.0 | 12,727 |
# -*- coding: utf-8 -*-
"""A model of an Openstack Infrastructure Node in CFME."""
import attr
from cfme.infrastructure.host import Host
from cfme.infrastructure.host import HostsCollection
from cfme.utils.appliance.implementations.ui import navigate_to
class OpenstackNode(Host):
"""
Model of Openstack Infra... | Yadnyawalkya/integration_tests | cfme/infrastructure/openstack_node.py | Python | gpl-2.0 | 1,673 |
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from frappe.model.document import Document
class AgricultureAnalysisCriteria(Document):
pass
| mhbu50/erpnext | erpnext/agriculture/doctype/agriculture_analysis_criteria/agriculture_analysis_criteria.py | Python | gpl-3.0 | 217 |
from django import forms
from django.contrib.auth.models import User
from worldcup.predictions.models import Prediction, WIN_DRAW_CHOICES, DRAW_VAL, TEAM_1_WINS_VAL, TEAM_2_WINS_VAL
from worldcup.matches.models import Match
class PredictionForm(forms.ModelForm):
user = forms.IntegerField(widget=forms.HiddenInput(... | raprasad/worldcup | worldcup/worldcup/predictions/forms.py | Python | mit | 2,654 |
# -*- coding: utf-8 -*-
# Author: Aziz Köksal
# License: zlib/libpng
from __future__ import print_function
from common import *
from symbols import *
def win_path(p):
""" Converts a Unix path to a Windows path. """
return call_read(["winepath", "-w", p])[:-1]
def win_paths(ps):
return map(win_path, ps)
if is_w... | SiegeLord/dil | scripts/html2chm.py | Python | gpl-3.0 | 5,913 |
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **GUI Test Cases.**
Contact : ole.moller.nielsen@gmail.com
.. 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 Foun... | gvallarelli/inasafe | safe_qgis/test_impact_functions_doc.py | Python | gpl-3.0 | 4,722 |
"""Wrapped Cauchy distribution."""
import numpy
from scipy import special
from ..baseclass import SimpleDistribution, ShiftScaleDistribution
class wrapped_cauchy(SimpleDistribution):
"""Wrapped Cauchy distribution."""
def __init__(self, c):
super(wrapped_cauchy, self).__init__(dict(c=c))
def _p... | jonathf/chaospy | chaospy/distributions/collection/wrapped_cauchy.py | Python | mit | 2,559 |
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM 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 Founda... | mmariani/dream | dream/simulation/M3.py | Python | gpl-3.0 | 2,644 |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 OpenStack Foundation
# Copyright 2012 Grid Dynamics
# Copyright 2013 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... | pravisankar/python-solumclient | solumclient/openstack/common/apiclient/base.py | Python | apache-2.0 | 16,200 |
from setuptools import setup
setup(
name='Project Numerical',
install_requires=[
'numpy',
'scipy',
'mpmath',
'sympy',
'matplotlib',
'lmfit'
],
url='https://github.com/protocol114/numerical-2.2',
author='Johnathan Becker, Nick Duncan, David Heisler, Vu... | protocol114/numerical-2.2 | setup.py | Python | mit | 331 |
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
import os
import re
import sys
import time
import conf
import g
log = g.log.getLogger('import_cyclop')
from util_ import misc
from merge.import_items_ccp import Import_Items_Ccp
class Import_Cyclop(Impor... | lbouma/Cyclopath | services/merge/import_cyclop.py | Python | apache-2.0 | 4,665 |
# Generated by Django 2.1.15 on 2021-01-26 21:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('oozie', '0006_auto_20200714_1204'),
]
operations = [
migrations.AlterField(
model_name='job',
name='is_trashed',
... | kawamon/hue | apps/oozie/src/oozie/migrations/0007_auto_20210126_2113.py | Python | apache-2.0 | 800 |
from django.contrib import admin
from .models import Person, Relationship, AKA
class AKAInline(admin.TabularInline):
model = AKA
extra = 1
class LettersToInline(admin.TabularInline):
model = Person.letters_to.through
verbose_name_plural = "Letters of Pliny to this Person"
show_change_link = True... | bwhicks/PlinyProject | backend/prosopography/admin.py | Python | mit | 1,610 |
# -*- coding: utf-8 -*-
#
# Développement d'une application web de création de quiz documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 29 18:28:40 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values... | csudmath/ma3ecg | source/conf.py | Python | gpl-2.0 | 7,658 |
info = {
"name": "ca",
"date_order": "DMY",
"january": [
"de gen",
"de gener",
"gen",
"gener"
],
"february": [
"de febr",
"de febrer",
"febr",
"febrer"
],
"march": [
"de març",
"març"
],
"april": [
... | scrapinghub/dateparser | dateparser/data/date_translation_data/ca.py | Python | bsd-3-clause | 5,882 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-01-19 09:25
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0219_auto_20180116_1052'),
]
operations = [
migrations.RemoveField(
... | uclouvain/OSIS-Louvain | base/migrations/0220_remove_campus_code.py | Python | agpl-3.0 | 388 |
from django.shortcuts import redirect
def home(request):
return redirect('identity.views.index') | damondouglas/identity-toolkit-gae-django | views.py | Python | apache-2.0 | 98 |
import time
from twisted.internet import reactor
from twisted.internet.protocol import DatagramProtocol
from twisted.internet.error import ConnectionDone
from twisted.protocols.basic import LineOnlyReceiver, Int32StringReceiver
from carbon import log, events, state, management
from carbon.conf import settings
from car... | acquia/carbon | lib/carbon/protocols.py | Python | apache-2.0 | 5,336 |
from django.conf import settings as django_settings
def settings(request):
return {'settings': django_settings}
| chrooter/planbox | src/planbox_ui/context_processors.py | Python | gpl-3.0 | 117 |
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
from squeezemail.tasks import run_steps
run_steps.delay()
| rorito/django-squeezemail | squeezemail/management/commands/run_steps_task.py | Python | mit | 197 |
# Copyright (c) 2020, NVIDIA CORPORATION. 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 appli... | mlperf/inference_results_v0.7 | closed/Fujitsu/code/common/system_list.py | Python | apache-2.0 | 1,156 |
#
# Tuxemon
# Copyright (C) 2014, William Edwards <shadowapex@gmail.com>,
# Benjamin Bean <superman2k5@gmail.com>
#
# This file is part of Tuxemon.
#
# Tuxemon 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 So... | Tuxemon/Tuxemon | tuxemon/states/transition/flash.py | Python | gpl-3.0 | 3,258 |
import os
import sys
import msgfmt
from setuptools import setup
from setuptools.command.install_lib import install_lib as _install_lib
from setuptools.command.develop import develop as _develop
from distutils.command.build import build as _build
from setuptools.command.test import test as TestCommand
from distutils.cm... | ael-code/libreant | setup.py | Python | agpl-3.0 | 4,963 |
import collections
import os
import sys
import numpy
try:
from PIL import Image
available = True
except ImportError as e:
available = False
_import_error = e
import chainer
from chainer.dataset.convert import concat_examples
from chainer.dataset import download
from chainer import function
from chaine... | ktnyt/chainer | chainer/links/model/vision/vgg.py | Python | mit | 21,615 |
from dwarfsquad.model.AssayConfiguration import AssayConfiguration
from dwarfsquad.lib import rest_api
from dwarfsquad.lib.urls import assay_configurations
def list_assay_configuration(url, data, credentials):
ac_url = assay_configurations(url)
ac_names = []
for ac in rest_api.get(ac_url, credentials).js... | whereskenneth/Dwarfsquad | dwarfsquad/lib/list/list_assay_configuration.py | Python | mit | 427 |
#!/usr/bin/python
from macaroon.playback import *
import utils
sequence = MacroSequence()
#sequence.append(WaitForDocLoad())
sequence.append(PauseAction(5000))
sequence.append(KeyComboAction("<Control>Home"))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Tab"))
sequence.append(utils.... | chrys87/orca-beep | test/keystrokes/firefox/label_inference_labels_without_for_far_away.py | Python | lgpl-2.1 | 1,342 |
'''
Created on Aug 8, 2015
@author: Ruu
'''
def reverse_string(s):
i = len(s) - 1
s2 = ""
while i >= 0:
s2 += s[i]
i -= 1
return s2
def remove_zeros(s):
if s[0] == "0":
return remove_zeros(s[1:])
else:
return s
lines = int(input())
i = 0
while i < lines:
... | ruu-ametisti/programming-problems | spoj/adding_reversed_numbers.py | Python | gpl-2.0 | 579 |
#!/usr/bin/env python3.5
import io, re
class FilterModule(object):
def filters(self):
return {
'ios_domainname_filter': self.ios_domainname_filter,
'ios_cdp_filter': self.ios_cdp_filter
}
def ios_domainname_filter(self, cdp_hosts_output):
domainname = re.finda... | dainok/netdoc | filters/custom_filters.py | Python | gpl-3.0 | 5,776 |
from shape_creator import read_csv
import rasterizer
import os
read_csv('WithinUSForestry.csv')
| skochaver/sciencebase_analysis | runner.py | Python | unlicense | 97 |
"""
This is Mopidy's MPD protocol implementation.
This is partly based upon the `MPD protocol documentation
<http://www.musicpd.org/doc/protocol/>`_, which is a useful resource, but it is
rather incomplete with regards to data formats, both for requests and
responses. Thus, we have had to talk a great deal with the th... | rawdlite/mopidy | mopidy/mpd/protocol/__init__.py | Python | apache-2.0 | 6,338 |
# Do NOT name manual tests with _test
import random
from urllib import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __in... | cohadar/learn-python-the-hard-way | oop_manual.py | Python | mit | 2,328 |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
_standard_context_processors = None
class ContextPopException(Exception):
"pop() has been called more times than push()"
pass
class Context(object):
"A stack container for variable context"
def __init__(self, dic... | jonaustin/advisoryscan | django/django/template/context.py | Python | mit | 3,286 |
"""
==================
Pipeline ANOVA SVM
==================
This example shows how a feature selection can be easily integrated within
a machine learning pipeline.
We also show that you can easily introspect part of the pipeline.
"""
from sklearn import set_config
set_config(display="diagram")
# %%
# We will sta... | manhhomienbienthuy/scikit-learn | examples/feature_selection/plot_feature_selection_pipeline.py | Python | bsd-3-clause | 2,811 |
# -*- coding: utf-8 -*-
"""
python -m scripts/Online_PassiveAggressive_countmeansketch LMdata 3 1 a ODDST 0.01
Created on Fri Mar 13 13:02:41 2015
Copyright 2015 Nicolo' Navarin
This file is part of scikit-learn-graph.
scikit-learn-graph is free software: you can redistribute it and/or modify
it under the terms... | nickgentoo/scikit-learn-graph | scripts/Online_PassiveAggressive_countmeansketch_unbiased.py | Python | gpl-3.0 | 10,074 |
import random
def create_list(size, min, max):
my_list = []
for _ in range(size):
my_list.append(random.randint(min, max))
return my_list
def count_value(seq, value):
counter = 0
for e in seq:
if e == value:
counter = counter + 1
return counter
if __name__ == "_... | TGITS/programming-workouts | erri/python/lesson_49/frequencies.py | Python | mit | 628 |
"""Provide the DomainListing class."""
from ...const import API_PATH
from .mixins import BaseListingMixin, RisingListingMixin
class DomainListing(BaseListingMixin, RisingListingMixin):
"""Provide a set of functions to interact with domain listings."""
def __init__(self, reddit, domain):
"""Initialize... | 13steinj/praw | praw/models/listing/domain.py | Python | bsd-2-clause | 591 |
from unittest import TestCase
from pykechain.utils import Empty, get_in_chunks, is_url, is_valid_email
class TestIsURL(TestCase):
def test_is_url_returns_true_on_valid_url(self):
addresses = [
"http://foobar.dk",
"http://foobar.museum/foobar",
"http://fo.com",
... | KE-works/pykechain | tests/test_utils.py | Python | apache-2.0 | 6,526 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py | Python | mit | 30,610 |
# -*- coding: utf-8 -*-
"""
pygments.styles.borland
~~~~~~~~~~~~~~~~~~~~~~~
Style similar to the style used in the Borland IDEs.
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygment... | ktan2020/legacy-automation | win/Lib/site-packages/wx-3.0-msw/wx/tools/Editra/src/extern/pygments/styles/borland.py | Python | mit | 1,613 |
"""
LTI Advantage Assignments and Grades service implementation
"""
class LtiAgs:
"""
LTI Advantage Consumer
Implements LTI Advantage Services and ties them in
with the LTI Consumer. This only handles the LTI
message claim inclusion and token handling.
Available services:
* Assignments a... | edx/xblock-lti-consumer | lti_consumer/lti_1p3/ags.py | Python | agpl-3.0 | 2,256 |
import sys, os
from cts.CTSvars import *
patternvariants = {}
class BasePatterns:
def __init__(self, name):
self.name = name
patternvariants[name] = self
self.ignore = [
"avoid confusing Valgrind",
]
self.BadNews = []
self.components = {}
self.co... | vmgmedia/pacemaker | cts/patterns.py | Python | gpl-2.0 | 23,982 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2010-2014 Uwe Hermann <uwe@hermann-uwe.de>
##
## 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 t... | JenSte/libsigrokdecode | decoders/i2c/pd.py | Python | gpl-3.0 | 10,816 |
#
# This sets up how models are displayed
# in the web admin interface.
#
from django.contrib import admin
from src.comms.models import Channel, Msg, PlayerChannelConnection, ExternalChannelConnection
class MsgAdmin(admin.ModelAdmin):
list_display = ('id', 'db_date_sent', 'db_sender', 'db_receivers', 'db_channels... | TaliesinSkye/evennia | src/comms/admin.py | Python | bsd-3-clause | 2,737 |
#!/usr/bin/python3
# SCRIPT FOR PREPARING MSRC DATASET PIXEL LABELING
# Stephen Gould <stephen.gould@anu.edu.au>
#
import fileinput
import os
import shutil
import sys
import urllib.request
import zipfile
# script configuration -----------------------------------------------
if len(sys.argv) != 2:
print("USAGE: "... | e-soroush/drwnProject | projects/multiSeg/prepareMSRCDemo.py | Python | gpl-3.0 | 2,306 |
import types
from functools import wraps
import numpy as np
import datetime
import collections
import warnings
import copy
from textwrap import dedent
from pandas.compat import (
zip, range, lzip,
callable, map
)
from pandas import compat
from pandas.compat.numpy import function as nv
from pandas.compat impor... | NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/core/groupby.py | Python | apache-2.0 | 154,232 |
"""Test config utils."""
# pylint: disable=too-many-public-methods,protected-access
import unittest
import unittest.mock as mock
import os
import pytest
from voluptuous import MultipleInvalid
from homeassistant.core import DOMAIN, HomeAssistantError
import homeassistant.config as config_util
from homeassistant.const ... | mikaelboman/home-assistant | tests/test_config.py | Python | mit | 5,521 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2009 Douglas S. Blank <doug.blank@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the L... | arunkgupta/gramps | gramps/webapp/grampsdb/view/event.py | Python | gpl-2.0 | 8,910 |
# -*- encoding: utf-8 -*-
# menuAccesible basado en el actor menu de pilas.
from pilasengine.actores.actor import Actor
from pilasengine import colores
from pilasengine.controles import simbolos
class Menu(Actor):
"""Un actor que puede mostrar una lista de opciones a seleccionar."""
def __init__(self, pilas,... | barrazamiguel/pydrez | actores/menu.py | Python | gpl-3.0 | 7,315 |
import os
from flask import Flask
from flask import render_template
from redis import Redis
app = Flask(__name__)
app.debug=True
redis_host = os.environ.get('REDISHOST', '127.0.0.1')
redis = Redis(host=redis_host)
@app.route("/")
def switch_list():
seed_list = redis.smembers('seed_list')
return render_templ... | dvanduzer/Baudrillard | dashboard/web.py | Python | mit | 626 |
"""Test the National Weather Service (NWS) config flow."""
from unittest.mock import patch
import aiohttp
from homeassistant import config_entries, setup
from homeassistant.components.nws.const import DOMAIN
async def test_form(hass, mock_simple_nws_config):
"""Test we get the form."""
hass.config.latitude ... | sander76/home-assistant | tests/components/nws/test_config_flow.py | Python | apache-2.0 | 3,564 |
#!/usr/bin/env python
__author__ = "waroquiers"
import networkx as nx
from pymatgen.analysis.chemenv.connectivity.connected_components import (
ConnectedComponent,
)
from pymatgen.analysis.chemenv.connectivity.connectivity_finder import (
ConnectivityFinder,
)
from pymatgen.analysis.chemenv.connectivity.env... | vorwerkc/pymatgen | pymatgen/analysis/chemenv/connectivity/tests/test_connected_components.py | Python | mit | 31,588 |
import sublime
_settings_file = "GitConflictResolver.sublime-settings"
_subl_settings = {}
_default_settings = {
"live_matching": True,
"matching_scope": 'invalid',
"fill_conflict_area": False,
"outline_conflict_area": True,
"ours_gutter": True,
"ancestor_gutter": True,
"theirs_gutter": Tru... | Zeeker/sublime-GitConflictResolver | modules/settings.py | Python | mit | 555 |
from django.shortcuts import render, redirect, get_object_or_404
from django.views.generic import TemplateView
from farxiv.forms import *
class Index(TemplateView):
template_name = 'index.html'
def get_context_data(self, **kwargs):
context = super(TemplateView, self).get_context_data(**kwargs)
... | ghallsimpsons/farxiv | farxiv/views.py | Python | unlicense | 1,516 |
#this file does not do anything
#TLDR: use csv because you probably won't know how to handle
#fields with commas in them
import csv
with open('tab_delimited_stock_prices.txt','rb') as f:
reader = csv.reader(f,delimiter='\t')
for row in reader:
data = row[0]
symbol = row[1]
closing_price = float(row[2])
#proc... | buckiracer/data-science-from-scratch | RefMaterials/Text-Manipulation/stock_parser.py | Python | unlicense | 824 |
"""
fabcloudkit
Functions for managing Nginx.
This module provides functions that check for installation, install, and manage an
installation of, Nginx.
/etc/init.d/nginx:
The "init-script" that allows Nginx to be run automatically at system startup.
The existence of this file is ... | waxkinetic/fabcloudkit | fabcloudkit/tool/nginx.py | Python | bsd-3-clause | 6,961 |
"""
Esercizio 1: ricerca dei percorsi dei file a partire da una cartella
python3 23_03_es1.py <cartella_di_partenza>
"""
import os
import sys
import pathlib
import stat
def insert_dict(dictlink, key, value):
"""
Inserisce un nuovo elemento nel dizionario rispettando il default
"""
if key not in dictlin... | sb00nk/PythonExercises | 23_03_es1.py | Python | mit | 1,419 |
from django.contrib import admin
from .models import WallReplyNew, WallReplyEdit, WallPostNew, PhotoCommentNew
class WallReplyNewAdmin(admin.ModelAdmin):
fieldsets = (
(None,
{'fields': ('text',)}),
)
admin.site.register(WallReplyNew, WallReplyNewAdmin)
class WallReplyEditAdmin(admin.Mode... | dw9694/django_blog | social_networks/admin.py | Python | gpl-3.0 | 809 |
import typing as t
import warnings
from .request import Request
class _FakeSubclassCheck(type):
def __subclasscheck__(cls, subclass: t.Type) -> bool:
warnings.warn(
"'BaseRequest' is deprecated and will be removed in"
" Werkzeug 2.1. Use 'issubclass(cls, Request)' instead.",
... | mitsuhiko/werkzeug | src/werkzeug/wrappers/base_request.py | Python | bsd-3-clause | 1,174 |
##########################################################################
#
# Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | chippey/gaffer | python/GafferSceneTest/AimConstraintTest.py | Python | bsd-3-clause | 8,680 |
# -*- coding: utf-8 -*-
from time import sleep
from lettuce import step, world
from lettuce.django import django_url
from nose.tools import assert_equal
from django.core.urlresolvers import reverse
from storybase_story.models import Story
@step(u'Given the user opens the Story "([^"]*)" in the story builder with a... | denverfoundation/storybase | apps/storybase_story/features/417-builder_hash_url-steps.py | Python | mit | 4,078 |
#
# Copyright (C) 2020 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be... | atodorov/anaconda | pyanaconda/core/storage.py | Python | gpl-2.0 | 11,513 |
# -*- coding: utf-8 -*-
r"""This is rule-based deduction system for SymPy
The whole thing is split into two parts
- rules compilation and preparation of tables
- runtime inference
For rule-based inference engines, the classical work is RETE algorithm [1],
[2] Although we are not implementing it in full (or even s... | wxgeo/geophar | wxgeometrie/sympy/core/facts.py | Python | gpl-2.0 | 15,895 |
# Renamed from types.py to avoid clash with stdlib module.
# In the future, use explicitly relative imports or absolute
# imports as a better solution.
import conditions
import graph
import itertools
class Type(object):
def __init__(self, name, basetype_name=None):
self.name = name
self.basetype_name = ba... | dpattiso/igraph | lama/translate/pddl/pddl_types.py | Python | gpl-2.0 | 2,307 |
"""functions that directly handle user input
"""
import sys
import time
import logging
from askbot.utils import path
def start_printing_db_queries():
"""starts logging database queries into console,
should be used for debugging only"""
logger = logging.getLogger('django.db.backends')
logger.setLevel(lo... | fitoria/askbot-devel | askbot/utils/console.py | Python | gpl-3.0 | 9,168 |
class ResFileReader(object):
"""Process the result file from the search engine.
This class can be extended to handle various file formats coming from
different IR engines, i.e. Terrier (answerbag) and Watson (jeopardy)
The information we need to extract is qid, if the candidate answer is
relevant or ... | tudarmstadt-lt/QASelection | src/main/resources/scripts/res_file_reader.py | Python | apache-2.0 | 1,295 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, merge, publish,
... | timj/scons | test/runtest/simple/fail.py | Python | mit | 1,784 |
try:
import unittest2 as unittest
except ImportError:
import unittest
import rope.base.project
import rope.base.builtins
from rope.base import libutils
from ropetest import testutils
class ObjectInferTest(unittest.TestCase):
def setUp(self):
super(ObjectInferTest, self).setUp()
self.proj... | emacsway/rope | ropetest/objectinfertest.py | Python | gpl-2.0 | 14,587 |
from rest_framework import viewsets, mixins, status
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from rest_framework.response import Response
from rest_framework.exceptions import AuthenticationFailed
from rest_framework import exceptions
from django.utils.tr... | GuoDuanLZ/sdustoj-judge-webserver | sdustoj_server/user/api_server/function_views.py | Python | apache-2.0 | 2,036 |
#!/usr/bin/env python
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
# Read ASN.1/PEM X.509 CRMF request on stdin, parse into
# plain text, then build substrate from it
#
import sys
from pyasn1.codec.der imp... | pexip/os-python-pyasn1-modules | tools/crmfdump.py | Python | bsd-2-clause | 795 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2020_11_01_preview/_app_platform_management_client.py | Python | mit | 6,912 |
# -*- coding:utf-8 -*-
__author__ = 'Edwin.Wu'
__date__ = '2017/3/19 23:01'
from django import forms
from captcha.fields import CaptchaField
class LoginForm(forms.Form):
username = forms.CharField(required=True, min_length=5)
password = forms.CharField(required=True, min_length=5)
class RegisterForm(forms.... | why168/PythonProjects | MxOnlie/apps/users/forms.py | Python | artistic-2.0 | 816 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2010-2012 Associazione OpenERP Italia
# (<http://www.openerp-italia.org>).
# Copyright(c)2008-2010 SIA "KN dati".(http://kndati.lv) All Rights Reserved.
# Ge... | Micronaet/micronaet-mx | mx_order_report_aeroo/report/sale_parser.py | Python | agpl-3.0 | 2,243 |
from numpy import arange, histogram, histogram2d, linspace, logspace, median, percentile
from artist import Plot
from sapphire import CorsikaQuery
# proton = 14
# iron = 5626
OVERVIEW = '/Users/arne/Datastore/CORSIKA/corsika_overview.h5'
def plot_interaction_height(cq):
plot = Plot()
p = 'proton'
for... | HiSPARC/topaz | 150722_interaction_altitudes/interaction_altitudes.py | Python | gpl-3.0 | 3,093 |
#coding: utf-8
from unittest import TestCase
from formalchemy2.renderers import BaseRenderer
class TestBaseRenderer(TestCase):
Renderer = BaseRenderer
def test_render(self):
renderer = self.Renderer()
self.assertRaises(NotImplementedError, renderer.render, 'fake field')
| aconrad/FormAlchemy2 | tests/test_renderer_base.py | Python | mit | 301 |
# Copyright (C) 2014 Kieran Colford
#
# This file is part of txt2boil.
#
# txt2boil is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... | kcolford/txt2boil | test/testracket.py | Python | gpl-3.0 | 2,311 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import re
from setuptools import setup
from setuptools import find_packages
with io.open('README.md', 'rt', encoding='utf8') as f:
readme = f.read()
with io.open('requirements.txt', 'rt', encoding='utf8') as f:
requirements = f.read().split('\n')
with i... | hni14/jismesh | setup.py | Python | mit | 2,512 |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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... | pkilambi/ceilometer | ceilometer/agent/plugin_base.py | Python | apache-2.0 | 9,792 |
class Matrix(object):
def __init__(self):
pass
| rootulp/xpython | exercises/matrix/matrix.py | Python | mit | 59 |
"""
This file is about errors in Python files and not about exception handling in
Jedi.
"""
def parso_to_jedi_errors(grammar, module_node):
return [SyntaxError(e) for e in grammar.iter_errors(module_node)]
class SyntaxError(object):
"""
Syntax errors are generated by :meth:`.Script.get_syntax_errors`.
... | srusskih/SublimeJEDI | dependencies/jedi/api/errors.py | Python | mit | 1,192 |
from django.contrib import admin
from polls.models import Choice, Poll
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question']}),
('Date information', {'fields': ['pub_date'], 'classes... | damiencalloway/djtut | mysite/polls/admin.py | Python | mit | 570 |
from django.shortcuts import render, get_object_or_404
from models import Contact
def index(request):
# Get ten Opportunities
contacts = Contact.objects.all()[:10]
context = {
'contacts': contacts,
}
return render(request, 'sdh/index.html', context)
| brianzar/serene-island-1235 | sdh/views.py | Python | gpl-3.0 | 281 |
#!/usr/bin/env python
"""
This file is part of open-ihm.
open-ihm is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
open-ihm is di... | r4vi/open-ihm | src/openihm/gui/interface/frmproject_configure_cropincome.py | Python | lgpl-3.0 | 5,996 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.urlresolvers import reverse
from transifex.languages.models import Language
from transifex.resources.models import SourceEntity
from transifex.teams.models import Team
from transifex.txcommon.tests.base import BaseTestCase
class ResourcesTemplat... | rvanlaar/easy-transifex | src/transifex/transifex/resources/tests/templates.py | Python | bsd-2-clause | 7,945 |
# -*- coding: utf-8 -*-
"""
urls
~~~~
URL definitions.
:copyright: 2009 by tipfy.org.
:license: BSD, see LICENSE.txt for more details.
"""
from tipfy import Rule
def get_rules(app):
"""Returns a list of URL rules for the Hello, World! application.
:param app:
The WSGI applicatio... | freeflightsim/ffs-app-engine | freeflightsim.appspot.com/apps/www/urls.py | Python | gpl-2.0 | 600 |
%bash/bin/python
import sys
import os
import socket
host = localhost
port = 2275
}
s == socket.socket
{
s.connect('$port' , '$host' );
def curlhttp ('http keepalive == 300 tps '):
curlhttp ('http keepalive == 300 tps '):
elif curlhttp ('https keepalive == <300
('https keepalive == <300
... | pesaply/sarafu | smpp.py | Python | mit | 447 |
#!/usr/bin/python
inp = raw_input(' Enter Fahrenheit Temperature: ' )
try:
fahr = float(inp)
cel = (fahr - 32.0) * 5.0 / 9.0
print cel
except:
print ' Please enter a number'
| amilovac/python_scripts | temp.py | Python | gpl-2.0 | 190 |
# Copyright (C) 2009 Valmantas Paliksa <walmis at balticum-tv dot lt>
#
# Licensed under the GNU General Public License Version 3
#
# 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... | nmercier/linux-cross-gcc | linux/lib/python2.7/dist-packages/blueman/plugins/MechanismPlugin.py | Python | bsd-3-clause | 1,268 |
from httpx import AsyncClient
# Runtime import to avoid syntax errors in samples on Python < 3.5 and reach top-dir
import os
_TOP_DIR = os.path.abspath(
os.path.sep.join((
os.path.dirname(__file__),
'../',
)),
)
_SAMPLES_DIR = os.path.abspath(
os.path.sep.join((
os.path.dirname(__fi... | rmk135/objects | tests/unit/wiring/test_wiringfastapi_py36.py | Python | bsd-3-clause | 1,426 |
import Image
def main():
im = Image.open('oxygen.png')
width, height = im.size
box = (0, height / 2, width, height / 2 + 1)
region = im.crop(box)
data = region.getdata()
word = []
for d in data:
r, g, b, a = d
word.append(chr(r))
print 'word is'
print ''.join(word)
... | darknight/pythonchallenge | p7/p7.py | Python | mit | 544 |
#!/usr/bin/env python
##
# Copyright (c) 2009-2017 Apple 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 re... | macosforge/ccs-calendarserver | contrib/tools/request_monitor.py | Python | apache-2.0 | 24,343 |
#The MIT License (MIT)
#Copyright (c) 2017 Microsoft Corporation
#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, modi... | Azure/azure-documentdb-python | azure/cosmos/default_retry_policy.py | Python | mit | 3,183 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | dhermes/google-cloud-python | videointelligence/google/cloud/videointelligence_v1p2beta1/gapic/transports/video_intelligence_service_grpc_transport.py | Python | apache-2.0 | 4,848 |
#-------------------------------------------------------------------------------
# codeclone_finder.py
#
#
# Copyright (C) 2015, Ryosuke Fukatani
# License: Apache 2.0
#-------------------------------------------------------------------------------
import sys
import os
from collections import OrderedDict
sys.path.ins... | fukatani/Pyverilog_toolbox | pyverilog_toolbox/verify_tool/codeclone_finder.py | Python | apache-2.0 | 5,385 |
from django.core.management.base import BaseCommand, CommandError
from statisticscore.models import Session
class Command(BaseCommand):
def handle(self, *args, **options):
sessions = Session.objects.all()
for session in sessions:
img_path = str(session.picture)
if img_path.... | eyp-developers/statistics | statisticscore/management/commands/fix_picture_links.py | Python | gpl-3.0 | 541 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.