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 python
# -*- coding: utf-8; py-indent-offset:4 -*-
################################################################################
#
# Copyright (C) 2014 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | mementum/deldosdevices | src/utils/widgets/lctrlsort.py | Python | gpl-3.0 | 3,371 |
from __future__ import unicode_literals
import uuid
from django.db import models
# Create your models here.
class Image(models.Model):
def __str__(self):
return str(self.name)
name=models.CharField(max_length=50)
image=models.ImageField(upload_to='images')
old_size=models.IntegerField(default=0)
new_size=model... | hehaichi/django-imagemanagement | imagemanagement/models.py | Python | mit | 563 |
#!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.com>
#
# 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
ANS... | bregman-arie/ansible | lib/ansible/modules/cloud/azure/azure_rm_publicipaddress.py | Python | gpl-3.0 | 9,512 |
# 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 required by applicable law or ... | andrei4ka/fuel-web-redhat | fuelclient/fuelclient/objects/environment.py | Python | apache-2.0 | 12,308 |
import tree
from asm.Asm import *
from asm.Registers import Registers
from tree.nodes.loops.JumpStatementType import JumpStatementType
from tree.nodes.Node import Node
class JumpStatement(Node):
def __init__(self, jump_statement_type=JumpStatementType.RETURN, parent=None):
self.jump_statement_type = jump_... | wilima/herocomp | herocomp/tree/nodes/loops/JumpStatement.py | Python | mit | 1,729 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils import nowdate
from erpnext.hr.doctype.employee_onboarding.employee_onboarding import make_employee
from erpnext.hr.doct... | saurabh6790/erpnext | erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py | Python | gpl-3.0 | 3,040 |
#!/usr/bin/env python
# Copyright 2015 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | wjiangjay/origin | vendor/k8s.io/kubernetes/cluster/juju/layers/kubernetes-master/reactive/kubernetes_master.py | Python | apache-2.0 | 58,947 |
# =============================================================================
# Authors: PAR Government
# Organization: DARPA
#
# Copyright (c) 2016 PAR Government
# All rights reserved.
#==============================================================================
"""
Support UID discovery using a class that sup... | rwgdrummer/maskgen | maskgen/userinfo.py | Python | bsd-3-clause | 1,029 |
"""A script to divide a table based on column names. """
import pandas as pd
import argparse
import sys
def main(args):
df = pd.read_table(args.input_table, index_col=0)
column_names = []
with open(args.column_names) as cn_fh:
for line in cn_fh.readlines():
column_names.append(lin... | EnvGen/toolbox | scripts/divide_tables.py | Python | mit | 919 |
#!/usr/bin/env python
#
# Copyright 2011-2015 Splunk, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"): you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | splunk/splunk-sdk-python | examples/handlers/handler_debug.py | Python | apache-2.0 | 1,642 |
import sqlite3 as SQL
from logging import getLogger
from os.path import exists, isfile
logger = getLogger("GM.database")
class Database:
def __init__(self, path):
self.path = path
self.checkFileExistence()
self.connect()
def connect(self):
self.connection = SQL.connect(self.path)
self.cursor = self.conn... | Varabe/Guild-Manager | scripts/lib/database.py | Python | mit | 2,512 |
import numpy as np
import pandas
import tensorflow as tf
import random as random
import json
from keras import backend as K
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.layers import Dense, Input, Flatten, Dropout, Lambda, GRU, Activation
from keras... | yehudagale/fuzzyJoiner | old/TripletLossFacenetLSTM-8.29.18.py | Python | epl-1.0 | 21,235 |
"""
Acceptance tests for Studio's Setting pages
"""
import re
import uuid
from nose.plugins.attrib import attr
from common.test.acceptance.pages.lms.create_mode import ModeCreationPage
from common.test.acceptance.pages.studio.settings_advanced import AdvancedSettingsPage
from common.test.acceptance.pages.studio.setti... | proversity-org/edx-platform | common/test/acceptance/tests/studio/test_studio_settings_certificates.py | Python | agpl-3.0 | 13,257 |
#!/usr/bin/env python3
# coding=utf-8
"""
@version:0.1
@author: ysicing
@file: run.py
@time: 2017/2/28 下午11:25
"""
from app import create_app
import ssl
app = create_app()
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
ctx.load_cert_chain("ssl/dev.pem", "ssl/dev.key")
app.run(host='0.0.0.0', port=9090, debug=app.debug, ... | dc-project/blog | run_ssl.py | Python | agpl-3.0 | 356 |
'''
altimu10v5: Main module
Copyright 2017, Svetoslav Kuzmanov
Licensed under MIT.
'''
from lsm6ds33 import LSM6DS33
from lis3mdl import LIS3MDL
from lps25h import LPS25H
class IMU(object):
""" Set up and control Pololu's AltIMU-10v5.
"""
def __init__(self):
super(IMU, self).__init__()
s... | SvetoslavKuzmanov/altimu10v5 | altimu10v5/__init__.py | Python | mit | 2,201 |
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, micronota development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ---------------------------------------------... | tkosciol/micronota | micronota/cli.py | Python | bsd-3-clause | 3,634 |
#!/usr/bin/env python3
print('Content-type: text/html')
print()
ages = {'Julian': 51, 'Tara': 21, 'Clara': 47}
for i in ages:
print('<p>', i, ':', ages[i], '</p>')
| JulianNicholls/Complete-Web-Course-2.0 | 13-Python/challenge1.py | Python | mit | 169 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2022, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | qiime2/qiime2 | qiime2/sdk/tests/test_actiongraph.py | Python | bsd-3-clause | 5,365 |
#!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. 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
# noti... | youtube/cobalt | third_party/v8/tools/js2c.py | Python | bsd-3-clause | 10,812 |
# Authors:
# Petr Vobornik <pvoborni@redhat.com>
#
# Copyright (C) 2013 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ... | hroncok/freeipa | ipatests/test_webui/ui_driver.py | Python | gpl-3.0 | 58,069 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import mock
from searx.engines import wikipedia
from searx.testing import SearxTestCase
class TestWikipediaEngine(SearxTestCase):
def test_request(self):
wikipedia.supported_languages = ['fr', 'en', 'no']
wikipedia.language_aliases = {'n... | jcherqui/searx | tests/unit/engines/test_wikipedia.py | Python | agpl-3.0 | 10,591 |
__author__ = 'n3k'
from Configuration import Configuration
from Logger import Logger
from OpenSSL import crypto
import httplib
import os
import random
import Utils
class CertManager(object):
CA_CERT = None
def __init__(self, ca_certificate_details={}):
self._read_ca_certificate(ca_certificate_detail... | n3k/CertSlayer | CertSlayer/CertManager.py | Python | mit | 10,121 |
# Standard library imports.
import os.path
# Enthought library imports.
from enthought.pyface.api import PythonEditor
from enthought.pyface.tasks.api import TaskPane, TraitsDockPane
from enthought.traits.api import Event, File, Instance, List, Str
from enthought.traits.ui.api import View, Item, FileEditor
class File... | enthought/traitsgui | examples/tasks/example_panes.py | Python | bsd-3-clause | 2,320 |
#!/usr/bin/env python3
# Copyright (C) 2013-2014 Florian Festi
#
# 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 3 of the License, or
# (at your option) any later version.... | florianfesti/boxes | boxes/generators/roundedbox.py | Python | gpl-3.0 | 4,704 |
import rosgraph
import rosnode
QUIET_NAMES = ['/rosout','/tf']
from diarc.base_adapter import *
from ros_topology import *
from diarc.view import BlockItemAttributes
from diarc.view import BandItemAttributes
from diarc.view import SnapItemAttributes
# from diarc.view_attributes import *
class RosAdapter(BaseAdapter)... | osrf/rqt_graphprofiler | src/diarc/ros/ros_adapter.py | Python | apache-2.0 | 5,592 |
class ForceGettingStartedMiddleware(object):
def process_request(self, request):
pass
| jjpsos/buddy-books | accounting/apps/connect/middlewares.py | Python | mit | 99 |
import copy
import datetime
from algorithms.search_algorithm import SearchAlgorithm
from board_elements.tile import Tile
from utils.logger import get_logger
__author__ = 'cenk'
logger = get_logger('uniform_cost')
class UniformCostAlgorithm(SearchAlgorithm):
def __init__(self, board):
super(UniformCostA... | cenkbircanoglu/8_puzzle_problem | algorithms/uniform_cost_algorithm.py | Python | mit | 6,742 |
"""
Imports all testcases found in the 'testcases' subfolder of
folder containg the file parameter.
Doing that is enough to make the testrunner find them.
"""
import glob
import os
import re
import sys
from django.conf import settings
from easymode.utils import first_match, bases_walker, url_add_params
from easymode... | specialunderwear/django-easymode | easymode/tests/__init__.py | Python | gpl-3.0 | 2,458 |
# -*- coding: utf-8 -*-
import os
import glob
import importlib
import mimetypes
from bson import ObjectId
from modularodm import fields
from mako.lookup import TemplateLookup
from time import sleep
import requests
from modularodm import Q
from framework.auth.decorators import must_be_logged_in
from framework.mongo im... | haoyuchen1992/osf.io | website/addons/base/__init__.py | Python | apache-2.0 | 30,151 |
import unittest
import dependency
class TestRequiresProvides(unittest.TestCase):
def test_provides(self):
self.assertNotIn('test-req', dependency.Requirement.instances)
@dependency.provides('test-req')
class TestClass(object):
pass
self.assertIn('test-req', dependenc... | jdowner/requires-provides | tests/test.py | Python | mit | 3,763 |
#!/usr/bin/env python
# This script is intended to be used a a git hook and will prepend the ticket
# number to a commit message in the correct format for Gitlab to parse.
#
# To use, create a shortcut to this file in .git/hooks called
# 'prepare-commit-msg' e.g. from top folder of your project:
# mkdir .git/hooks... | Empiria/matador-cookiecutter | {{cookiecutter.project_name}}/src/utils/prepare-commit-msg.py | Python | mit | 1,268 |
# Author: Jason Lu
import urllib.request
import urllib.parse
url = 'http://www.iqianyue.com/mypost/'
postdata = urllib.parse.urlencode({
"name": "ceo@iqianyue.com",
"pass": "aA123456"
}).encode('utf-8')
req = urllib.request.Request(url, postdata)
req.add_header('User-Agent',
"Mozilla/5.0 (iPhone... | jinzekid/codehub | python/py3_6venv/spider/search_post_request.py | Python | gpl-3.0 | 573 |
#!/usr/bin/env python3
# Copyright 2010-2021 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 ... | google/or-tools | ortools/constraint_solver/samples/vrp_tokens.py | Python | apache-2.0 | 6,133 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-10-03 02:38
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | sbuss/voteswap | users/migrations/0014_signuplog.py | Python | mit | 928 |
from django.contrib import admin
from apps.jsondictbench.models import Board, Thread, Post, ForumUser
admin.site.register(Board)
admin.site.register(Thread)
admin.site.register(Post)
admin.site.register(ForumUser)
| jonmsawyer/jsonbench | apps/jsondictbench/admin.py | Python | mit | 216 |
""" The Simple Config Store implementation """
from boto.dynamodb2.exceptions import ItemNotFound
from dynamodb_config_store.config_stores import ConfigStore
class SimpleConfigStore(ConfigStore):
""" SimpleConfigStore fetching configuration directly from DynamoDB
This config store will always poll for the l... | kyangmove/dynamodb-config-store | dynamodb_config_store/config_stores/simple.py | Python | apache-2.0 | 3,658 |
ARRUMAR
import Pmw
import Tkinter as tk
import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from os import chdir,listdir,path,getcwd
class PlotWindow():
def __init__(self,shot=0,plo... | CassioAmador/profile_tcabr | visualization_tools/plot_prof2.py | Python | mit | 5,175 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | 47lining/ansible-modules-core | database/postgresql/postgresql_privs.py | Python | gpl-3.0 | 23,471 |
import os
import random
from datetime import datetime
from inspect import isclass
import logging
from io import BytesIO
from importlib import import_module
import exifread
import unicodedata
from django.utils.timezone import now
from django.db import models
from django.db.models.signals import post_save
from django.co... | jlemaes/django-photologue | photologue/models.py | Python | bsd-3-clause | 36,586 |
"""
WSGI config for CL_Project project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | pmakahmann/CL_Project | CL_Project/wsgi.py | Python | mit | 397 |
import tensorflow as tf
from networks.network import Network
from fcn.config import cfg
zero_out_module = tf.load_op_library('lib/triplet_flow_loss/triplet_flow_loss.so')
class custom_network(Network):
def __init__(self):
self.inputs = cfg.INPUT
# self.input_format = input_format
self.num... | daweim0/Just-some-image-features | lib/networks/net_labeled_features_deeper.py | Python | mit | 16,354 |
# This file is part of MyPaint.
# Copyright (C) 2012 by Richard Jones
# Copyright (C) 2012-2018 by the MyPaint Development Team.
#
# 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 ... | odysseywestra/mypaint | gui/linemode.py | Python | gpl-2.0 | 33,986 |
import datetime
from typing import Optional
import unittest
from unittest import TestCase
from unittest.mock import MagicMock
import telegram
import queue
from concurrent.futures import ThreadPoolExecutor
from src.test.model_interface_test import User
from src.model_interface import DbConnection
from src.bot import Va... | fmontoto/bot-valevista | src/test/bot_test.py | Python | mit | 23,380 |
from setuptools import setup, find_packages
setup(name='MODEL1006230044',
version=20140916,
description='MODEL1006230044 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL1006230044',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/MODEL1006230044 | setup.py | Python | cc0-1.0 | 377 |
# Copyright (C) 2008-2009 Adam Olsen
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that... | diegonc/client175 | metadata/sid.py | Python | gpl-3.0 | 1,735 |
# Wrapper module for ElementTree
from xml.etree.ElementTree import *
| slozier/ironpython2 | Src/StdLib/Lib/xml/etree/cElementTree.py | Python | apache-2.0 | 70 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-12 21:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portfolio_app', '0003_auto_20160612_2133'),
]
operations = [
migrations.Rena... | muniri92/portfolio-remastered | portfolio/portfolio_app/migrations/0004_auto_20160612_2136.py | Python | mit | 657 |
# PaCal - the probabilistic calculator
# Copyright (C) 2009 Szymon Jaroszewicz, Marcin Korzen
#
# 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 3 of the License, o... | ianmtaylor1/pacal | pacal/utils.py | Python | gpl-3.0 | 22,199 |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... | bmi-forum/bmi-pyre | pythia-0.8/examples/tabulator/tests/simpletab.py | Python | gpl-2.0 | 1,013 |
__author__ = 'alex'
import Image
import ImageDraw
from routines import draw_word
width = 300
height = 100
word = "FUCK"
img = Image.new("RGB", (width, height), "black")
draw = ImageDraw.Draw(img)
draw_word(word, 2, width, height, draw, "white")
img.save("img.png", "PNG") | opeykin/textrot | main.py | Python | gpl-2.0 | 277 |
# pysqlite2/test/userfunctions.py: tests for user-defined functions and
# aggregates.
#
# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the au... | bruderstein/PythonScript | PythonLib/full/sqlite3/test/userfunctions.py | Python | gpl-2.0 | 19,033 |
import math
def find_proper_divisors(n):
if n < 1:
return []
divisors = []
up_to = int(math.sqrt(n)) + 1
for i in xrange(1, up_to, 1):
if n % i == 0:
divisors.append(i)
if i != n/i and i != 1:
divisors.append(n/i)
return divisors
def sum_ints_cannot_be_written_as_sum_of_two_abun... | birdchan/project_euler | problems/023/run.py | Python | mit | 1,087 |
from flask import Flask
import json
import urllib
import requests
app = Flask(__name__)
def zweiterEintrag(paar):
return paar[1]
link = "http://127.0.0.1/dreckwegg/georeport/v2/requests.json"
requestInhalt = "service_code=ZIEL&email=test@example.com&"
headers={'content-type':'application/x-www-form-urlencoded'}
... | Andr01dBuilder/dreckwegg | DreckweggServer/hello.py | Python | gpl-3.0 | 1,215 |
from config import *
class Keyboard:
def __init__(self):
self.keys = None
self.left = pygame.K_LEFT
self.right = pygame.K_RIGHT
self.jump = pygame.K_UP
self.hit_left = pygame.K_a
self.hit_right = pygame.K_d
self.hit_up = pygame.K_w
if GCW_ZERO:
... | cxong/Slappa | keyboard.py | Python | mit | 1,293 |
from simphony.engine import ABCEngineExtension
from simphony.engine import EngineInterface
from simphony.engine.decorators import register
from .lammps_wrapper import LammpsWrapper
from .io.file_utility import read_data_file
__all__ = ["LammpsWrapper", "read_data_file"]
@register
class SimlammpsExtension(ABCEngineE... | simphony/simphony-lammps-md | simlammps/__init__.py | Python | bsd-2-clause | 2,127 |
"""
dj-stripe TransferReversal model tests
"""
from copy import deepcopy
from unittest.mock import PropertyMock, patch
import pytest
from django.test.testcases import TestCase
from djstripe.models import Transfer, TransferReversal
from djstripe.settings import djstripe_settings
from . import (
FAKE_BALANCE_TRANS... | dj-stripe/dj-stripe | tests/test_transfer_reversal.py | Python | mit | 6,171 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
from collections import OrderedDict
import fiona
import json
import os
import pandas as pd
import re
import shapely.geometry
import shapely.ops
import projections.utils as utils
def cname_to_fips(name, df):
def rematch(regexp, name):
if isinstance(rege... | ricardog/raster-project | merge-countries.py | Python | apache-2.0 | 2,339 |
#########################################################################
# #
# Calc2BOOKTAB #
# #
# ... | schober-ch/calc2booktab | calc2booktab.py | Python | gpl-2.0 | 17,491 |
# -*- coding: utf-8 -*-
from datetime import date
from dateutil.relativedelta import relativedelta
from lotus_core.utils import dbutil
def choose():
cursor = dbutil.get_connection().cursor()
trade_date = str(date.today() + relativedelta(days=-1))
stock_codes_on_pe = _choose_on_pe(cursor, trade_date)
... | nicee/xshirmp | lotus-crawler/lotus_core/stock/choice.py | Python | apache-2.0 | 1,912 |
"""
interface to the IaaS service from GYUN.
"""
from gyun.iaas.connection import APIConnection
def connect_to_zone(zone, access_key_id, secret_access_key, lowercase=True):
""" Connect to one of zones in gyun by access key.
"""
if lowercase:
zone = zone.strip().lower()
return APIConnection(ac... | gyun-gome/gyun-sdk-python | gyun/iaas/__init__.py | Python | apache-2.0 | 358 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
this_dir = os.path.abspath(os.path.dirname(__file__))
VERSIONFILE = os.path.join(this_dir, "textx", "__init__.py")
VERSION = None
for line in open(VERSIONFILE, "r").readlines():
if line.startswith('__version__'):
... | igordejanovic/textX | setup.py | Python | mit | 1,005 |
from functools import lru_cache
import regex
from .tokenizer_base import BaseTokenizer
class TokenizerV14International(BaseTokenizer):
"""Tokenizes a string following the official BLEU implementation.
See github.com/moses-smt/mosesdecoder/blob/master/scripts/generic/mteval-v14.pl#L954-L983
In our case... | mjpost/sacreBLEU | sacrebleu/tokenizers/tokenizer_intl.py | Python | apache-2.0 | 1,869 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 DeneroTeam. (<http://www.deneroteam.com>)
# Copyright (C) 2011 Didotech Inc. (<http://www.didotech.com>)
# All Rights Reserved
#
# This program is free software: you can redistribute... | odoousers2014/LibrERP | product_catalog_extend_livelucky/__openerp__.py | Python | agpl-3.0 | 1,739 |
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy import create_engine
from passlib.apps import custom_app_context as pwd_context
Base = declarative_base()
class Item(Base):
__tablename__ = ... | jonanone/APIProject | vagrant/bargain_mart/models.py | Python | mit | 851 |
"""Tests for letsencrypt.cli."""
import itertools
import os
import shutil
import StringIO
import traceback
import tempfile
import unittest
import mock
from letsencrypt import account
from letsencrypt import configuration
from letsencrypt import errors
from letsencrypt.tests import renewer_test
from letsencrypt.tests... | g1franc/lets-encrypt-preview | letsencrypt/tests/cli_test.py | Python | apache-2.0 | 14,660 |
fob[.2] | xNUTs/PTVS | Python/Tests/TestData/Grammar/IndexExpr.py | Python | apache-2.0 | 10 |
class A:
def foo(self):
if (self.is_good):
y = self.xxx
else:
y = "str"
return y
def bar(self):
self.foo().count()
| asedunov/intellij-community | python/testData/completion/returnType.after.py | Python | apache-2.0 | 180 |
#!/usr/bin/python
# -*- coding: cp1252 -*-
#############################################################################
##
## Spirtech (C) 2014
## All rights reserved.
## File: cerbere_import.py
## Description: Cerbere2 import tool
## export a ready to import sql file from two csv file : device.csv
## ... | pickettd/SerialPort-RealTime-Data-Plotter | live_monitor.py | Python | mit | 18,719 |
from office365.entity import Entity
from office365.onedrive.driveitems.publication_facet import PublicationFacet
class BaseItemVersion(Entity):
@property
def last_modified_datetime(self):
"""Gets date and time the item was last modified."""
return self.properties.get('lastModifiedDateTime', ... | vgrem/Office365-REST-Python-Client | office365/onedrive/versions/base_item_version.py | Python | mit | 524 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Project.is_underway'
db.add_column(u'sfpirgapp_project', 'is_underway',
... | orlenko/sfpirg | sfpirgapp/migrations/0029_auto__add_field_project_is_underway__add_field_project_is_finished__ad.py | Python | bsd-2-clause | 24,435 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MMTest.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are y... | ftovar/TCC | Codigo/manage.py | Python | gpl-3.0 | 538 |
"""
WSGI config for {{ cookiecutter.project_name }}.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/stable/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
application = get... | ameistad/django-template | {{cookiecutter.repo_name}}/config/wsgi.py | Python | mit | 340 |
#
# Licensed to Big Data Genomics (BDG) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The BDG licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this fil... | laserson/adam | adam-python/src/bdgenomics/adam/stringency.py | Python | apache-2.0 | 1,549 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para VePelis
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys
from core imp... | CarlosCondor/pelisalacarta-xbmc-plus | pelisalacarta/channels/vepelis.py | Python | gpl-3.0 | 17,944 |
# 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... | yanchen036/tensorflow | tensorflow/python/keras/datasets/reuters.py | Python | apache-2.0 | 4,899 |
# -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | mfelsche/dwd_weather_data | weather/stations.py | Python | apache-2.0 | 2,544 |
import flask_restful
import flask_restx
import hiro
from flask import request
from flask.views import MethodView, View
def test_pluggable_views(extension_factory):
app, limiter = extension_factory(default_limits=["1/hour"])
class Va(View):
methods = ["GET", "POST"]
decorators = [limiter.limit... | alisaifee/flask-limiter | tests/test_views.py | Python | mit | 6,592 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
import smtplib
import socket
import sys
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import formatdate
fr... | oxc/Flexget | flexget/plugins/output/send_email.py | Python | mit | 9,462 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/strace/package.py | Python | lgpl-2.1 | 1,786 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# @name: Wascan - Web Application Scanner
# @repo: https://github.com/m4ll0k/Wascan
# @author: Momo Outaadi (M4ll0k)
# @license: See the file 'LICENSE.txt
from lib.utils.printer import *
from lib.parser.parse import *
def ssn(content):
_list_ = parse(content).ge... | m4ll0k/Spaghetti | plugins/disclosure/ssn.py | Python | gpl-3.0 | 566 |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 22 20:34:22 2015
@author: steph
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.sparse as sp
import scipy.sparse.linalg as sla
import scipy.linalg as la
import time
def poissonOp(L,nx,ny,dx):
"""
Set non-zero entries of L so that
Lu = r... | Chris35Wills/Bristol_Geography_Python | spyder_numpy_scipy/2-sparse-la.py | Python | gpl-2.0 | 3,343 |
# phppo2pypo unit tests
# Author: Wil Clouser <wclouser@mozilla.com>
# Date: 2009-12-03
from io import BytesIO
from translate.convert import test_convert
from translate.tools import phppo2pypo
class TestPhpPo2PyPo:
def test_single_po(self):
inputfile = b"""
# This user comment refers to: %1$s
#. This de... | miurahr/translate | translate/tools/test_phppo2pypo.py | Python | gpl-2.0 | 1,682 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
import sys, modules.killo, modules.vulnerability, modules.scanVuln, modules.killo_mongo, urllib2, time, ssl
from urllib2 import HTTPError
import argparse, requests, mechanize, cookielib
from bs4 import BeautifulSoup
reload(sys)
sys.setdefaultencoding('utf8')
brow = mechan... | Quantika14/killoio-console-security-search-engine | modules/fuzzer_proces.py | Python | gpl-3.0 | 7,650 |
from tkinter import filedialog
helvetica_widths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
278, 278,355, 556, 556, 889, 667, 222, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556,
556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 102... | COMSYS/PowerGraph | gui/src/plugins/export_image/pdf_codec.py | Python | gpl-3.0 | 9,791 |
__author__ = 'laixintao'
import os
import time
def shoot(quality=100,width=1000,height=1000):
print "now time:",
pic_name = str(time.time())+".jpeg"
print pic_name[:-5]
print "shoot picture..."
os.system("raspistill -o /tmp/"
+str(pic_name)
+" -q "+str(quality)
... | laixintao/RaspberryPI.python | alarm/shoot.py | Python | mit | 500 |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 12 10:50:15 2016
@author: msdogan
"""
# This code optimizes pump-storage hydropower facility operations.
# Mustafa Dogan
### 02/22/2017
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
from scipy.optimize import differe... | msdogan/HydropowerProject | Pumped_Storage/Pumped_Storage.py | Python | mit | 12,823 |
# Copyright 2019 Sergio Teruel <sergio.teruel@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class StockPickingType(models.Model):
_inherit = "stock.picking.type"
no_move_proposal = fields.Boolean(
string="Do Not Propose Moves (Move... | OCA/stock-logistics-barcode | stock_barcodes_move_location/models/stock_picking_type.py | Python | agpl-3.0 | 417 |
from netmiko.brocade.brocade_nos_ssh import BrocadeNosSSH
from netmiko.brocade.brocade_fastiron_ssh import BrocadeFastironSSH
from netmiko.brocade.brocade_netiron_ssh import BrocadeNetironSSH
__all__ = ['BrocadeNosSSH', 'BrocadeFastironSSH', 'BrocadeNetironSSH']
| mith1979/pynet_course | netmiko/netmiko/brocade/__init__.py | Python | apache-2.0 | 264 |
from django.apps import AppConfig
class VodConfig(AppConfig):
name = 'vodmanagement'
verbose_name = '视频点播'
| xahhy/Django-vod | vodmanagement/apps.py | Python | lgpl-3.0 | 125 |
import datetime
import exifread
import logging
import xmltodict as x2d
from six import string_types
from opensfm.sensors import sensor_data
from opensfm import types
logger = logging.getLogger(__name__)
def eval_frac(value):
try:
return float(value.num) / float(value.den)
except ZeroDivisionError:... | BrookRoberts/OpenSfM | opensfm/exif.py | Python | bsd-2-clause | 12,843 |
#!/usr/bin/env python
###
# Copyright (c) 2013, Jim Richardson <weaselkeeper@gmail.com>
# 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... | weaselkeeper/infoquery | src/infoquery.py | Python | gpl-2.0 | 7,798 |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impo... | mindbody/API-Examples | SDKs/Python/test/test_get_locations_request.py | Python | bsd-2-clause | 980 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import random
import string
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User
from django.contrib.sites.models import Site
from django.test import RequestFactory, TransactionTestCase
from django.utils.translatio... | Venturi/cms | env/lib/python2.7/site-packages/tests/__init__.py | Python | gpl-2.0 | 6,858 |
import report_webkit
import report_amortization_gkwh
import report_contract_apo
import report_retencions_gkwh
| Som-Energia/somenergia-generationkwh | som_generationkwh/report/__init__.py | Python | agpl-3.0 | 110 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PySphinxcontribIssuetracker(PythonPackage):
"""Sphinx integration with different issuetrac... | iulian787/spack | var/spack/repos/builtin/packages/py-sphinxcontrib-issuetracker/package.py | Python | lgpl-2.1 | 773 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from solution import Solution
buildings = [[2, 9, 10], [3, 7, 15], [5, 12, 12], [15, 20, 10], [19, 24, 8]]
sol = Solution()
res = sol.getSkyline(buildings)
print(res)
| zhlinh/leetcode | 0218.The Skyline Problem/test.py | Python | apache-2.0 | 215 |
# 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 os
import uni... | sameerparekh/pants | tests/python/pants_test/base/test_address.py | Python | apache-2.0 | 5,166 |
class Solution(object):
def generatePossibleNextMoves(self, s):
"""
:type s: str
:rtype: List[str]
"""
res = []
s = list(s)
for i in range(len(s) - 1):
if s[i] == s[i + 1] == '+':
s[i] = s[i + 1] = '-'
res.append(''.... | rx2130/Leetcode | python/293 Flip Game.py | Python | apache-2.0 | 634 |
##########################################################################
#
# Copyright (c) 2015, 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:
#
# * Redistrib... | chippey/gaffer | python/GafferUITest/ReferenceUITest.py | Python | bsd-3-clause | 2,667 |
fin = open('test.txt')
print(fin.readline())
for line in fin:
print(line)
fin.close()
####
fin = open('test.txt')
fout = open('testw.txt', 'w')
for line in fin:
print(line)
fout.write(line)
fin.close()
fout.close()
####
| yehnan/python_book_yehnan | ch07/ch07_test.py | Python | gpl-2.0 | 258 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.