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 |
|---|---|---|---|---|---|
__author__ = 'deevarvar'
"""
some idea from baidu's interview
1. this file is used to generate the some file template
three column
column1 column2 column3
chars chars(or empty) digits
try to use shell or python to finish
"""
import random
import string
def gen_seperator():
va... | deevarvar/myLab | interview/gen_file.py | Python | mit | 1,140 |
import io
import panflute as pf
def test_all():
md = 'Some *markdown* **text** ~xyz~'
c_md = pf.convert_text(md)
b_md = [pf.Para(pf.Str("Some"), pf.Space,
pf.Emph(pf.Str("markdown")), pf.Space,
pf.Strong(pf.Str("text")), pf.Space,
pf.Subscript(pf.... | sergiocorreia/panflute | tests/test_convert_text.py | Python | bsd-3-clause | 4,653 |
# Copyright (C) 2011 One Laptop Per Child
#
# 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 distribu... | gusDuarte/sugar | src/jarabe/model/speech.py | Python | gpl-2.0 | 7,214 |
# 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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_operations.py | Python | mit | 5,445 |
# Enthought library imports
from traits.api import HasTraits, Int, Bool
from kiva.trait_defs.api import KivaFont
from enable.colors import ColorTrait
class TextFieldStyle(HasTraits):
""" This class holds style settings for rendering an EnableTextField.
fixme: See docstring on EnableBoxStyle
"""
#... | tommy-u/enable | enable/text_field_style.py | Python | bsd-3-clause | 1,133 |
from django.db import models
class YankUser(models.Model):
username = models.CharField(max_length=98, unique=True)
password_digest = models.CharField(max_length=128)
api_key = models.CharField(max_length=128, null=True)
| yank-team/yank-server | auth/models.py | Python | apache-2.0 | 248 |
"""round all kerning values to increments of a specified value"""
value = 100
from robofab.world import CurrentFont
font = CurrentFont()
kerning = font.kerning
startCount = len(kerning)
kerning.round(value)
font.update()
print('finished rounding kerning by %s.'%value)
print('you started with %s kerning pairs.'%star... | adrientetar/robofab | Scripts/RoboFabIntro/demo_RoundKerning.py | Python | bsd-3-clause | 381 |
# -*- coding: utf-8 -*-
import sys
import arff
def main(filename):
data = arff.load(open(filename, 'rb'))
name = filename.strip().split('.')[0]
header = ','.join(str(x[0]) for x in data['attributes'])
with open(name+'.csv','w') as output:
output.write(header+'\n')
for dados in data['data']:
line = ... | RecipeML/Recipe | utils/partitionpy/to_csv.py | Python | gpl-3.0 | 488 |
#!/usr/bin/env python
from setuptools import setup
import re
import platform
import os
import sys
install_requires = ["bottle>=0.11",
"requests>=1.1.0",
"pyyaml>=0.0",
"czipfile>=1.0.0",
"prometheus-client"]
def load_version(filename='.... | provoke-vagueness/reststore | setup.py | Python | mit | 2,099 |
from ._base import CreatureBase
from typing import *
import json
from ..dice import AttackRoll
class CreatureLevel(CreatureBase):
def set_level(self, level: int, hp:Optional[int]=None, **other):
"""
Alter the level of the creature.
:param level: opt. int, the level. if absent it will set it... | matteoferla/DnD-battler | DnD_battler/creature/_level.py | Python | mit | 2,590 |
#!/usr/bin/python
#------------------------------------------------------------------------------
#
# This file is a part of autils.
#
# Copyright 2011-2016 Andrew Lamoureux
#
# autils is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... | lwerdna/alib | py/logic/SatTools.py | Python | gpl-3.0 | 8,230 |
__all__ = ["gui_credits", "gui_game", "gui_start"]
| JanikNex/adventure16 | src/gui/__init__.py | Python | gpl-3.0 | 51 |
#!/usr/bin/env python
"""Client utilities common to all platforms."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import hashlib
import logging
import os
import platform
import subprocess
import threading
import time
from future.utils import itervalue... | demonchild2112/travis-test | grr/client/grr_response_client/client_utils_common.py | Python | apache-2.0 | 8,855 |
from __future__ import absolute_import, print_function, division
from matplotlib.font_manager import FontProperties
from . import wcs_util
from .decorators import auto_refresh, fixdocstring
class AxisLabels(object):
def __init__(self, parent):
# Store references to axes
self._ax1 = parent._ax1... | allisony/aplpy | aplpy/axis_labels.py | Python | mit | 7,036 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django_services import service
from ..models import Instance
class InstanceService(service.CRUDService):
model_class = Instance
| globocom/database-as-a-service | dbaas/physical/service/instance.py | Python | bsd-3-clause | 220 |
import traceback
from Tkinter import *
from PIL import ImageTk, Image
from functools import partial
import numpy as np
__author__ = 'mhuijser'
class VerticalScrolledFrame(Frame):
"""A pure Tkinter scrollable frame that actually works!
* Use the 'interior' attribute to place widgets inside the scrollable fram... | MiriamHu/ActiveBoundary | interface.py | Python | mit | 15,908 |
#!/usr/bin/env python
# pdf.py - Convert simple PDF screenshots to PPM in pure Python
# Copyright (C) 2007 Johann C. Rocholl <johann@browsershots.org>
#
# 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... | mintuhouse/shotfactory | shotfactory04/image/pdf.py | Python | gpl-3.0 | 4,277 |
''''
Copyright (c) 2013-2017, Joshua Pitts
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and ... | secretsquirrel/the-backdoor-factory | intel/WinIntelPE64.py | Python | bsd-3-clause | 151,691 |
from ReversingLabsRansomwareAndRelatedToolsFeed import create_indicator_object, confidence_to_score, \
return_validated_params
RL_INDICATOR = {
"indicatorValue": "197.232.50.85",
"indicatorType": "ipv4",
"daysValid": 30,
"confidence": 100,
"rating": 4.0,
"indicatorTags": {
"lifecyc... | demisto/content | Packs/FeedReversingLabsRansomwareAndRelatedToolsApp/Integrations/ReversingLabsRansomwareAndRelatedToolsFeed/ReversingLabsRansomwareAndRelatedToolsFeed_test.py | Python | mit | 2,332 |
'''
Created on Sep 10, 2015
@author: step
'''
F = 1
N - 0
for N in Range (0,20):
print(n,"!=",f)
N += 1
F = F*N
main(): | Mwiltshi11/StepMaster | TestDrivenDevelopment/src/ttd/FirstPython/HelloWorld/array.py | Python | gpl-2.0 | 155 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2017 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your op... | pculture/unisubs | apps/videos/management/commands/encode_urls.py | Python | agpl-3.0 | 1,920 |
#!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import subprocess
import sys
ANDROID_SRC_ROOT = 'flutter/shell/platform/android'
def main():
parser = ... | jamesr/sky_engine | tools/gen_javadoc.py | Python | bsd-3-clause | 2,672 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, an open source suite of business apps
# This module copyright (C) 2014-2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the t... | amoya-dx/account-financial-tools | account_reset_chart/__openerp__.py | Python | agpl-3.0 | 1,329 |
#!/usr/bin/env python
## Copyright (C) 2005-2006 Graham I Cummins
## 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.
##... | gic888/MIEN | parsers/bbt.py | Python | gpl-2.0 | 6,775 |
import os
import requests
from datetime import datetime
import threading
import queue
import time
import json
class DataAuther:
def __init__(self, username, password, base_url):
self.login_url = base_url + '/backend/api-token-auth/'
self.username = username
self.password = password
... | mik4el/gadget-ekensberg-flight-radar | poster/post_data.py | Python | apache-2.0 | 3,887 |
from __future__ import absolute_import
import js2py
import logging
import base64
from . import JavaScriptInterpreter
from .jsunfuck import jsunfuck
class ChallengeInterpreter(JavaScriptInterpreter):
def __init__(self):
super(ChallengeInterpreter, self).__init__('js2py')
def eval(s... | alfa-jor/addon | plugin.video.alfa/lib/cloudscraper/interpreters/js2py.py | Python | gpl-3.0 | 914 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-11-06 09:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cbv', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | refreshoxford/django-cbv-inspector | cbv/migrations/0002_auto_20161106_0952.py | Python | bsd-2-clause | 620 |
# example/models.py
import datetime as dt
from flask_sqlalchemy import SQLAlchemy
from . import app
db = SQLAlchemy(app)
class Author(db.Model):
__tablename__ = "example_authors"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Text, nullable=False)
created_at = db.Column(
... | 4Catalyzer/flask-resty | example/models.py | Python | mit | 842 |
import math
import random
import numpy as np
import IMP
import IMP.misc
import IMP.test
def _get_beta(N, b):
return 3. / (2. * N * b**2)
def _get_score(z, N, b):
beta = _get_beta(N, b)
return beta * z**2 + .5 * math.log(math.pi / (16. * beta**3 * z**4))
def _get_derv(z, N, b):
beta = _get_beta(N,... | shanot/imp | modules/misc/test/test_freely_jointed_chain.py | Python | gpl-3.0 | 3,462 |
import copy
import itertools
import operator
from functools import total_ordering, wraps
# You can't trivially replace this with `functools.partial` because this binds
# to classes and returns bound instances, whereas functools.partial (on
# CPython) is a type and its instances don't bind.
def curry(_curried_func, *a... | reinout/django | django/utils/functional.py | Python | bsd-3-clause | 13,308 |
# This file is part of Gem.
#
# Gem 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.
#
# Gem is distributed in the hope that it wi... | kaye64/gem | content/gem/__init__.py | Python | gpl-3.0 | 668 |
from __future__ import absolute_import
import logging
import os
import re
import shutil
import sys
import tempfile
import traceback
import warnings
import zipfile
from distutils import sysconfig
from distutils.util import change_root
from email.parser import FeedParser
from pip._vendor import pkg_resources, six
from... | zwChan/VATEC | ~/eb-virt/Lib/site-packages/pip/req/req_install.py | Python | apache-2.0 | 45,583 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme import test_requirements
from cfme.automate.explorer.domain import DomainCollection
from cfme.automate.import_export import AutomateGitRepository
from utils import error
from utils.appliance.implementations.ui import navigate_to
from utils.update impo... | dajohnso/cfme_tests | cfme/tests/automate/test_domain.py | Python | gpl-2.0 | 6,038 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Views tests for the OSF.'''
from __future__ import absolute_import
import unittest
import json
import datetime as dt
import mock
import httplib as http
from nose.tools import * # noqa PEP8 asserts
from tests.test_features import requires_search
from modularodm import... | barbour-em/osf.io | tests/test_views.py | Python | apache-2.0 | 162,417 |
def isWordPalindrome(word):
return word == word[::-1]
| emirot/codefights | python/isWordPalindrome.py | Python | apache-2.0 | 58 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
#
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
import... | bendykst/deluge | deluge/ui/gtkui/options_tab.py | Python | gpl-3.0 | 13,253 |
# mh5.py -- Molcas HDF5 format
#
# molpy, an orbital analyzer and file converter for Molcas files
# Copyright (c) 2016 Steven Vancoillie
#
# 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... | steabert/molpy | molpy/mh5.py | Python | gpl-2.0 | 9,109 |
from __future__ import absolute_import
from __future__ import print_function
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import AutoEncoder, Dense, Activation, TimeDistributedDense, Flatten
from keras.layers.recurrent import LSTM
from keras.layers.embeddings import Embedd... | zhangxujinsh/keras | tests/manual/check_autoencoder.py | Python | mit | 5,433 |
import sys
from libsbml import *
import re
from shutil import copyfile
# A function that does a simple check on any SBML files
##(gets called by main)
##Arguments:
##input_files - list of the SBML files used
def SBML_checker(input_files):
#Counter for number of errors
tot_errors=0
#Reads each SBML file in a for l... | MichaelPHStumpf/Peitho | peitho/errors_and_parsers/error_checks/SBML_check.py | Python | mit | 735 |
from django.db import models
from django.contrib.auth.models import User, Group
from django.conf import settings
from django.contrib.sites.models import Site
from django.template.defaultfilters import slugify
from django.db.models.signals import post_save
from django.template.defaultfilters import truncatewords
from dj... | agiliq/Dinette | dinette/models.py | Python | bsd-3-clause | 13,928 |
class Node:
def __init__(self, value, tail):
self.Tail = tail
self.Value = value
self.IsEmpty = False
class Empty:
def __init__(self):
self.IsEmpty = True
Empty = Empty() | mindecheng/Project-1-2 | Game/Game/Node.py | Python | apache-2.0 | 203 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # Django settings for OMERO.web project. # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
#
# Copyright (c) 2008-2014 University of ... | tp81/openmicroscopy | components/tools/OmeroWeb/omeroweb/settings.py | Python | gpl-2.0 | 40,900 |
# -*- coding: utf-8 -*-
# Copyright 2016 Rooms For (Hong Kong) Limited T/A OSCG
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Website CRM Notification',
'category': 'Website',
'version': '9.0.1.1.0',
'author': 'Rooms For (Hong Kong) Limited T/A OSCG',
'website': 'ht... | rfhk/oqs | website_crm_notify/__openerp__.py | Python | agpl-3.0 | 688 |
''' RockSampleMDPClass.py: Contains the RockSample class. '''
# Python imports.
import random
import math
import copy
# Other imports
from simple_rl.mdp.MDPClass import MDP
from simple_rl.tasks.grid_world.GridWorldMDPClass import GridWorldMDP
from simple_rl.mdp.StateClass import State
class RockSampleMDP(GridWorldMD... | david-abel/simple_rl | simple_rl/tasks/dev_rock_sample/RockSampleMDPClass.py | Python | apache-2.0 | 3,901 |
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
import numpy as np
from dolfin import tic, toc
import HiptmairSetup
import PETScIO as IO
import scipy.sparse as sp
import matplotlib.pylab as plt
import MatrixOperations as MO
import HiptmairSetup
class BaseMyPC(object):
def setup(self, ... | wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/TH1/MHDprec.py | Python | mit | 12,225 |
"""Google Safe Browsing API client."""
import json
import re
import requests
API_URL = 'https://www.google.com/transparencyreport/api/v3/safebrowsing/status'
def get_report(domain):
"""Returns a Google Safe Browsing API report.
Hits the same endpoint as:
https://transparencyreport.google.com/safe-... | thisismyrobot/dnstwister | dnstwister/api/checks/safebrowsing.py | Python | unlicense | 953 |
import salt.utils.pkg
from salt.utils.pkg import rpm
from tests.support.mock import ANY, MagicMock, patch
from tests.support.unit import TestCase
class PkgUtilsTestCase(TestCase):
"""
TestCase for salt.utils.pkg module
"""
test_parameters = [
("16.0.0.49153-0+f1", "", "16.0.0.49153-0+f1"),
... | saltstack/salt | tests/unit/utils/test_pkg.py | Python | apache-2.0 | 4,338 |
from unittest import TestCase
from mock import Mock
from pyVmomi import vim
from cloudshell.cp.vcenter.commands.disconnect_dvswitch import VirtualSwitchToMachineDisconnectCommand
from cloudshell.cp.vcenter.models.VMwarevCenterResourceModel import VMwarevCenterResourceModel
from cloudshell.cp.vcenter.network.vnic.vnic_s... | QualiSystems/vCenterShell | package/cloudshell/tests/test_commands/test_disconnect_vm.py | Python | apache-2.0 | 7,750 |
# -*- coding: utf-8 -*-
"""Make email lowercase-unique
Revision ID: 3b17b62bf8e4
Revises: 07f975f81f03
Create Date: 2017-08-07 17:33:34.077452
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3b17b62bf8e4'
down_revision = '07f975f81f03'
branch_labels = None
depe... | hasgeek/lastuser | migrations/versions/3b17b62bf8e4_make_email_lowercase_unique.py | Python | bsd-2-clause | 761 |
# 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... | AndreasMadsen/tensorflow | tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py | Python | apache-2.0 | 55,622 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) Copyright [2016] Hewlett Packard Enterprise Development LP 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 Unless required by applicable
# ... | ThreatCentral/blackberries | src/ThreatCentral/transforms/IncidentFromThreatCentral.py | Python | apache-2.0 | 3,812 |
N = int(input())
rain = [0] * (24 * 60 + 2)
for _ in range(N):
S, E = input().split('-')
S, E = int(S[:2])*60 + int(S[2:]), int(E[:2])*60 + int(E[2:])
while S % 5 != 0:
S -= 1
while E % 5 != 0:
E += 1
rain[S] += 1
rain[E+1] -= 1
for i in range(24*60+1):
rain[i+1] += rain[i]
... | knuu/competitive-programming | atcoder/abc/abc001_d.py | Python | mit | 596 |
#
# Copyright (c) 2005 Canonical
# Copyright (c) 2004 Conectiva, Inc.
#
# Written by Gustavo Niemeyer <niemeyer@conectiva.com>
#
# This file is part of Smart Package Manager.
#
# Smart Package Manager is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as publi... | pierrejean-coudert/winlibre_pm | package_manager/smart/media.py | Python | gpl-2.0 | 12,238 |
#!/usr/bin/env python
#
# Copyright 2015-2021 Flavio Garcia
#
# 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... | piraz/firenado | tests/util/sqlalchemy_util_test.py | Python | apache-2.0 | 3,289 |
from django.db import models
from django.urls import reverse
class Character(models.Model):
"""
Model representing a DnD player character.
"""
name = models.CharField(max_length=100, help_text="Enter a character name (fx. Legolas Greenleaf")
level = models.IntegerField()
frags = models.Integer... | MariusLauge/dnd_tracker | frag_tracker/models.py | Python | gpl-3.0 | 1,332 |
from rest_framework import serializers
from elixir.models import *
from elixir.validators import *
class OperatingSystemSerializer(serializers.ModelSerializer):
name = serializers.CharField(allow_blank=False, validators=[IsStringTypeValidator], required=False)
class Meta:
model = OperatingSystem
fields = ('name... | bio-tools/biotoolsregistry | backend/elixir/serialization/resource_serialization/operatingSystem.py | Python | gpl-3.0 | 726 |
"""
PEP 0484 ( https://www.python.org/dev/peps/pep-0484/ ) describes type hints
through function annotations. There is a strong suggestion in this document
that only the type of type hinting defined in PEP0484 should be allowed
as annotations in future python versions.
The (initial / probably incomplete) implementatio... | tequa/ammisoft | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/site-packages/jedi/evaluate/pep0484.py | Python | bsd-3-clause | 7,796 |
from conans.client.generators.virtualenv import VirtualEnvGenerator
from conans.client.build.autotools_environment import AutoToolsBuildEnvironment
from conans.client.build.visual_environment import VisualStudioBuildEnvironment
from conans.tools import vcvars_dict
class VirtualBuildEnvGenerator(VirtualEnvGenerator):
... | birsoyo/conan | conans/client/generators/virtualbuildenv.py | Python | mit | 1,047 |
"""
Test script for scheduled_tasks/reset_tasks
"""
import logging
logger = logging.getLogger('scheduled_tasks_reset_tasks_test')
import os
import sys
import shutil
import tempfile
import unittest
from functools import partial
from unittest.mock import patch, MagicMock
from tornado.testing import Asyn... | WIPACrepo/iceprod | tests/server/scheduled_tasks/reset_tasks_test.py | Python | mit | 3,867 |
#!/usr/bin/env python
'''
ZCR Shellcoder
ZeroDay Cyber Research
Z3r0D4y.Com
Ali Razmjoo
'''
import random,binascii,string
chars = string.digits + string.ascii_letters
def start(shellcode,job):
if 'chmod(' in job:
t = True
eax = str('0x0f')
while t:
eax_1 = binascii.b2a_hex(''.join(random.choice(chars) for i... | firebitsbr/ZCR-Shellcoder | lib/encoder/linux_x86/xor_random.py | Python | gpl-3.0 | 2,327 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['MovingMedian'] , ['NoCycle'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_MovingMedian_NoCycle_LSTM.py | Python | bsd-3-clause | 149 |
# -*- coding: utf-8 -*-
# TODO: move tests one out of src to project root.
# TODO: travis has numpy on their workers. Maybe add tests?
"""Helpers for testing."""
import ctypes
import sys
import sysconfig
import clr
# Add path for Python.Test & Add References
sys.path.append('C:/testdir/')
clr.AddReference("Python.T... | denfromufa/pythonnet | src/tests/conftest.py | Python | mit | 907 |
# Copyright (c) 2011, Willow Garage, Inc.
# Copyright (c) 2012, Intermodalics, BVBA
# 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... | sorki/rosdep | test/test_rosdep_gem.py | Python | bsd-3-clause | 4,171 |
# Before running this:
# - add pyMSpec,pyIMS and pySpatialMetabolomics to the sys.path
# - grab the example data from metabolights
# * http://www.ebi.ac.uk/metabolights/MTBLS317
# * http://www.ebi.ac.uk/metabolights/MTBLS313
# - edit the .json config file
#!!! These are mandatory edits for every dataset
### "file... | alexandrovteam/pySM | pySM/example/run_example.py | Python | apache-2.0 | 2,615 |
__kupfer_name__ = _("Volumes and Disks")
__kupfer_sources__ = ("VolumesSource", )
__description__ = _("Mounted volumes and disks")
__version__ = ""
__author__ = "Ulrik Sverdrup <ulrik.sverdrup@gmail.com>"
import gio
from kupfer.objects import Leaf, Action, Source
from kupfer.obj.fileactions import Open
from kupfer.ob... | cjparsons74/Kupfer-cjparsons74 | kupfer/plugin/volumes.py | Python | gpl-3.0 | 2,219 |
# -*- coding: utf-8 -*-
from ..utils.hashable import CompHashable
from ..utils.copyable import Copyable
from ..math.utils import weightedsum
from . import xrayspectrum
from ..utils import instance
from ..patch.pint import ureg
import numpy as np
def refractive_index_factor(energy, density):
"""Factor in g/mol"""... | woutdenolf/spectrocrunch | spectrocrunch/materials/elementbase.py | Python | mit | 5,112 |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the ... | Micronaet/micronaet-purchase | purchase_history_price/__openerp__.py | Python | agpl-3.0 | 1,523 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11a1 on 2017-02-09 11:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('trans', '0071_auto_20170124_1345'),
]
operations = [
migrations.AddField(
... | lem9/weblate | weblate/trans/migrations/0072_auto_20170209_1234.py | Python | gpl-3.0 | 2,590 |
class SQLHelper:
# 自动执行
def __init__(self,a1,a2,a3):
print("自动执行")
self.hhost = a1
self.uusername = a2
self.pwd = a3
# self 是一个形式参数,是自动会给传值的参数
def fetch(self,sql):
print(self.hhost)
print(self.uusername)
print(self.pwd)
print(sql)
# ... | jcchoiling/learningPython | s13/Day07/practice/ex_obj-oriented_v3.py | Python | gpl-3.0 | 1,259 |
# -*- coding: utf-8 -*-
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatTag(BaseWeChatAPI):
"""
标签管理
https://work.weixin.qq.com/api/doc#90000/90135/90209
"""
def create(self, name):
return self._post(
'tag/create',
data={
'tagname'... | messense/wechatpy | wechatpy/work/client/api/tag.py | Python | mit | 1,397 |
#!/usr/bin/python
#Filename: user_query_strings.py
#Author: Bryce Drew
#Date: Sept. 30, 2015
#Functionality:
#These are sparql queries. They are designed to be specific for the user ontology:
from sparql.endpoint import Endpoint
def add_literal_by_email(email, predicate, literal):
update = """
PREFIX emai... | kevinkle/semantic | superphy/src/upload/python/sparql/user.py | Python | apache-2.0 | 2,243 |
#!/usr/bin/env python3
"""
Python power handling module
Copyright GPL v2: 2011-2021 By Dr Colin Kong
"""
import functools
import glob
import os
import re
import subprocess
from typing import List, Optional
RELEASE = '2.2.6'
VERSION = 20211116
class Battery:
"""
Battery base class
"""
def __init__(... | drtuxwang/system-config | bin/power_mod.py | Python | gpl-2.0 | 13,975 |
# -*- coding: utf-8 -*-
#
# 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
#... | danielvdende/incubator-airflow | airflow/api/client/api_client.py | Python | apache-2.0 | 2,067 |
import scipy
import pyfits
import numpy
import sys
df = './Data/flatter.fits'
flat = pyfits.getdata(df)
#actuator = int(sys.argv[1])
for i in range(4):
flat[0][i] -= 0.01
for actuator in range(60):
flat[0][actuator] += 0.3
pyfits.writeto("Output/poked+"+str(actuator)+".fits", flat, clobber=True)
fl... | soylentdeen/BlurryApple | Tools/poker.py | Python | gpl-2.0 | 506 |
# -*- coding: utf-8 -*-
#
# sahem documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a d... | D3vSt0rm/sahem | docs/conf.py | Python | mit | 7,782 |
{
"name" : "Proseal Custom Partner",
"version" : "1.0",
"depends" : ["base","account"],
"author" : "Togar Hutabarat",
"description" : """
This module is aim to add some new fields on fields on Partner form:
* Customer Number
* Supplier Number
* Customer Outstanding Bal... | togarhutabarat/proseal_v80 | proseal_custom_partner/__openerp__.py | Python | agpl-3.0 | 733 |
# -*- 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):
# You are running PostgresSQL right
db.execute("""
CREATE INDEX main_event_transcript_fts_idx
... | Nolski/airmozilla | airmozilla/main/migrations/0039_main_transcript_fulltext_index.py | Python | bsd-3-clause | 25,162 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: task.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflecti... | AlgorithmLover/OJCodes | qlcoder/serialization/protobuf/task_pb2.py | Python | mit | 7,082 |
# This is a component of LinuxCNC
# Copyright 2014 Andy Pugh <andy@bodgesoc.org>, Chris Radek
# <chris@timeguy.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... | terkaa/linuxcnc | configs/sim/axis/lathe-fanucy/remap.py | Python | gpl-2.0 | 1,355 |
from django.db.models import Aggregate, Value, IntegerField
class BooleanCount(Aggregate):
"""
Works just like :class:`django.db.models.Count`, except that the
aggregated value is cooerced to bool instead of int.
"""
function = 'COUNT'
name = 'DevilryBooleanCount'
template = '%(function)s(... | devilry/devilry-django | devilry/utils/devilry_djangoaggregate_functions.py | Python | bsd-3-clause | 1,047 |
"""
# Copyright (C) 2013-2015 Stray <stray411@hotmail.com>
#
# This library 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 2.1 of the License, or (at your option) any later version.
#
... | ClaudioGranatiero/ClyphX_CG | ClyphX/ActionList.py | Python | gpl-2.0 | 1,226 |
import logging
import serial
import re
import sys
import asyncio
import artiq.protocols.pyon as pyon
logger = logging.getLogger(__name__)
class PiezoController:
"""Driver for Thorlabs MDT693B 3 channel open-loop piezo controller."""
def __init__(self, serial_addr):
self.port = serial.Serial(
... | cjbe/artiqDrivers | artiqDrivers/devices/thorlabs_mdt69xb/driver.py | Python | gpl-3.0 | 10,655 |
# -*- coding: utf-8 -*-
"""
Created on Wed May 17 12:35:28 2017
@author: ning
"""
import numpy as np
import pandas as pd
import os
from collections import Counter
from time import time
os.chdir('D:\\NING - spindle\\Spindle_by_Graphical_Features')
channelList = ['F3','F4','C3','C4','O1','O2','F5',
'F1',... | adowaconan/Spindle_by_Graphical_Features | Generate_Features_with_more_channels.py | Python | mit | 6,406 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Ver 16 - 23 March 2017 -
import time
import string
import sys
import mysql.connector
from mysql.connector import errorcode
from db import *
import datetime
def output(o, x):
print(str(str(o) + " " + str(datetime.datetime.now().time())[:8]) + " "+ str(x))
sys.stdout.flush... | theflorianmaas/dh | Python/dhproc/setHistoryDataStatistic.py | Python | mit | 2,313 |
#!/usr/bin/env python
from tools.multiclass_shared import prepare_data
# run with toy data
[traindat, label_traindat, testdat, label_testdat] = prepare_data()
parameter_list = [[traindat,testdat,label_traindat,label_testdat,2.1,1,1e-5],[traindat,testdat,label_traindat,label_testdat,2.2,1,1e-5]]
def classifier_multicl... | curiousguy13/shogun | examples/undocumented/python_modular/classifier_multiclass_ecoc_ovr.py | Python | gpl-3.0 | 2,154 |
from core.himesis import Himesis, HimesisPostConditionPattern
import cPickle as pickle
from uuid import UUID
class HReconnectMatchElementsRHS(HimesisPostConditionPattern):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HReconnectMatchElementsRHS.
"""
... | levilucio/SyVOLT | GM2AUTOSAR_MM/merge_inter_layer_rules/Himesis/HReconnectMatchElementsRHS.py | Python | mit | 6,605 |
import logging
class StateModelParser(object):
"""
State model helper
"""
def get_method_for_transition(self, model, from_state, to_state):
"""
Get the callback for a state get_method_for_transition
Args:
model: The instance of StateModel subclass with the callbac... | kanakb/pyhelix | pyhelix/statemodel.py | Python | apache-2.0 | 2,970 |
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para tumejortv
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
from core import logge... | CarlosCondor/pelisalacarta-xbmc-plus | pelisalacarta/channels/tumejortv.py | Python | gpl-3.0 | 20,384 |
from fastapi.testclient import TestClient
from docs_src.custom_request_and_route.tutorial003 import app
client = TestClient(app)
def test_get():
response = client.get("/")
assert response.json() == {"message": "Not timed"}
assert "X-Response-Time" not in response.headers
def test_get_timed():
resp... | tiangolo/fastapi | tests/test_tutorial/test_custom_request_and_route/test_tutorial003.py | Python | mit | 526 |
from typing import Any, Dict
from django.template import Node, Library, TemplateSyntaxError
from django.conf import settings
from django.contrib.staticfiles.storage import staticfiles_storage
if False:
# no need to add dependency
from django.template.base import Parser, Token
register = Library()
class Mini... | amanharitsh123/zulip | zerver/templatetags/minified_js.py | Python | apache-2.0 | 1,943 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2016 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | crisely09/horton | horton/meanfield/occ.py | Python | gpl-3.0 | 8,958 |
import sys
from http.server import SimpleHTTPRequestHandler
from http.server import HTTPServer
def test(HandlerClass=SimpleHTTPRequestHandler,
ServerClass=HTTPServer):
protocol = "HTTP/1.0"
host = ''
port = 8000
if len(sys.argv) > 1:
arg = sys.argv[1]
if ':' in arg:
... | esafirm/dotfiles | python/server.py | Python | mit | 801 |
import json
import logging
import os
import sys
import uuid
from pika import spec
from tornado import concurrent, locks, testing, web
from sprockets.mixins import amqp
from tests import base
LOGGER = logging.getLogger(__name__)
def setUpModule():
try:
with open('build/test-environment') as f:
... | sprockets/sprockets.mixins.amqp | tests/integration_tests.py | Python | bsd-3-clause | 6,073 |
#==========================================================================
#
# Copyright Insight Software Consortium
#
# 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... | biotrump/ITK | Wrapping/Generators/Python/Tests/GradientMagnitudeRecursiveGaussianImageFilter.py | Python | apache-2.0 | 1,495 |
"""
Experiment for XGBoost + CF
Aim: To find the best tc(max_depth), mb(min_child_weight), mf(colsample_bytree * 93), ntree
tc: [13, 15, 17]
mb: [5, 7, 9]
mf: [40, 45, 50, 55, 60]
ntree: [160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360]
Averaging 20 models
Summary
Best
loss ... | tks0123456789/kaggle-Otto | exp_XGB_CF_tc_mb_mf_ntree.py | Python | mit | 6,574 |
#! /usr/bin/env python
"""
Setup file for ADDEM
Created: Wed Mar 16, 2016 02:41PM
Last modified: Tue May 03, 2016 02:52PM
"""
import os
from distutils.core import setup, Extension
import numpy as np
import addem
# Utility function to read the README file.
# Source: http://pythonhosted.org/an_example_pypi_project/... | bedartha/addem | setup.py | Python | gpl-3.0 | 1,727 |
"""
parser.http.bsoupxpath module (imdb.parser.http package).
This module provides XPath support for BeautifulSoup.
Copyright 2008 H. Turgut Uyar <uyar@tekir.org>
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 Softwar... | terbolous/SickRage | lib/imdb/parser/http/bsouplxml/bsoupxpath.py | Python | gpl-3.0 | 14,525 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages # noqa
rel_file = lambda *args: os.path.join(
os.path.dirname(
os... | PolicyStat/shutdown-if-idle | setup.py | Python | mit | 1,579 |
import ConfigParser
import os
from utils.colors import bcolors
class client_conf:
c = { 'server_address' : "24.189.208.220",
'server_port' : "8082",
'centinel_homedir' : os.path.dirname(__file__),
'experiment_data_dir' : os.path.join(os.path.dirname(__file__), "experiment_data"),
'experiments... | Tikitaco/centinel-iclab | centinel/client_config.py | Python | mit | 1,589 |
'''
Simulator Test for affinity group antiHard policy.
@author: Chao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.affinitygroup_operations as ag_ops
import zstackwoodpecke... | zstackorg/zstack-woodpecker | integrationtest/vm/simulator/affinitygroup/test_shared_concurrent_antihard_policy1.py | Python | apache-2.0 | 1,610 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.