code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
from pycp2k.inputsection import InputSection
class _xalpha1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Xa = None
self.Scale_x = None
self._name = "XALPHA"
self._keywords = {'Xa': 'XA', 'Scale_x': 'SCALE_X'}
... | SINGROUP/pycp2k | pycp2k/classes/_xalpha1.py | Python | lgpl-3.0 | 368 |
"""
Project Euler - Problem 233
Circle passing through (0,0),(N,0),(0,N),(N,N)
this is a square - so the diameter of the circle
is N*Sqrt(2), and its centre is (N/2,N/2)
Circle equation is
(X-Xc)^2+(Y-Yc)^2=N^2/2 or
(x-N/2)^2 + (y-N/2)^2 = N^2/2
for a given N, the x domain Dx is
lower bound N/2 - N*sqrt(2)/... | haphaeu/yoshimi | EulerProject/233_clever.py | Python | lgpl-3.0 | 2,521 |
"""
The :mod:`pynusmv.utils` module contains some secondary functions and classes
used by PyNuSMV internals.
"""
__all__ = ['PointerWrapper', 'fixpoint', 'update', 'StdioFile','writeonly',
'indexed']
from pynusmv_lower_interface.nusmv.utils import utils
from pynusmv.init import _register_wrapper
class ... | LouvainVerificationLab/pynusmv | pynusmv/utils.py | Python | lgpl-3.0 | 22,573 |
# IfcBlender - Blender IFC Importer
# Copyright (C) 2019 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcBlender.
#
# IfcBlender 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 v... | IfcOpenShell/IfcOpenShell | src/ifcblender/io_import_scene_ifc/__init__.py | Python | lgpl-3.0 | 13,611 |
#
# Copyright (C) University College London, 2007-2012, all rights reserved.
#
# This file is part of HemeLB and is provided to you under the terms of
# the GNU LGPL. Please see LICENSE in the top level directory for full
# details.
#
import numpy as np
import xdrlib
import warnings
from .. import HemeLbMagicNumbe... | jenshnielsen/hemelb | Tools/hemeTools/parsers/snapshot/__init__.py | Python | lgpl-3.0 | 11,074 |
# -*- coding: utf-8 -*-
"""
Created on Sun May 14 22:13:58 2017
"""
#python3
"""
>>> exc_coro = demo_exc_handling()
>>> next(exc_coro)
-> coroutine started
>>> exc_coro.send(11)
-> coroutine received: 11
>>> exc_coro.send(22)
-> coroutine received: 22
>>> exc_coro.close()
>>> from inspect import getgeneratorstate
>... | wuqize/FluentPython | chapter16/coro_exc_demo.py | Python | lgpl-3.0 | 1,499 |
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell 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 Foundat... | IfcOpenShell/IfcOpenShell | src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load_case.py | Python | lgpl-3.0 | 1,177 |
#!/usr/bin/env python
import random
import copy
import math
def GenCorelationMatrix(letters):
''' Assume all letters are same length
The main diagon filled with zeros'''
oneLetterLen = len(letters[0][0])
matrix = [[0 for x in xrange(oneLetterLen)] for x in xrange(oneLetterLen)]
for col1 in ra... | PrashntS/shadow-fort | projects/Hopfield Neural Network/second.py | Python | unlicense | 3,939 |
def flatten(x):
"""
Takes an N times nested list of list like [[a,b],[c, [d, e]],[f]]
and returns a single list [a,b,c,d,e,f]
"""
result = []
for el in x:
if hasattr(el, "__iter__") and not isinstance(el, str):
result.extend(flatten(el))
else:
result.appen... | ai-se/Transfer-Learning | src/utils/misc_utils.py | Python | unlicense | 344 |
# %matplotlib inline
# All the imports
from __future__ import print_function, division
from math import *
import random
import sys
import matplotlib.pyplot as plt
# TODO 1: Enter your unity ID here
__author__ = "pwang13"
class O:
"""
Basic Class which
- Helps dynamic updates
- Pretty Prints
... | gbtimmon/ase16GBT | code/4/ga/pwang13.py | Python | unlicense | 8,789 |
"""
Test de la doc turinsoft:
http://api-doc.tourinsoft.com/#/questionnaire-web
prospose quelques fonctions de wrapping
"""
import requests
URL = 'http://wcf.tourinsoft.com/QuestionnaireWeb/QuestionnaireWebService.svc/{}/{}/{}'
AUTH = ('cdt72', '969e24f9-75a2-4cc6-a46c-db1f6ebbfe97')
def access(service, clie... | Aluriak/24hducode2016 | pocs/test_doc_turinsoft.py | Python | unlicense | 529 |
import bananaglee
import tools
import shelve
import fw_logging
import os
import sys
import cmd
import subprocess
import shlex
import ConfigParser
import logging
class Tunnel(cmd.Cmd):
def __init__(self,sfile,logger):
cmd.Cmd.__init__(self)
self.prompt = 'Tunnel>>'
#shelve file
self.sfile = sfile
#set u... | DarthMaulware/EquationGroupLeaks | Leak #1 - Equation Group Cyber Weapons Auction - Invitation/EQGRP-Free-File/Firewall/SCRIPTS/fw_wrapper/tunnel.py | Python | unlicense | 32,118 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: saxutils.py
"""A library of useful helper classes to the SAX classes, for the
convenience of application and driver writers.
"""
import os
import url... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/xml/sax/saxutils.py | Python | unlicense | 9,225 |
"""
This signature containts test to see if the site is running on ExpressionEngine.
"""
__author__ = "Seth Gottlieb"
__copyright__ = "CM Fieldguide"
__credits__ = ["Seth Gottlieb",]
__license__ = "Unlicense"
__version__ = "0.1"
__maintainer__ = "Seth Gottlieb"
__email__ = "sgottlieb@alumni.duke.edu"
__status__ = "Expe... | sggottlieb/cmfieldguide | cmfieldguide/cmsdetector/signatures/expressionengine.py | Python | unlicense | 1,264 |
import ftplib
def connect(host, user, password):
try:
ftp = ftplib.FTP(host)
ftp.login(user, password)
ftp.quit()
return True
except:
return False
def main():
# Variables
targetHostAddress = '10.0.0.24'
userName = 'bwayne'
passwordsFilePath = 'passwords.... | barbieauglend/Learning_python | PT/FIPBruteForce.py | Python | unlicense | 1,369 |
from __future__ import unicode_literals
from django.db import models
class Person(models.Model):
""" Person model """
gender_choices = (
('male', 'Male'),
('female', 'Female')
)
firstName = models.CharField(max_length=50, blank=True, null=True)
surname = models.CharField(max_lengt... | mirzadelic/django-social-example | django_social_example/person/models.py | Python | unlicense | 1,534 |
class baseUI:
def __init__(self, serv):
self.serv = serv
def setup(self, out):
self.out = out
class HTML(baseUI):
def show(self, what):
self.out.send_header('Content-Type', 'text/plain; charset=utf-8')
print 'test'
class Java(baseUI):
def show(self, what):
print 'test'
| dk00/old-stuff | csie/10computer-networks/hdi-cnl/ui.py | Python | unlicense | 299 |
# -*- 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
#... | Fokko/incubator-airflow | tests/gcp/hooks/test_text_to_speech.py | Python | apache-2.0 | 2,693 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Aloomaio/googleads-python-lib | examples/adwords/v201806/account_management/get_account_hierarchy.py | Python | apache-2.0 | 3,452 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 Rackspace
# 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/licen... | rackerlabs/Tempo | tempo/api.py | Python | apache-2.0 | 5,443 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2017 Twitter. 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... | lucperkins/heron | heron/tools/tracker/src/python/handlers/metadatahandler.py | Python | apache-2.0 | 2,280 |
#! /usr/bin/env python
'''
Say Hello World1! from a temporary AppVM
'''
from pyqubes.vm import TemplateVM
# Create a pyqubes TemplateVM representing the existing QubesOS TemplateVM
vm_vanilla = TemplateVM('fedora-23')
# Create a new temporary AppVM
example_app = vm_vanilla.create_app('example-app-pyqu-ex-2')
# Start ... | tommilligan/pyqubes | examples/pyqu_ex_2_hello_world.py | Python | apache-2.0 | 473 |
from .main import main
# run the program
if __name__ == '__main__':
main() | william-fiset/Survival | __init__.py | Python | apache-2.0 | 79 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/sahara-dashboard | sahara_dashboard/test/integration_tests/tests/test_sahara_image_registry.py | Python | apache-2.0 | 2,572 |
# 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 ... | nebril/fuel-web | nailgun/nailgun/test/unit/test_attributes_plugin.py | Python | apache-2.0 | 10,481 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/python/mxnet/module/module.py | Python | apache-2.0 | 37,421 |
# 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... | bravomikekilo/mxconsole | mxconsole/backend/event_processing/event_accumulator.py | Python | apache-2.0 | 31,429 |
# Copyright (c) 2014. Mount Sinai School of Medicine
#
# 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 o... | dmnfarrell/epitopemap | modules/pepdata/pmbec.py | Python | apache-2.0 | 2,894 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2012 zod.yslin
#
# 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 ... | yslin/tools-zodlin | ubuntu/vim/script/debug/python/python_mandelbrot.py | Python | apache-2.0 | 1,868 |
# 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 agre... | openstack/manila | manila/tests/network/linux/test_ovs_lib.py | Python | apache-2.0 | 2,893 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import OrderedDict
import gym
from ray.rllib.models.misc import linear, normc_initializer
from ray.rllib.models.preprocessors import get_preprocessor
from ray.rllib.utils.annotations import P... | atumanov/ray | python/ray/rllib/models/model.py | Python | apache-2.0 | 10,512 |
#!/usr/bin/python
import subprocess
import os
import json
import pytest
from volmgr import VolumeManager
TEST_ROOT = "/tmp/volmgr_test/"
CFG_ROOT = os.path.join(TEST_ROOT, "volmgr")
BLOCKSTORE_ROOT = os.path.join(TEST_ROOT, "rancher-blockstore")
BLOCKSTORE_CFG = os.path.join(BLOCKSTORE_ROOT, "blockstore.cfg")
BLOCK... | ibuildthecloud/volmgr | tests/integration/test_main.py | Python | apache-2.0 | 12,292 |
# Copyright 2018 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... | kevin-coder/tensorflow-fork | tensorflow/python/tpu/tensor_tracer.py | Python | apache-2.0 | 67,356 |
# coding=utf-8
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | google-research/football | gfootball/env/gym_test.py | Python | apache-2.0 | 1,391 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | dhuang/incubator-airflow | tests/operators/test_subdag_operator.py | Python | apache-2.0 | 12,984 |
class ArrayStack:
def __init__(self):
self._data = []
self.max = 0
def __len__(self):
return len(self._data)
def is_empty(self):
return len(self._data) == 0
def get_max(self):
return self.max
def push(self, e):
self._data.append(e)
if self.max < e:
self.max = e
def pop(self):
if self.i... | MithileshCParab/HackerRank-10DaysOfStatistics | Problem Solving/Data Structure/Stacks/maximum_element.py | Python | apache-2.0 | 1,142 |
#!/usr/bin/env python
__author__ = 'alex'
import pymongo
import pickle
print "Scanning classifications db..."
# connect to the mongo server
client = pymongo.MongoClient()
db = client['serengeti3']
classification_collection = db["serengeti_classifications"]
print "Collection contains %s documents." % db.command("colls... | zooniverse/serengeti-analysis-scripts | validate-classifications-by-date-full-iteration.py | Python | apache-2.0 | 851 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-29 16:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailimages.blocks
... | willysbrewing/willys_website | willys_website/core/migrations/0002_auto_20170129_1714.py | Python | apache-2.0 | 7,007 |
class User(object):
def __init__(self, username=None, password=None, email=None):
self.username = username
self.password = password
self.email = email
@classmethod
def Admin(cls):
return cls(username="admin", password="admin") | x0mak/test---project---python---Kurbatova | php4dvd/model/user.py | Python | apache-2.0 | 272 |
import tester
import unittest
from mock import Mock, patch, MagicMock
class WorkerTestCase(unittest.TestCase):
@patch('tester.requests')
def test_post_error(self, requests):
tester.post()
self.assertTrue(requests.post.called)
@patch('tester.requests')
def test_get_error(self, request... | TooAngel/sensorviewer | tests/tester_tests.py | Python | apache-2.0 | 588 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/stat/pq/pq_stats.py | Python | apache-2.0 | 5,276 |
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2012 Isaku Yamahata <yamahata at valinux co jp>
#
# 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://... | torufuru/oolhackathon | ryu/ofproto/ofproto_v1_2_parser.py | Python | apache-2.0 | 159,337 |
# import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:\Users\Ewan\Desktop\SFTPDST5\MapFiles"
try:
# Set the local variable
in_Table = "Trees.csv"
x_coords = "X"
y_coords = "Y"
z_coords = "Z"
out_Layer = "Trees_Layer"
saved_La... | harryfb/DST5 | ArcPy Code/Trees.py | Python | apache-2.0 | 760 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | iwm911/plaso | plaso/parsers/winreg_plugins/mountpoints_test.py | Python | apache-2.0 | 2,420 |
#
# Copyright 2011 Twitter, 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 agreed to in writing, s... | twitter/pycascading | examples/word_count.py | Python | apache-2.0 | 1,485 |
# Copyright 2013 IBM Corp.
# 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 app... | luzheqi1987/nova-annotation | nova/tests/unit/api/openstack/compute/contrib/test_extended_virtual_interfaces_net.py | Python | apache-2.0 | 4,516 |
import yaml
import time
import random
import threading
import subprocess
from rackattack.physical import pikapatch
from rackattack import clientfactory
from rackattack.physical import config
from rackattack.api import Requirement, AllocationInfo
from rackattack.physical.tests.integration.main import useFakeGeneralConfi... | eliran-stratoscale/rackattack-physical | rackattack/physical/tests/integration/main_faketestclients.py | Python | apache-2.0 | 8,351 |
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.shortcuts import redirect
from django.utils.translation import gettext as _
from zerver.decorator import require_realm_admin
from zerver.lib.actions import do_change_icon_source
from zerver.lib.exceptions import JsonableErro... | eeshangarg/zulip | zerver/views/realm_icon.py | Python | apache-2.0 | 2,456 |
import codecs
from codecs_to_hex import to_hex
# Pick the nonnative version of UTF-16 encoding
if codecs.BOM_UTF16 == codecs.BOM_UTF16_BE:
bom = codecs.BOM_UTF16_LE
encoding = 'utf_16_le'
else:
bom = codecs.BOM_UTF16_BE
encoding = 'utf_16_be'
print('Native order :', to_hex(codecs.BOM_UTF16, 2))
print... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_file_system/codecs_bom_create_file.py | Python | apache-2.0 | 796 |
#!/usr/bin/env python
#
# Copyright 2015 Airbus
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
#
# 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
#
# ... | ipa-led/airbus_coop | airbus_cobot_gui/src/airbus_cobot_gui/util/exception.py | Python | apache-2.0 | 1,914 |
#!/usr/bin/env python
import numpy as np
import vtk
def main():
named_colors = vtk.vtkNamedColors()
# Make a 32 x 32 grid.
size = 32
# Define z values for the topography.
# Comment out the following line if you want a different random
# distribution each time the script is run.
np.rand... | lorensen/VTKExamples | src/Python/DataManipulation/LineOnMesh.py | Python | apache-2.0 | 5,546 |
# imports - compatibility imports
from __future__ import absolute_import
# imports - standard imports
import os
# imports - module imports
from spockpy.app.config import BaseConfig
class ServerConfig(BaseConfig):
class Path(BaseConfig.Path):
ABSPATH_TEMPLATES = os.path.join(BaseConfig.Path.ABSPATH_VIEWS, 'templat... | achillesrasquinha/spockpy | spockpy/app/config/server.py | Python | apache-2.0 | 381 |
#!/usr/bin/python
import json
import os
import sys
if not os.access("data.json", os.F_OK):
print("Please run aggregate.py first")
sys.exit(1)
data = json.load(open("data.json", "r"))
print("Results for 1 connection")
print("{:<20s} {:>8s} | {:>7s} | {:>5s} | {:>5s} | {:>5s} | {:>5s}".format("name",
... | bigfootproject/OSMEF | data_processing/overview.py | Python | apache-2.0 | 3,112 |
"""Discover Openhome devices."""
from . import SSDPDiscoverable
# pylint: disable=too-few-public-methods
class Discoverable(SSDPDiscoverable):
"""Add support for discovering Openhome compliant devices."""
def info_from_entry(self, entry):
"""Return the most important info from a uPnP entry."""
... | brburns/netdisco | netdisco/discoverables/openhome.py | Python | apache-2.0 | 583 |
# Copyright 2012 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | tylertian/Openstack | openstack F/glance/glance/api/v2/image_tags.py | Python | apache-2.0 | 1,791 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-compute | google/cloud/compute_v1/services/region_notification_endpoints/pagers.py | Python | apache-2.0 | 3,203 |
# flake8: noqa I201
from .Child import Child
from .Node import Node
DECL_NODES = [
# type-assignment -> '=' type
Node('TypeInitializerClause', kind='Syntax',
children=[
Child('Equal', kind='EqualToken'),
Child('Value', kind='Type'),
]),
# typealias-declaration ... | jmgc/swift | utils/gyb_syntax_support/DeclNodes.py | Python | apache-2.0 | 37,155 |
import unicodedata
try:
import sentencepiece as spm
except ImportError:
spm = None
#from ..config import ConfigError
#from ..utils import contains_all
SPIECE_UNDERLINE = '\N{LOWER ONE EIGHTH BLOCK}'
SEG_ID_A = 0
SEG_ID_B = 1
SEG_ID_CLS = 2
SEG_ID_SEP = 3
SEG_ID_PAD = 4
special_symbols = {
"<unk>": 0,
... | mlperf/inference_results_v0.7 | closed/Intel/code/resnet/resnet-ov/py-bindings/_nlp_common.py | Python | apache-2.0 | 10,322 |
import collections
import json
import re
from dcos import util
from dcos.errors import DCOSException
logger = util.get_logger(__name__)
def parse_json_item(json_item, schema):
"""Parse the json item based on a schema.
:param json_item: A JSON item in the form 'key=value'
:type json_item: str
:param... | genome21/dcos-cli | dcos/jsonitem.py | Python | apache-2.0 | 7,404 |
# -*- 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
#... | Fokko/incubator-airflow | airflow/task/task_runner/__init__.py | Python | apache-2.0 | 1,828 |
'''
Graphing
Author: Rylan Santinon
'''
import pygal
from csv_io import CsvIo
from urlparse import urlparse
import os
class Graphing(object):
'''Graphs and diagrams based on retrieved data'''
def __init__(self, directory):
self.directory = directory
self.csvio = CsvIo()
self.make_direc... | davande/hackernews-top | graphing.py | Python | apache-2.0 | 2,759 |
import os
import random
import re
import thread
import threading
import traceback
import time
import mailpile.util
from mailpile.eventlog import Event
from mailpile.i18n import gettext as _
from mailpile.i18n import ngettext as _n
from mailpile.mailboxes import *
from mailpile.mailutils import FormatMbxId
from mailpil... | laborautonomo/Mailpile | mailpile/mail_source/__init__.py | Python | apache-2.0 | 32,212 |
"""Thin wrapper around the microdata library."""
from __future__ import absolute_import
import microdata
class Item(microdata.Item):
"""Add an "extra" field to microdata Items, so people won't feel the need
to make up ad-hoc properties.
Also add __eq__() and __repr__().
"""
def __init__(self, *a... | davidmarin/pbg | python/pbg/common/microdata.py | Python | apache-2.0 | 1,121 |
import os.path
import shutil
from datetime import datetime
from uuid import UUID
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%f"
def get_directory_size(path):
total_size = 0
for dirpath, dirnames, filenames in os.walk(path):
for f in filenames:
fp = os.path.join(dirpath, f)
total_s... | dropbox/changes-lxc-wrapper | changes_lxc_wrapper/snapshot_cache.py | Python | apache-2.0 | 3,494 |
__author__ = 'Christof Pieloth'
import logging
from packbacker.errors import ParameterError
from packbacker.installers import installer_prototypes
from packbacker.utils import UtilsUI
class Job(object):
log = logging.getLogger(__name__)
def __init__(self):
self._installers = []
def add_instal... | cpieloth/CppMath | tools/PackBacker/packbacker/job.py | Python | apache-2.0 | 2,389 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | cascaded_networks/models/densenet.py | Python | apache-2.0 | 6,633 |
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
def test(request):
return render(request, "test.html", {"data": "unknown!"})
def index(request):
if request.user.is_authenticated():
return redirect(reverse("my-stories"))
return render(request, "main/index.html", {})
... | luterien/madcyoa | main/views.py | Python | apache-2.0 | 321 |
# -------------------------------------------------------------------------------
# Copyright IBM Corp. 2017
#
# 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/licens... | ibm-cds-labs/pixiedust | pixiedust/display/chart/renderers/bokeh/__init__.py | Python | apache-2.0 | 888 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | dhuang/incubator-airflow | airflow/migrations/versions/852ae6c715af_add_rendered_task_instance_fields_table.py | Python | apache-2.0 | 2,123 |
# Copyright (c) 2011 X.commerce, a business unit of eBay 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 req... | rahulunair/nova | nova/api/openstack/compute/floating_ip_pools.py | Python | apache-2.0 | 1,765 |
from django.conf.urls import patterns, url
from library import views
from django.views.generic.base import TemplateView
urlpatterns = patterns('',
# author urls
url(r'^authors/create/', views.AuthorCreateView.as_view(), name='author_add'),
url(r'^authors/search/$', views.author_search, name='author_search... | XerxesDGreat/library-app | library/urls.py | Python | apache-2.0 | 2,235 |
from __future__ import absolute_import
import sys
import copy
import codecs
from . import TypeSlots
from .ExprNodes import not_a_constant
import cython
cython.declare(UtilityCode=object, EncodedString=object, bytes_literal=object,
Nodes=object, ExprNodes=object, PyrexTypes=object, Builtin=object,
... | hhsprings/cython | Cython/Compiler/Optimize.py | Python | apache-2.0 | 186,187 |
# Copyright 2016 Hewlett Packard Enterprise Development Company, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | bigswitch/neutron | neutron/tests/unit/services/trunk/test_db.py | Python | apache-2.0 | 1,965 |
# Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P.
#
# 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
#
# ... | openstack/neutron-lib | neutron_lib/api/definitions/segment.py | Python | apache-2.0 | 4,049 |
"""URLs."""
from django.conf.urls import include, url
from django.contrib import admin
import apps.status.views
admin.autodiscover()
# Examples:
# url(r'^$', 'gettingstarted.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
urlpatterns = [
url(r'^$', apps.status.views.index, name='index'),
... | ifnull/hello-tracking | project/urls.py | Python | apache-2.0 | 482 |
from __future__ import division
from dask.array import from_array
from numpy.random import RandomState
from numpy.testing import assert_allclose, assert_equal
from limix.qc import compute_maf, indep_pairwise
def test_qc_indep_pairwise():
random = RandomState(0)
X = random.randn(3, 100)
head = [True, T... | Horta/limix | limix/qc/test/test_qc.py | Python | apache-2.0 | 922 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | google/cloud/aiplatform_v1beta1/types/tensorboard_service.py | Python | apache-2.0 | 42,035 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xe/ydk/models/cisco_ios_xe/_meta/_Cisco_IOS_XE_eem.py | Python | apache-2.0 | 858 |
import time
import http.server
import os
HOST_NAME = '0.0.0.0' # Host name of the http server
# Gets the port number from $PORT0 environment variable
PORT_NUMBER = int(os.environ['PORT0'])
class MyHandler(http.server.BaseHTTPRequestHandler):
def do_GET(s):
"""Respond to a GET request."""
s.send_r... | dbtucker/universe | docs/tutorial/helloworld.py | Python | apache-2.0 | 1,005 |
import typing
from typing import Any, Callable, List, Optional, Sequence
import jax
import jax.nn as jnn
import jax.random as jrandom
from ..custom_types import Array
from ..module import Module, static_field
from .linear import Linear
def _identity(x):
return x
if getattr(typing, "GENERATING_DOCUMENTATION", ... | patrick-kidger/equinox | equinox/nn/composed.py | Python | apache-2.0 | 3,841 |
# coding=utf-8
# Copyright 2017 Foursquare Labs Inc. All Rights Reserved.
from __future__ import absolute_import, division, print_function
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.goal.task_registrar import TaskRegistrar as task
from fsqio.pants.buildgen.core.buildgen import Build... | foursquare/fsqio | src/python/fsqio/pants/buildgen/core/register.py | Python | apache-2.0 | 1,606 |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# 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... | huggingface/transformers | utils/check_repo.py | Python | apache-2.0 | 30,085 |
from __future__ import print_function
import argparse, re
import numpy as np
from pyspark import SparkSession
from pyspark.sql import Row
from pyspark.sql.functions import col, datediff, lit, sum as gsum
from pyspark.ml.feature import CountVectorizer, VectorAssembler
def pairFeatures(sseries, dseries, sday, dday):
... | ViralTexts/vt-passim | scripts/place-cascade.py | Python | apache-2.0 | 6,658 |
# Generated by Django 2.2.1 on 2019-05-24 05:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ebooks', '0036_section_super_title'),
]
operations = [
migrations.AlterField(
model_name='book',
name='color',
... | flavoi/diventi | diventi/ebooks/migrations/0037_auto_20190524_0738.py | Python | apache-2.0 | 4,683 |
# Copyright 2021 The Kubeflow 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 applicable law or agreed to in... | kubeflow/pipelines | samples/core/resource_spec/resource_spec_test.py | Python | apache-2.0 | 1,529 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os
from typing import Iterable, Mapping
from packaging.utils import canonicalize_name as canonicalize_project_name
from pants.backend.python.ma... | pantsbuild/pants | src/python/pants/backend/python/macros/poetry_requirements_caof.py | Python | apache-2.0 | 3,874 |
__source__ = 'https://leetcode.com/problems/walls-and-gates/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/walls-and-gates.py
# Time: O(m * n)
# Space: O(g)
#
# Description: Leetcode # 286. Walls and Gates
#
# You are given a m x n 2D grid initialized with these three possible values.
#
# -1 -... | JulyKikuAkita/PythonPrac | cs15211/WallsandGates.py | Python | apache-2.0 | 8,470 |
'''
author@esilgard April 2016
"sweep" through output directory files
searching for potential PHI and print out warning statements
'''
import os, re
# general directory for output files
file_dir = 'H:\DataExtracts\OncoscapeLungHoughton-4229\Output'
## common names or potential phi (assume first line is a ... | esilgard/caisis_query_and_de_identify | sweeper.py | Python | apache-2.0 | 2,097 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
im... | mbohlool/client-python | kubernetes/client/apis/custom_objects_api.py | Python | apache-2.0 | 69,951 |
#!/usr/bin/env python
# Written against python 3.3.1
# Matasano Problem 1
# Convert hex to base64
# Example hex: 49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d
# Example base64: SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t
import base64
impo... | reschly/cryptopals | prob1.py | Python | apache-2.0 | 3,439 |
"""Collection of benchmarks and downstream tasks on embeddings
.. autosummary::
:toctree: _autosummary
analogy
"""
| undertherain/vsmlib | vsmlib/benchmarks/__init__.py | Python | apache-2.0 | 126 |
import logging
import logging.config
# TODO: add rotate file log
DEFAULT_CONFIG = {
'version': 1,
'formatters': {
'standard': {
'format': '[%(levelname)s] %(asctime)s %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S'
}
},
'handlers': {
'console': {
... | invinst/ResponseBot | responsebot/utils/log_utils.py | Python | apache-2.0 | 626 |
# 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... | ZhangXinNan/tensorflow | tensorflow/python/kernel_tests/control_flow_ops_py_test.py | Python | apache-2.0 | 121,396 |
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Find files on the client."""
import stat
from grr.client.client_actions import searching as searching_actions
from grr.lib import aff4
from grr.lib import flow
from grr.lib.aff4_objects import aff4_grr
from grr.lib.aff4_objects import standard
... | destijl/grr | grr/lib/flows/general/find.py | Python | apache-2.0 | 4,185 |
# Copyright 2016 IBM Corp
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | Tesora-Release/tesora-trove | trove/guestagent/strategies/restore/db2_impl.py | Python | apache-2.0 | 2,104 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | iemejia/incubator-beam | sdks/python/apache_beam/runners/portability/fn_api_runner/execution.py | Python | apache-2.0 | 27,238 |
__author__ = 'cmantas'
#python ssh lib
import paramiko
import string
import sys
from socket import error as socketError
sys.path.append('lib/scp.py')
from lib.scp import SCPClient
from datetime import datetime, timedelta
from lib.persistance_module import env_vars, home
from time import time
import sys, traceback
ssh... | cmantas/tiramola_v3 | lib/scp_utils.py | Python | apache-2.0 | 3,752 |
from sqlalchemy import Column, Integer, String, DateTime, Numeric
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class AssessmentReconstruction(Base):
"""
Definition of AssessmentReconstruction object. It will be used by SQLAlchemy's ORM to map the object to
the system_a... | VHAINNOVATIONS/GE-Pressure-Ulcer | python_gui_decision_support_webportal/python/webapp/mmpspupc/models/assessment_reconstruction.py | Python | apache-2.0 | 2,000 |
# @see http://www.idayer.com/sentences-similarity.html
# kindled by https://github.com/ineo6/chinese-segmentation
import sys
import math
from pinyin.pinyin import Pinyin
import biligrab.Functions
from importlib import reload
reload(sys)
class Evaluator:
d = {}
@staticmethod
def log(x):
if not x:... | billlai95/bilimining | biligrab/SentenceSimilarityEvaluation.py | Python | apache-2.0 | 2,527 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | nathanbjenx/cairis | cairis/gui/RolesDialog.py | Python | apache-2.0 | 2,882 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.