text
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
231
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
score
float64
0
0.34
from .formSubmission import FormSubmission from django.contrib.auth.models import User from django.db import models from django.template.defaultfilters import slugify class Log(models.Model): """ Form Submission Log Database Model Attributes: * owner - user submitting the message * submission - ...
ConstellationApps/Forms
constellation_forms/models/log.py
Python
isc
1,879
0
"""Utilities for working with data structures. Version Added: 2.1 """ from __future__ import unicode_literals from collections import OrderedDict from django_evolution.compat import six def filter_dup_list_items(items): """Return list items with duplicates filtered out. The order of items will be pre...
beanbaginc/django-evolution
django_evolution/utils/datastructures.py
Python
bsd-3-clause
2,717
0
# -*- coding: utf-8 -*- ''' Copyright (c) 2015 Heidelberg University Library Distributed under the GNU GPL v3. For full terms see the file LICENSE.md ''' from ompannouncements import Announcements def index(): a = Announcements(myconf, db, locale) news_list = a.create_announcement_list() return locals()
UB-Heidelberg/UBHD-OMPArthistorikum
controllers/home.py
Python
gpl-3.0
318
0.006289
import os from functools import reduce, lru_cache import logging import re import subprocess from randrctl import DISPLAY, XAUTHORITY from randrctl.exception import XrandrException, ParseException from randrctl.model import Profile, Viewport, XrandrConnection, Display logger = logging.getLogger(__name__) class Xra...
edio/randrctl
randrctl/xrandr.py
Python
gpl-3.0
10,440
0.002969
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import * import json import bson.json_util as bju import emission.core.get_database as...
sunil07t/e-mission-server
bin/debug/load_timeline_for_day_and_user.py
Python
bsd-3-clause
1,612
0.008685
# coding: utf-8 """ This file is where things are stuffed away. Probably you don't ever need to alter these definitions. """ import sys import os.path import uuid import dateutil.parser import datetime from bs4 import BeautifulSoup from urllib.parse import urlparse, urljoin import gzip import requests impor...
Vastra-Gotalandsregionen/verifierad.nu
helper.py
Python
mit
10,385
0.003467
""" Models for representing top-level plot objects. """ from __future__ import absolute_import from six import string_types from ..enums import Location from ..mixins import LineProps, TextProps from ..plot_object import PlotObject from ..properties import Bool, Int, String, Color, Enum, Auto, Instance, Either, List...
birdsarah/bokeh
bokeh/models/plots.py
Python
bsd-3-clause
15,281
0.001701
import unittest from locust.util.timespan import parse_timespan from locust.util.rounding import proper_round class TestParseTimespan(unittest.TestCase): def test_parse_timespan_invalid_values(self): self.assertRaises(ValueError, parse_timespan, None) self.assertRaises(ValueError, parse_timespan, ...
heyman/locust
locust/test/test_util.py
Python
mit
1,232
0.000812
import socket import sys def set_keepalive(sock, interval=1, probes=5): sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, interval) if hasattr(socket, 'TCP_KEEPCNT'): sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, probes) if hasattr(socket, 'TCP_KEEPIDLE'): sock.setsockopt(sock...
dw/scratch
tcp_ka2.py
Python
mit
658
0
# -*- coding: utf-8 -*- # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ API Issues to work out: - MatrixTransform and STTransform both have 'scale' and 'translate' attributes, but they are used in very different ways. It ...
Eric89GXL/vispy
vispy/visuals/transforms/base_transform.py
Python
bsd-3-clause
7,578
0.001715
import unittest from flumine import config class ConfigTest(unittest.TestCase): def test_init(self): self.assertFalse(config.simulated) self.assertTrue(config.simulated_strategy_isolation) self.assertIsInstance(config.customer_strategy_ref, str) self.assertIsInstance(config.proces...
liampauling/flumine
tests/test_config.py
Python
mit
865
0
import numpy import math def mkRamp(*args): ''' mkRamp(SIZE, DIRECTION, SLOPE, INTERCEPT, ORIGIN) Compute a matrix of dimension SIZE (a [Y X] 2-vector, or a scalar) containing samples of a ramp function, with given gradient DIRECTION (radians, CW from X-axis, default = 0), SLOPE (per pixel...
tochikuji/pyPyrTools
pyrtools/mkRamp.py
Python
mit
1,617
0.002474
from subprocess import * import gzip import string import os import time import ApplePythonReporter class ApplePythonReport: vendorId = YOUR_VENDOR_ID userId = 'YOUR_ITUNES_CONNECT_ACCOUNT_MAIL' password = 'ITUNES_CONNECT_PASSWORD' account = 'ACCOUNT_ID' mode = 'Robot.XML' dateType = 'Daily' ...
Acimaz/Google_Apple_Financial_Reporter
AppleReporter.py
Python
mit
4,732
0.005283
#!/usr/bin/env python from __future__ import ( unicode_literals, absolute_import, print_function, division, ) import aaf2 import traceback import subprocess import json import os import datetime import sys import tempfile import shutil import time import fractions from aaf2 import auid from pprint...
markreidvfx/pyaaf2
examples/import_media.py
Python
mit
17,403
0.008045
import numpy as np def extrapolate(xs_name): """Extrapolate cross section based on thermal salt expansion feedback. Extrapolates cross section data at 900 K to 1500 K at 50 K intervals based on the thermal salt expansion feedback formula from [1]. Writes the extrapolated data back into the .txt cross...
arfc/moltres
property_file_dir/cnrs-benchmark/feedback.py
Python
lgpl-2.1
2,292
0
#!/usr/bin/env python3 # Copyright (c) 2022 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test logic for setting nMaxTipAge on command line. Nodes don't consider themselves out of "initial block do...
particl/particl-core
test/functional/feature_maxtipage.py
Python
mit
1,997
0.002003
import pytest from dateutil.parser import parse from django import forms from adhocracy4.forms.fields import DateTimeField class DateTimeForm(forms.Form): date = DateTimeField( time_format='%H:%M', required=False, require_all_fields=False, ) @pytest.mark.django_db def test_datetimef...
liqd/adhocracy4
tests/forms/test_forms.py
Python
agpl-3.0
1,198
0
# Copyright 2011 OpenStack Foundation # aLL Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
redhat-openstack/manila
manila/tests/api/v1/test_share_types.py
Python
apache-2.0
8,424
0
# Copyright 2018-present Facebook, 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 i...
brettwooldridge/buck
scripts/artificialproject/file_path_generator.py
Python
apache-2.0
7,481
0.000535
data = [ b'\x04\x0e\x04\x01\x05 \x00', b'\x04\x0e\x04\x01\x0b \x00', b'\x04\x0e\x04\x01\x0c \x00', b'\x04>+\x02\x01\x03\x01\x97\xe7/s\x18b\x1f\x1e\xff\x06\x00\x01\t \x02[=cdI\xb9kQl\x977W\xc2V?\xa2k\xe7\x1c\xf4\x9d\xd7\x85\xc9', b'\x04>\x1a\x02\x01\x00\x01\x07\xbb\xd8!p\\\x0e\x02\x01\x06\n\xffL\x00\...
ukBaz/ble_beacon
tests/data/pkt_capture.py
Python
gpl-2.0
39,109
0.006648
from __future__ import absolute_import from __future__ import division from __future__ import print_function try: import torch except ImportError: pass # soft dep from ray.rllib.models.action_dist import ActionDistribution from ray.rllib.utils.annotations import override class TorchDistributionWrapper(Acti...
atumanov/ray
python/ray/rllib/models/torch_action_dist.py
Python
apache-2.0
1,516
0
# Copyright (c) 2015, Matt Layman """Tests for tappy""" from tap.tests.testcase import TestCase # NOQA
cans/tappy-pkg
tap/tests/__init__.py
Python
bsd-2-clause
105
0
""" .. module: lemur.auth.views :platform: Unix :copyright: (c) 2015 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import jwt import base64 import requests from flask import g, Blueprint, current_app from fl...
rhoml/lemur
lemur/auth/views.py
Python
apache-2.0
8,442
0.002961
""" pluginconf.d configuration file - Files ======================================= Shared mappers for parsing and extracting data from ``/etc/yum/pluginconf.d/*.conf`` files. Parsers contained in this module are: PluginConfD - files ``/etc/yum/pluginconf.d/*.conf`` ---------------------------------------------------...
RedHatInsights/insights-core
insights/parsers/pluginconf_d.py
Python
apache-2.0
3,141
0
import collections class Solution: def numSimilarGroups(self, A): UF = {} for i in range(len(A)): UF[i] = i def find(x): if x != UF[x]: UF[x] = find(UF[x]) return UF[x] def union(x, y): UF.setdefault(x, x) UF.setdefault(...
zuun77/givemegoogletshirts
leetcode/python/839_similar-string-groups.py
Python
apache-2.0
1,451
0.009649
# -*- coding: utf-8 -*- from queue.producer import Producer from queue.consumer import Consumer from queue.bloom_filter import BloomFilter class Dytt: def main(): for i in range(15): # Producer().start() Consumer().start() if __name__ == '__main__': main()
zoucaitou/azeroth-spider
azeroth_spider/dytt.py
Python
mit
310
0.006452
""" Helper Methods """ import six def _get_key(key_or_id, key_cls): """ Helper method to get a course/usage key either from a string or a key_cls, where the key_cls (CourseKey or UsageKey) will simply be returned. """ return ( key_cls.from_string(key_or_id) if isinstance(key_or_id,...
ESOedX/edx-platform
lms/djangoapps/utils.py
Python
agpl-3.0
368
0
# -*- coding:utf-8 -*- import logging import warnings from flypwd.config import config with warnings.catch_warnings(): warnings.simplefilter("ignore") from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_v1_5 log = logging.getLogger(__name__) def check_key(keyfile): """ checks the R...
giupo/flypwd
flypwd/keys.py
Python
bsd-3-clause
658
0.00304
#!/usr/bin/env python2 """ Copyright (c) 2015 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, mer...
alexforencich/hdg2000
fpga/tb/test_wb_mcb_32.py
Python
mit
10,990
0.012648
#### ZarcFit.py #### for interactive model fitting of spectral electrical impedance observations. # Seogi Kang and Randy Enkin, developed starting November 2015. # Based on ZarcFit.vi, written in LabView by Randy Enkin, Geological Survey of Canada # Using Python version 3.4 and QT version 4.8 # # requires files Zar...
sgkang/PhysPropIP
codes/ZarcFit2016-01-26.py
Python
mit
44,212
0.011626
# vim: ts=4:sw=4:expandtab # -*- coding: UTF-8 -*- # BleachBit # Copyright (C) 2008-2015 Andrew Ziem # http://bleachbit.sourceforge.net # # 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...
uudiin/bleachbit
bleachbit/GuiPreferences.py
Python
gpl-3.0
18,737
0.000907
from dgs2.discogs_client.exceptions import HTTPError from dgs2.discogs_client.utils import parse_timestamp, update_qs, omit_none class SimpleFieldDescriptor(object): """ An attribute that determines its value using the object's fetch() method. If transform is a callable, the value will be passed through ...
hzlf/openbroadcast
website/tools/dgs2/discogs_client/models.py
Python
gpl-3.0
21,790
0.000964
#!/usr/bin/env python """ The LibVMI Library is an introspection library that simplifies access to memory in a target virtual machine or in a file containing a dump of a system's physical memory. LibVMI is based on the XenAccess Library. Copyright 2011 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000...
jie-lin/libvmi
tools/pyvmi/examples/process-list.py
Python
gpl-3.0
1,982
0.001009
# Function to stack raster bands. import numpy as np from osgeo import gdal def stack_bands(filenames): """Returns a 3D array containing all band data from all files.""" bands = [] for fn in filenames: ds = gdal.Open(fn) for i in range(1, ds.RasterCount + 1): bands.append(ds.Ge...
cgarrard/osgeopy-code
Chapter12/listing12_1.py
Python
mit
378
0.002646
#!/usr/bin/env python3 import os import sys import copy import re import time import datetime from urllib.request import urlopen import numpy as np import nltk from nltk.stem.wordnet import WordNetLemmatizer from nltk.stem.porter import PorterStemmer import json import torch import torch.autograd as autograd import...
WayneDW/Sentiment-Analysis-in-Event-Driven-Stock-Price-Movement-Prediction
util.py
Python
mit
13,305
0.006238
# Copyright 2012 OpenStack Foundation # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011,2012 Akira YOSHIYAMA <akirayoshiyama@gmail.com> # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "Lic...
alexpilotti/python-keystoneclient
keystoneclient/middleware/s3_token.py
Python
apache-2.0
10,573
0
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from tapi_server.models.base_model_ import Model from tapi_server.models.tapi_oam_meg_ref import TapiOamMegRef # noqa: F401,E501 from tapi_server import util class T...
karthik-sethuraman/ONFOpenTransport
RI/flask_server/tapi_server/models/tapi_oam_mip_ref.py
Python
apache-2.0
2,530
0.000395
#!/usr/bin/python import yaml import pprint import os import pdb import re import cgi import codecs import sys import cgitb cgitb.enable() if (sys.stdout.encoding is None): print >> sys.stderr, "please set python env PYTHONIOENCODING=UTF-8, example: export PYTHONIOENCODING=UTF-8, when write to stdout." ...
coder0xff/Plange
documentation/syntax-cgi.py
Python
bsd-3-clause
5,936
0.012298
# Lint as: python3 # 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 ...
tensorflow/docs
tools/tensorflow_docs/api_generator/doc_controls.py
Python
apache-2.0
12,723
0.006445
#!/usr/bin/env python import os from setuptools import setup, find_packages from structure import __version__ # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # str...
kengz/python-structure
setup.py
Python
mit
976
0.004098
# # 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...
amitsela/incubator-beam
sdks/python/apache_beam/io/localfilesystem.py
Python
apache-2.0
8,015
0.005989
# -*- coding: UTF-8 -*- # ..#######.########.#######.##....#..######..######.########....###...########.#######.########..######. # .##.....#.##.....#.##......###...#.##....#.##....#.##.....#...##.##..##.....#.##......##.....#.##....## # .##.....#.##.....#.##......####..#.##......##......##.....#..##...##.##.....#....
repotvsupertuga/tvsupertuga.repository
script.module.openscrapers/lib/openscrapers/sources_openscrapers/de/tata.py
Python
gpl-2.0
8,804
0.005793
"""Support for the Hive devices.""" import logging from pyhiveapi import Pyhiveapi import voluptuous as vol from homeassistant.const import ( CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME) import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import load_platform _LOGGER = ...
jabesq/home-assistant
homeassistant/components/hive/__init__.py
Python
apache-2.0
2,196
0
import pickle from deap import tools from stats import record logbook = tools.Logbook() logbook.record(gen=0, evals=30, **record) print(logbook) gen, avg = logbook.select("gen", "avg") pickle.dump(logbook, open("logbook.pkl", "w")) # Cleaning the pickle file ... import os os.remove("logbook.pkl") logbook.header...
marcioweck/PSSLib
reference/deap/doc/code/tutorials/part_3/logbook.py
Python
lgpl-3.0
1,381
0.003621
# Created By: Virgil Dupras # Created On: 2008-08-12 # Copyright 2015 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "GPLv3" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.gnu.org/licenses/g...
stuckj/dupeguru
hscommon/tests/table_test.py
Python
gpl-3.0
9,340
0.006852
from django.conf import settings from django.conf.urls.defaults import handler500, handler404, patterns, include, \ url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^jsi18n/(?P<packages>\S+?)/$', 'django.views.i18n.javasc...
hzlf/openbroadcast
website/cms/test_utils/project/second_urls_for_apphook_tests.py
Python
gpl-3.0
696
0.005747
from nanoplay import PayloadProtocol, ControlProtocol, Player, CustomServer
nanonyme/nanoplay
nanoplay/__init__.py
Python
mit
76
0
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eksi.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
hanakamer/eskisozluk-clone
App/eksi/manage.py
Python
gpl-2.0
247
0
#!/usr/bin/python # -*- coding: utf-8 -*- import email import mimetypes from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText from email.MIMEImage import MIMEImage import smtplib from time import sleep def sendEmail(authInfo, fromAdd, toAdd, subject, plainText, htmlText): strFrom = fro...
zhaochl/python-utils
utils/mail_util.py
Python
apache-2.0
3,970
0.013465
# !usr/bin/env python2 # -*- coding: utf-8 -*- # # Licensed under a 3-clause BSD license. # # @Author: Brian Cherinka # @Date: 2017-06-20 16:36:37 # @Last modified by: Brian Cherinka # @Last Modified time: 2017-11-13 15:16:57 from __future__ import print_function, division, absolute_import from marvin.utils.genera...
albireox/marvin
python/marvin/tests/utils/test_images.py
Python
bsd-3-clause
11,203
0.002856
# To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor.
tzuria/Shift-It-Easy
webApp/shift-it-easy-2015/web/pages/__init__.py
Python
mit
177
0.00565
#!/usr/bin/python # Copyright (c) 2016 Thomas Stringer, <tomstr@microsoft.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 ANSIBLE_METADATA = {'metadata_version': '1.1', ...
caphrim007/ansible
lib/ansible/modules/cloud/azure/azure_rm_loadbalancer.py
Python
gpl-3.0
36,330
0.002175
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
googleinterns/vm-network-migration
vm_network_migration/module_helpers/instance_group_helper.py
Python
apache-2.0
4,376
0.0016
# The Nexus software is licensed under the BSD 2-Clause license. # # You should have recieved a copy of this license with the software. # If you did not, you can find one at the following link. # # http://opensource.org/licenses/bsd-license.php from core.plugins import ProtocolPlugin from core.decorators import * fro...
TheArchives/Nexus
core/plugins/respawn.py
Python
bsd-2-clause
1,072
0.012127
from .default import default import os import re class image_png(default): def __init__(self, key, stat): default.__init__(self, key, stat) self.data = {} def compile(self, prop): if not os.path.exists(prop['value']): print("Image '{}' not found.".format(prop['value'])) ...
plepe/pgmapcss
pgmapcss/types/image_png.py
Python
agpl-3.0
1,840
0.002717
# -*- coding: utf-8 -*- """ Created on Sun Mar 10 10:43:53 2019 @author: Heathro Description: Reduces a vcf file to meta section and one line for each chromosome number for testing and debugging purposes. """ # Open files to read from and write to vcfpath = open("D:/MG_GAP/Ali_w_767.vcf", "rU") testvcf = open("REDU...
davidfarr/mg-gap
mg-gap/mg-gap-py/mg-gap/test_files/reduceVCF.py
Python
mit
1,210
0.005785
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """@package docstring Yowsup connector for wxpyWha (a simple wxWidgets GUI wrapper atop yowsup). Uses WhaLayer to build the Yowsup stack. This is based on code from the yowsup echo example, the yowsup cli and pywhatsapp. """ SECONDS_RECONNECT_DELAY = 10 import sys # ...
hoehermann/wxpyWha
whastack.py
Python
gpl-3.0
3,522
0.010789
from sqlalchemy.orm import joinedload from datetime import datetime from changes.api.base import APIView from changes.api.build_index import execute_build from changes.config import db from changes.constants import Result, Status from changes.models import Build, Job, JobStep, ItemStat class BuildRestartAPIView(API...
alex/changes
changes/api/build_restart.py
Python
apache-2.0
1,841
0.000543
"""Print all records in the pickle for the specified test""" import sys import argparse from autocms.core import (load_configuration, load_records) def main(): """Print all records corresponding to test given as an argument""" parser = argparse.ArgumentParser(description='Submit one or more jobs.') pars...
appeltel/AutoCMS
print_records.py
Python
mit
801
0.002497
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import CBIG_pMFM_basic_functions as fc def CBIG_mfm_test_desikan_main(gpu_index=0): ''' This function is to implement the test...
ThomasYeoLab/CBIG
stable_projects/fMRI_dynamics/Kong2021_pMFM/part2_pMFM_control_analysis/Primary_gradients/scripts/CBIG_pMFM_step33_test_GradPC2Grad.py
Python
mit
4,115
0.000486
#!/usr/bin/env python3 # Uses the wikipedia module to define words on the command line import wikipedia import sys sys.argv.pop(0) for word in sys.argv: try: if word[0] != '-': if '-full' in sys.argv: print(wikipedia.summary(word)) else: print(wikipedia.summary(word, sentences=1)) except: print("...
dendory/scripts
wikipedia_define.py
Python
mit
347
0.028818
import os import logging # standardize use of logging module in fs-drift def start_log(prefix, verbosity=0): log = logging.getLogger(prefix) if os.getenv('LOGLEVEL_DEBUG') != None or verbosity != 0: log.setLevel(logging.DEBUG) else: log.setLevel(logging.INFO) log_format = prefix + ' %(...
bengland2/fsstress
fsd_log.py
Python
apache-2.0
1,486
0.004038
# Copyright The PyTorch Lightning 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 law or agreed to i...
williamFalcon/pytorch-lightning
tests/models/test_hooks.py
Python
apache-2.0
38,377
0.002528
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
laosiaudi/tensorflow
tensorflow/python/util/deprecation.py
Python
apache-2.0
12,098
0.004877
__all__ = ["Transition"] class Transition(object): def __init__(self, startState, nextState, word, suffix, marked): self.startState = startState self.nextState = nextState self.word = word self.suffix = suffix self.marked = False def similarTransitions(self, transition...
otuncelli/turkish-stemmer-python
TurkishStemmer/transitions/__init__.py
Python
apache-2.0
516
0.007782
from unittest import TestCase EXAMPLES_PATH = '../examples' SKIPPED_EXAMPLES = {472, 473, 477} def _set_test_class(): import re from imp import load_module, find_module, PY_SOURCE from pathlib import Path def _load_module(name, file, pathname, description): try: load_module(name,...
yehzhang/RapidTest
tests/test_by_examples.py
Python
mit
1,535
0.001954
# coding=utf-8 import requests def download(url): resp = requests.get(url) # TODO add retries return resp.content, resp.headers
ahmetalpbalkan/permalinker
application/downloader.py
Python
apache-2.0
140
0
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2017-03-19 02:09 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pos', '0001_initial'), ] operations = [ migrations.AddField( mo...
nuxis/p0sX-server
p0sx/pos/migrations/0002_itemingredient_exclusive.py
Python
mit
448
0
################################################################################ # 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...
lincoln-lil/flink
flink-python/pyflink/table/tests/test_environment_settings_completeness.py
Python
apache-2.0
2,417
0.002482
import logging logger = logging.getLogger(__name__) class Singleton(type): def __init__(cls, name, bases, dict): super(Singleton, cls).__init__(name, bases, dict) cls.instance = None def __call__(cls, keep=True, *args, **kwargs): logger.debug("Handle singleton instance for %s with arg...
sahlinet/fastapp
fastapp/plugins/singleton.py
Python
mit
1,074
0.003724
from unittest import TestCase import validictory class TestItems(TestCase): def test_property(self): schema = { "type": "object", "properties": { "foo": { "default": "bar" }, "baz": { "type": "...
jalaziz/validictory
validictory/tests/test_defaults.py
Python
mit
1,074
0
import os from airtng_flask.config import config_env_files from flask import Flask from flask_bcrypt import Bcrypt from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager db = SQLAlchemy() bcrypt = Bcrypt() login_manager = LoginManager() def create_app(config_name='development', p_db=db, p_bcry...
TwilioDevEd/airtng-flask
airtng_flask/__init__.py
Python
mit
801
0.002497
# -*- coding: utf-8 -*- """ Created on Wed Mar 2 10:56:34 2016 @author: jmjj (Jari Juopperi, jmjj@juopperi.org) """ from .main import *
jmjj/messages2json
messages2json/__init__.py
Python
mit
140
0
# -*- coding: utf-8 -*- from openerp.http import request, STATIC_CACHE from openerp.addons.web import http import json import io from PIL import Image, ImageFont, ImageDraw from openerp import tools import cStringIO import werkzeug.wrappers import time import logging logger = logging.getLogger(__name__) class Web_Edi...
ChawalitK/odoo
addons/web_editor/controllers/main.py
Python
gpl-3.0
10,264
0.00341
## Progam packages from .credit_model_classes import credit_model_base from ...asset.Asset_data import Asset_data from ..generator_correlated_variables import generator_correlated_variables from ...core_math.function_optim import function_optim from ...core_math.functions_credit import generator_matrix, exp_matrix ## ...
jbalm/ActuarialCashFlowModel
esg/credit_risk/JLT.py
Python
gpl-3.0
10,706
0.014413
# Copyright 2015 gRPC 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 writing...
firebase/grpc-SwiftPM
setup.py
Python
apache-2.0
15,931
0.006403
#-- # Copyright (c) 2012-2014 Net-ng. # All rights reserved. # # This software is licensed under the BSD License, as described in # the file LICENSE.txt, which you should have received as part of # this distribution. #-- import peak import datetime from nagare import presentation, security, ajax, i18n from nagare.i18...
Net-ng/kansha
kansha/card_addons/due_date/view.py
Python
bsd-3-clause
2,112
0.001894
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: (c) 2018, F5 Networks Inc. # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
alxgu/ansible
lib/ansible/modules/network/f5/bigiq_application_fastl4_udp.py
Python
gpl-3.0
21,905
0.00137
#!/usr/bin/env python3 import os from i3_lemonbar_conf import * cwd = os.path.dirname(os.path.abspath(__file__)) lemon = "lemonbar -p -f '%s' -f '%s' -g '%s' -B '%s' -F '%s'" % (font, iconfont, geometry, color_back, color_fore) feed = "python3 -c 'import i3_lemonbar_feeder; i3_lemonbar_feeder.run()'" check_output('...
jesseops/i3-lemonbar
i3_lemonbar.py
Python
mit
370
0.002703
from __future__ import unicode_literals from django.db import transaction from django.db import models from django.contrib.auth.models import User # Create your models here. class UserProfile(models.Model): user = models.OneToOneField(User, unique=True, verbose_name=('user')) phone = models.CharField(max_leng...
passren/Roxd
member/models.py
Python
gpl-2.0
727
0.005502
import os, unicodedata from django.utils.translation import ugettext_lazy as _ from django.core.files.storage import FileSystemStorage from django.db.models.fields.files import FileField from django.core.files.storage import default_storage from django.conf import settings from django.utils.safestring import mark_safe...
Krozark/django-slider
slider/utils.py
Python
bsd-2-clause
3,032
0.005937
from django.contrib.sitemaps import Sitemap from .models import BlogEntry class BlogEntrySitemap(Sitemap): changefreq = "yearly" priority = 0.6 protocol = 'https' def items(self): return BlogEntry.on_site.filter(is_visible=True) def lastmod(self, item): return item.modification
nim65s/MarkDownBlog
dmdb/sitemaps.py
Python
gpl-3.0
320
0
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2009-2014: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # Gregory Starck, g.starck@gmail.com # Hartmut Goebel, h.goebel@goebel-consult.de # # This file is part of Shinken. # # Shinken is free software: you can redis...
h4wkmoon/shinken
shinken/objects/contact.py
Python
agpl-3.0
13,143
0.004337
import torch from transformers import PreTrainedModel from .custom_configuration import CustomConfig, NoSuperInitConfig class CustomModel(PreTrainedModel): config_class = CustomConfig def __init__(self, config): super().__init__(config) self.linear = torch.nn.Linear(config.hidden_size, conf...
huggingface/transformers
utils/test_module/custom_modeling.py
Python
apache-2.0
772
0
import unittest try: from unittest import mock except ImportError: import mock from pi3bar.plugins.uptime import get_uptime_seconds, uptime_format, Uptime class GetUptimeSecondsTestCase(unittest.TestCase): def test(self): m = mock.mock_open(read_data='5') m.return_value.readline.return_val...
knoppo/pi3bar
pi3bar/tests/plugins/test_uptime.py
Python
mit
1,771
0
# -*- coding: utf-8 -*- import os import re try: import simplejson as json except ImportError: import json from ToolBoxAssistant.app import AppFactory from ToolBoxAssistant.helpers import get_svn_url, readfile, find_versionned_folders, yes_no, Color from ToolBoxAssistant.log import logger VERSION = '0.1' cl...
mattoufoutu/ToolBoxAssistant
ToolBoxAssistant/__init__.py
Python
gpl-3.0
5,458
0.001649
import numpy as np import random class ReplayBuffer: """ Buffer for storing values over timesteps. """ def __init__(self): """ Initializes the buffer. """ pass def batch_sample(self, batch_size): """ Randomly sample a batch of values from the buffer. """ ...
fizz-ml/pytorch-aux-reward-rl
replay_buffer.py
Python
mit
4,985
0.004814
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
Fale/ansible
lib/ansible/module_utils/urls.py
Python
gpl-3.0
77,490
0.00231
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('simsoexp', '0005_schedulingpolicy_class_name'), ] operations = [ migrations.RemoveField( model_name='results', ...
Scriptopathe/simso-exp
simsoexp/migrations/0006_auto_20150721_1432.py
Python
bsd-2-clause
2,084
0
# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) from ..extern import six from ..extern.six.moves import zip import warnings import weakref from copy import deepcopy import numpy as np from num...
tbabej/astropy
astropy/table/column.py
Python
bsd-3-clause
41,990
0.001143
#!/usr/bin/env python from .util import Spec class Port(Spec): STATES = [ "listening", "closed", "open", "bound_to", "tcp", "tcp6", "udp" ] def __init__(self, portnumber): self.portnumber = portnumber self.get_state() self.state = { 'state': '...
daniellawrence/pyspeccheck
speccheck/port.py
Python
mit
2,928
0
import logging import warnings from collections import namedtuple logger = logging.getLogger(__name__) Field = namedtuple('Field', ('name', 'type_', 'default', 'desc', 'warn')) class Config: """配置模块 用户可以在 rc 文件中配置各个选项的值 """ def __init__(self): object.__setattr__(self, '_fields', {}) ...
cosven/FeelUOwn
feeluown/config.py
Python
gpl-3.0
2,065
0.000504
from sklearn2sql_heroku.tests.regression import generic as reg_gen reg_gen.test_model("XGBRegressor" , "RandomReg_500" , "db2")
antoinecarme/sklearn2sql_heroku
tests/regression/RandomReg_500/ws_RandomReg_500_XGBRegressor_db2_code_gen.py
Python
bsd-3-clause
130
0.015385
# https://leetcode.com/problems/valid-parentheses/ class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ if not s: return True stack = [] for i in xrange(len(s)): # if its opening it, its getting deeper so add...
young-geng/leet_code
problems/20_valid-parentheses/main.py
Python
mit
920
0.003261
import pytest from cleo.exceptions import LogicException from cleo.exceptions import ValueException from cleo.io.inputs.option import Option def test_create(): opt = Option("option") assert "option" == opt.name assert opt.shortcut is None assert opt.is_flag() assert not opt.accepts_value() a...
sdispater/cleo
tests/io/inputs/test_option.py
Python
mit
2,858
0
from ctypes.util import find_library from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db.backends.sqlite3.base import ( DatabaseWrapper as SQLiteDatabaseWrapper, SQLiteCursorWrapper, ) from .client import SpatiaLiteClient from .features import DatabaseFeatures f...
mattseymour/django
django/contrib/gis/db/backends/spatialite/base.py
Python
bsd-3-clause
3,105
0.001932
# Xlib.__init__ -- glue for Xlib package # # Copyright (C) 2000-2002 Peter Liljenberg <petli@ctrl-c.liu.se> # # 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 th...
python-xlib/python-xlib
Xlib/__init__.py
Python
lgpl-2.1
1,184
0
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2016 Bitergia # # 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. # # This ...
grimoirelab/arthur
arthur/worker.py
Python
gpl-3.0
1,980
0
from django.conf import settings def mask_toggle(number_to_mask_or_unmask): return int(number_to_mask_or_unmask) ^ settings.MASKING_KEY
shafiquejamal/socialassistanceregistry
nr/nr/formulas.py
Python
bsd-3-clause
137
0.021898
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt import unittest import frappe from frappe.utils import cstr, flt, nowdate, random_string from erpnext.hr.doctype.employee.test_employee import make_employee from erpnext.hr.doctype.vehicle_log.vehicle_log import make_expense_claim...
mhbu50/erpnext
erpnext/hr/doctype/vehicle_log/test_vehicle_log.py
Python
gpl-3.0
3,526
0.025241