content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
"""Euler explicit time advancement routine"""
from .projection import predictor, corrector, divergence
from .stats import stats
def advance_euler(gridc, gridx, gridy, scalars, grid_var_list, predcorr):
"""
Subroutine for the fractional step euler explicit time advancement of Navier Stokes equations
Arg... | 30.457627 | 117 | 0.657206 | [
"BSD-3-Clause"
] | AbhilashReddyM/flowX | flowx/ins/euler.py | 1,797 | Python |
"""
Stacked area plot for 1D arrays inspired by Douglas Y'barbo's stackoverflow
answer:
http://stackoverflow.com/questions/2225995/how-can-i-create-stacked-line-graph-with-matplotlib
(http://stackoverflow.com/users/66549/doug)
"""
from __future__ import (absolute_import, division, print_function,
... | 33.584 | 94 | 0.579085 | [
"MIT"
] | Owen-Gillespie/BeachHacks-ShowerSuite | lib/matplotlib/stackplot.py | 4,198 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayOpenMiniInnerversionOnlinePublishModel import AlipayOpenMiniInnerversionOnlinePublishModel
class AlipayOpenMiniI... | 28.165517 | 166 | 0.652302 | [
"Apache-2.0"
] | articuly/alipay-sdk-python-all | alipay/aop/api/request/AlipayOpenMiniInnerversionOnlinePublishRequest.py | 4,084 | Python |
def up(cursor, bot):
cursor.execute(
"""
CREATE TABLE timeouts(
id SERIAL PRIMARY KEY,
active BOOL DEFAULT TRUE NOT NULL,
user_id TEXT REFERENCES "user"(discord_id) ON DELETE CASCADE NOT NULL,
issued_by_id TEXT REFERENCES "user"(discord_id) ON DELETE SET NULL,
unb... | 30.941176 | 78 | 0.636882 | [
"MIT"
] | EMorf/greenbot | greenbot/migration_revisions/db/0004_timeouts.py | 526 | Python |
# Copyright 2018-2019 The glTF-Blender-IO 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 ... | 39.39726 | 100 | 0.595793 | [
"Apache-2.0"
] | MrTheRich/glTF-Blender-IO | addons/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py | 5,752 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.10.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import u... | 26.487805 | 125 | 0.75046 | [
"Apache-2.0"
] | olitheolix/aiokubernetes | test/test_v1beta1_custom_resource_subresources.py | 1,086 | Python |
# QAP Gemini
#
# adcclib.py
# ------------------------------------------------------------------------------
import os
import sys
import signal
import time
from copy import copy
from ... | 30.86755 | 80 | 0.534006 | [
"BSD-3-Clause"
] | Luke-Ludwig/DRAGONS | recipe_system/adcc/adcclib.py | 4,661 | Python |
from setuptools import setup, find_packages
setup(
name='gatas',
version='1.0.0',
packages=find_packages(exclude=('tests', 'tests.*')),
python_requires='~=3.7',
install_requires=[
'mlflow~=1.8',
'defopt~=6.0',
'numba~=0.49',
'numpy~=1.18.0',
's3fs~=0.4.0',
... | 21.444444 | 57 | 0.520725 | [
"MIT"
] | Wattpad/gatas | setup.py | 386 | Python |
from datetime import datetime
from dagster import Out, job, op
from dagster.utils import script_relative_path
from dagster_pandas import PandasColumn, create_dagster_pandas_dataframe_type
from dagster_pandas.constraints import (
ColumnConstraint,
ColumnConstraintViolationException,
ColumnDTypeInSetConstrai... | 31.172414 | 100 | 0.705199 | [
"Apache-2.0"
] | StratoDem/dagster | examples/docs_snippets/docs_snippets/legacy/dagster_pandas_guide/custom_column_constraint.py | 1,808 | Python |
import pytest
from aiogoogle.resource import (
Resource,
GoogleAPI,
STACK_QUERY_PARAMETER_DEFAULT_VALUE,
STACK_QUERY_PARAMETERS,
)
from ..test_globals import ALL_APIS
@pytest.mark.parametrize("name,version", ALL_APIS)
def test_getitem(open_discovery_document, name, version):
discovery_document = ... | 39.858696 | 81 | 0.760295 | [
"MIT"
] | dergunovalexey/aiogoogle | tests/test_units/test_GoogleAPI.py | 3,667 | Python |
from . import ( # noqa
ideal_qr,
ideal_qr_notification,
payment,
payment_request,
payment_request_notification,
refund,
sandbox_app,
transaction_bundle,
transactions_notifications,
)
| 18.333333 | 33 | 0.7 | [
"MIT"
] | new10com/python-tikkie-api | src/tikkie2/v2/__init__.py | 220 | Python |
from model.contact import Contact
from random import randrange
def test_add_contact(app,db,check_ui):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(firstName='test'))
old_contact = db.get_contact_list()
index = randrange(len(old_contact))
contact = Contact(firstName="firstName",... | 62.888889 | 138 | 0.693463 | [
"Apache-2.0"
] | AIdegrade/testing | tests/test_edit_first_contact.py | 1,132 | Python |
# coding: utf-8
"""
jinja2schema.config
~~~~~~~~~~~~~~~~~~~
"""
from .order_number import OrderNumber
class Config(object):
"""Configuration."""
TYPE_OF_VARIABLE_INDEXED_WITH_VARIABLE_TYPE = 'dictionary'
"""Possible values: ``"dictionary"`` or ``"list""``.
For example, in the expression ``xs[a]`` va... | 40.717172 | 114 | 0.678492 | [
"BSD-3-Clause"
] | jmjjg/jinja2schema | jinja2schema/config.py | 4,031 | Python |
from typing import Any, List, Literal, TypedDict
from .FHIR_CodeableConcept import FHIR_CodeableConcept
from .FHIR_Element import FHIR_Element
from .FHIR_Reference import FHIR_Reference
from .FHIR_string import FHIR_string
# A record of a clinical assessment performed to determine what problem(s) may affect the patie... | 95.37931 | 836 | 0.780188 | [
"Apache-2.0"
] | anthem-ai/fhir-types | src/fhir_types/FHIR_ClinicalImpression_Finding.py | 2,766 | Python |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import time
'''
ComputeCost computes the cost function
'''
def computeCost(X, y, theta):
#computeCost Compute cost for linear regression
# J = computeCost(X, y, theta) computes the cost of using theta as the
# parameter for linear regressio... | 34.9 | 119 | 0.652854 | [
"MIT"
] | rishisidhu/MachineLearning | Linear_Regression/ex1.py | 4,537 | Python |
# Mobile Verification Toolkit (MVT)
# Copyright (c) 2021-2022 The MVT Project Authors.
# Use of this software is governed by the MVT License 1.1 that can be found at
# https://license.mvt.re/1.1/
import logging
import os
import click
from rich.logging import RichHandler
from mvt.common.help import (HELP_MSG_FAST, ... | 38.551095 | 130 | 0.573795 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | dangaffey/mvt | mvt/android/cli.py | 10,563 | Python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consi... | 32.387097 | 76 | 0.691235 | [
"BSD-2-Clause"
] | Puppet-Finland/puppet-trac | files/spam-filter/tracspamfilter/filters/tests/__init__.py | 1,004 | Python |
#!/usr/bin/python
import re, random, sys, difflib
random.seed(123)
for i, line in enumerate(sys.stdin.readlines()):
if i % 1000 == 0: print >>sys.stderr, i, "..."
if i>0 and re.search(r'^id\tsentiment', line): continue # combined files, ignore multiple header rows
line = re.sub(r'\n$', '', line) # stri... | 52.741935 | 117 | 0.478287 | [
"MIT"
] | asah/codesmell | augment-c_and_cpp.py | 3,270 | Python |
# Copyright 2019 The Magenta 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 ... | 43.545966 | 80 | 0.700732 | [
"Apache-2.0"
] | Surya130499/magenta | magenta/models/shared/events_rnn_model.py | 23,210 | Python |
# Functions for visualization
import numpy as np
import networkx as nx
import multinetx as mx
from jinja2 import Environment, FileSystemLoader, Template
import json
from networkx.readwrite import json_graph
def write_mx_to_json(filename, mg, nNodes, pos, nLayers, nodes_to_remove = []):
# filename the complet... | 31.14486 | 122 | 0.632558 | [
"MIT"
] | asizemore/multilayer_network_examples | mx_viz.py | 6,665 | Python |
#!/usr/bin/python
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('MirrorEngine')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import re
import threading
import copy
from pydispatch import dispatcher
fr... | 32.876972 | 94 | 0.420745 | [
"BSD-3-Clause"
] | twatteyne/dustlink_academy | DataConnector/MirrorEngine.py | 10,422 | Python |
(p9.ggplot(titanic.dropna(subset=['Age']), p9.aes(x='Sex', y='Age'))
+ p9.geom_violin()
+ p9.geom_jitter(alpha=0.2)
) | 31.75 | 68 | 0.598425 | [
"BSD-3-Clause"
] | jonasvdd/DS-python-data-analysis | notebooks/_solutions/visualization_02_plotnine3.py | 127 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 New Vector Ltd
#
# 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... | 28.358209 | 87 | 0.675 | [
"Apache-2.0"
] | AP-whitehat/synapse | scripts/move_remote_media_to_new_store.py | 3,800 | Python |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Find your credentials at twilio.com/console
api_key_sid = 'SKXXXX'
api_key_secret = 'your_api_key_secret'
client = Client(api_key_sid, api_key_secret)
compositionHook = client.video.compositionHooks('KHXXXX').upd... | 32.590909 | 72 | 0.631799 | [
"MIT"
] | Abubakar672/api-snippets | video/rest/compositionhooks/update-hook/update-hook.6.x.py | 717 | Python |
import sqlite3;
import csv;
import sys;
from ordery.db import get_db
from flask import current_app
def order_csv(filename):
## Connect to the database
try:
conn = sqlite3.connect(
current_app.config['DATABASE'],
detect_types=sqlite3.PARSE_DECLTYPES); # Get a connection... | 48.0625 | 104 | 0.562094 | [
"MIT"
] | lambdagirl/ordery | ordery/order_csv.py | 3,078 | Python |
_base_ = [
'../common/mstrain-poly_3x_coco_instance.py',
'../_base_/models/mask_rcnn_r50_fpn.py'
]
model = dict(
pretrained='open-mmlab://detectron2/resnext101_32x8d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=8,
num_stages=4,
out_in... | 29.452381 | 77 | 0.599838 | [
"Apache-2.0"
] | CONTEC-SIP/mmdetection | configs/mask_rcnn/mask_rcnn_x101_32x8d_fpn_mstrain-poly_3x_coco.py | 2,474 | Python |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... | 39.557325 | 124 | 0.613397 | [
"Apache-2.0"
] | likelyzhao/dino | vision_transformer.py | 12,421 | Python |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 36.028169 | 245 | 0.697029 | [
"Apache-2.0",
"BSD-3-Clause"
] | CentroidChef/oci-python-sdk | src/oci/devops/models/compute_instance_group_selector_collection.py | 2,558 | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Update the location of a adrespositie and and add a terrein koppeling using a shapeFile
import os, sys, codecs, datetime, argparse
import osgeo.ogr as ogr
from pyspatialite import dbapi2 as sqlite3 #import sqlite3
def updateTerrein(cur, TERREINOBJECTID , HUISNUMMERID):
... | 44.438202 | 141 | 0.637927 | [
"MIT"
] | warrieka/xgrab2db | update_terrein_adrespositie.py | 3,955 | Python |
import sqlite3
import datetime
from collections import Counter
import calendar
def return_unique_ID():
conn = sqlite3.connect("ORDERM8.db")
c = conn.cursor()
c.execute('SELECT * FROM rolodex')
IDs = []
for item in c:
ID = int(item[0])
IDs.append(ID)
IDs = sorted(IDs, key=int, re... | 30.608939 | 123 | 0.648902 | [
"MIT"
] | StavromularBeta/ORDERM8 | SQL_functions.py | 16,437 | Python |
"""
MIT License
Copyright (c) 2020-2021 phenom4n4n
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... | 33.7 | 125 | 0.71876 | [
"MIT"
] | Arman0334/phen-cogs | roleutils/roleutils.py | 3,033 | Python |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 24 17:59:20 2017
@author: amirbitran
Various functions that serve to compute the contacts matrix for a series of PDB snapshots
"""
import numpy as np
from matplotlib import pyplot as plt
import sklearn
from sklearn import metrics
from dbfold.utils import loopCluster
im... | 46.97463 | 240 | 0.665376 | [
"MIT"
] | amirbitran/dbfold | dbfold/analyze_structures.py | 22,219 | Python |
from django.http import HttpResponse
from django.shortcuts import render, reverse
from django.views.decorators.csrf import csrf_exempt
import os
from twilio.rest import Client
from conversations.models import Conversation, Message
from .models import TwilioConfig, PhoneOwnership
# @validate_twilio_request
@csrf_exempt... | 35.626016 | 134 | 0.666591 | [
"MIT"
] | ph00lt0/websms | twilioconfig/views.py | 4,382 | Python |
import numpy
import os
from src.readers import SimpleBSONReader
def read_train_example(path='../../data/train_example.bson', pca_reduction=True):
read_result = SimpleBSONReader.read_all(path)
pixels = read_result.pixel_matrix
numpy.savetxt("../../out/train_example.csv", pixels, delimiter=",", fmt='%.d')
... | 36.673913 | 111 | 0.663308 | [
"Apache-2.0"
] | DSSerialGeneva/cd15c0un7 | src/read/read_train_example.py | 1,687 | Python |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import urllib.parse
from abc import ABC
from typing import Any, Iterable, Mapping, MutableMapping, Optional
import requests
from airbyte_cdk.sources.streams.http import HttpStream
class CartStream(HttpStream, ABC):
primary_key = "id"
def __init__... | 32.564626 | 135 | 0.667642 | [
"MIT"
] | 52-entertainment/airbyte | airbyte-integrations/connectors/source-cart/source_cart/streams.py | 4,787 | Python |
# coding:utf-8
# usr/bin/python3
# python src/chapter28/chapter28note.py
# python3 src/chapter28/chapter28note.py
"""
Class Chapter28_1
Class Chapter28_2
Class Chapter28_3
Class Chapter28_4
Class Chapter28_5
"""
from __future__ import absolute_import, division, print_function
import numpy as np
class Chapter28_... | 36.896142 | 98 | 0.619752 | [
"Apache-2.0"
] | HideLakitu/IntroductionToAlgorithm.Python | src/chapter28/chapter28note.py | 20,506 | Python |
#Python 3.X? Could be compatitible with small tweaks.
from re import findall
#Tatatat0 2016
#Documentation:
#Virtual Memory Classes:
# Virtual_Memory(max_memory)
# maxmemory: maximum address memory can be allocated to
# chunks: list of virtual memory chunks.
# format: ((chunk1, chunk1.start_address,... | 67.872807 | 340 | 0.654927 | [
"MIT"
] | tatatat0/VirtualMemory | VirtualMemory.py | 15,475 | Python |
import asyncio, sys, os
from onvif import ONVIFCamera
import time
IP="192.168.1.64" # Camera IP address
PORT=80 # Port
USER="admin" # Username
PASS="intflow3121" # Password
XMAX = 1
XMIN = -1
XNOW = 0.5
YMAX = 1
YMIN = -1
YNOW = 0.5
Move = 0.1
Velocity = 1
Zoom = 0
positionrequest = None
p... | 30.774074 | 171 | 0.636298 | [
"MIT"
] | intflow/python-onvif-zeep | examples/AbsoluteMove.py | 8,309 | Python |
'''
Preprocessor for Foliant documentation authoring tool.
Calls Elasticsearch API to generate an index based on Markdown content.
'''
import re
import json
from os import getenv
from pathlib import Path
from urllib import request
from urllib.error import HTTPError
from markdown import markdown
from bs4 import Beauti... | 35.238307 | 114 | 0.579446 | [
"MIT"
] | foliant-docs/foliantcontrib.elasticsearch | foliant/preprocessors/elasticsearch.py | 15,822 | Python |
from django.apps import AppConfig
class TableroConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'tablero'
| 20.857143 | 56 | 0.760274 | [
"MIT"
] | AutodidactaMx/cocid_python | Modulo_4/semana 2/miercoles/servicioweb/tablero/apps.py | 146 | Python |
__version__ = '3.0.6'
__buildinfo__ = { 'branch' : 'BRANCH_NOT_SET' , 'last_commit' : 'COMMIT_NOT_SET' }
| 21.4 | 82 | 0.672897 | [
"Apache-2.0"
] | arshiyaaggarwal/hubble | hubblestack/__init__.py | 107 | Python |
"""
Settings for different models.
"""
import attr
@attr.s # pylint: disable=too-many-instance-attributes,too-few-public-methods
class BaseSettings:
"""
Base configuration settings.
"""
val_split = attr.ib(default=0.0)
test_split = attr.ib(default=0.15)
detect_type = attr.ib(default="dual")... | 30.054348 | 83 | 0.687161 | [
"Apache-2.0"
] | lingpy/pybor | src/pybor/config.py | 2,765 | Python |
#!/usr/bin/python
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2014 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ import pri... | 26.640351 | 90 | 0.682581 | [
"MIT"
] | Bittransfer/Bittransfer-master | contrib/linearize/linearize-hashes.py | 3,037 | Python |
from rest_framework import parsers, renderers, status
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.compat import coreapi, coreschema
from rest_framework.generics import DestroyAPIView, RetrieveAPIView
from rest_framework.permissions import IsAdminUser, IsAuthenticated
from re... | 35.065854 | 99 | 0.647632 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | AntoineToubhans/polyaxon | polyaxon/api/users/views.py | 14,377 | Python |
# encoding=utf8
"""Implementations of Cosine mixture functions."""
from numpy import cos, pi
from NiaPy.benchmarks.benchmark import Benchmark
__all__ = ['CosineMixture']
class CosineMixture(Benchmark):
r"""Implementations of Cosine mixture function.
Date: 2018
Author: Klemen Berkovič
License: MIT
Function:... | 25.022472 | 112 | 0.634037 | [
"MIT"
] | lucijabrezocnik/NiaPy | NiaPy/benchmarks/cosinemixture.py | 2,230 | Python |
from dearpygui.core import *
from dearpygui.simple import *
from math import cos, sin
# callbacks
def colormap_callback(sender, data):
value = get_value("Colormaps")
set_color_map("Plot", value)
def plot_callback(sender, data):
clear_plot("Plot")
data1x = []
data1y = []
for i in range(0, 10... | 42.981132 | 122 | 0.585601 | [
"MIT"
] | DynamicCai/Dynamic-Explorer | test/plot_example.py | 2,278 | Python |
# Read PV metadata and timeseries data
# Based on code in https://github.com/openclimatefix/pvoutput
# E.g. https://nbviewer.jupyter.org/github/openclimatefix/pvoutput/blob/master/examples/analyse_PV_data_for_9th_Aug_2019.ipynb
import cartopy.crs as ccrs
import numpy as np
import pandas as pd
import xarray as xr
ME... | 33.757895 | 157 | 0.68787 | [
"MIT"
] | openclimatefix/predict_pv_yield_nwp | predict_pv_yield_nwp/pv.py | 6,414 | Python |
"""
noxfile
~~~~~~~
Nox configuration script
"""
# pylint: disable=resource-leakage,3rd-party-module-not-gated
import datetime
import glob
import os
import shutil
import sys
import tempfile
# fmt: off
if __name__ == "__main__":
sys.stderr.write(
"Do not execute this file directly. Use nox instead, it wi... | 32.522212 | 135 | 0.614574 | [
"Apache-2.0"
] | 99-lives/salt | noxfile.py | 35,872 | Python |
schema = {
"type": "object",
"properties": {
"name": {"type": "string"},
"species": {"type": "string"},
"breed": {"type": "string"},
"age": {"type": "number"},
"store": {"type": "string"},
"price": {"type": "string"},
"received_date": {"type": "string", "p... | 34.714286 | 115 | 0.442387 | [
"Apache-2.0"
] | xod442/pets-api | pet/schema.py | 486 | Python |
# coding:utf8
from .api import *
from .helpers import get_stock_codes, update_stock_codes
__version__ = "0.5.14"
__author__ = "shidenggui"
| 20 | 56 | 0.771429 | [
"MIT"
] | Gavin-HZ/easyquotation | easyquotation/__init__.py | 140 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import copy
import enum
import json
import logging
import math
import multiprocessing as mp
import ti... | 36.825149 | 114 | 0.626573 | [
"MIT"
] | hahaxun/ClassyVision | classy_vision/tasks/classification_task.py | 49,493 | Python |
"""The tests for day17."""
from days import day17
from ddt import ddt, data, unpack
import unittest
import helpers
@ddt
class MyTestCase(unittest.TestCase): # noqa D101
@data(
[[
'x=495, y=2..7',
'y=7, x=495..501',
'x=501, y=3..7',
'x=498, y=2..4',
... | 28.808511 | 69 | 0.521418 | [
"MIT"
] | frangiz/AdventOfCode2018 | test/test_day17.py | 1,354 | Python |
"""
pyart.lazydict
==============
A dictionary-like class supporting lazy loading of specified keys.
.. autosummary::
:toctree: generated/
:template: dev_template.rst
LazyLoadDict
"""
try:
# Python 3
from collections.abc import MutableMapping
except ImportError:
# Python 2.7, will be remove... | 32.440299 | 79 | 0.624109 | [
"MIT"
] | 1271756664/study | pycwr/configure/pyart_lazydict.py | 4,347 | Python |
from apis.creat_account.api_account_setAlias import account_setAlias
from apis.creat_account.api_create_account import create_account, create_account_100
from apis.creat_account.api_get_addresslist import get_address_list
from apis.transfer.blockmgr_sendRawTransaction import sendRawTransaction
from apis.transfer.time_o... | 40.852459 | 113 | 0.854334 | [
"Apache-2.0"
] | DerWalundDieKatze/Yumekui | apis/router.py | 2,632 | Python |
import db
import sys
if db.connection.is_connected():
for database_name in sys.argv[1:len(sys.argv)]:
cursor = db.connection.cursor()
cursor.execute("DROP DATABASE {}".format(database_name))
print(" > Database {} has been dropped!".format(database_name)) | 35.375 | 71 | 0.681979 | [
"MIT"
] | naufalfachrian/py-database-manager | drop_database.py | 283 | Python |
from django.contrib import messages
from django.http import QueryDict
from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.contrib.admin.views.decorators import staff_member_required
from django.template.defaulttags import register
from common.exp... | 34.849765 | 149 | 0.648121 | [
"MIT"
] | andreped/annotationweb | annotationweb/views.py | 22,269 | Python |
import copy
import torch
from torch import nn
import numpy as np
from tokens import *
def tokenize(corpus, callback=lambda sent: sent.split()):
return [callback(sent) for sent in corpus]
def add_start_stop_tokens(corpus):
return [[START_TOKEN] + sent + [STOP_TOKEN] for sent in corpus]
def padding(corpus... | 27.65493 | 79 | 0.663356 | [
"MIT"
] | daohuei/ucsc-nlp-unicorn | nlp_243/hw3/utils.py | 3,927 | Python |
import numpy as np
'''
dccol : 1-8
dcpad : 1-10
mcecol: 0,1
mcerow: 0-32
'''
#w,h = 10,8
# def det2mce(detcol,detrow,detpol):
# dccol,dcpad = det2dc(detcol,detrow,detpol)
# if dccol<0 or dcpad<0:
# return -1,-1
# mcecol,mcerow = dc2mce(dccol,dcpad)
# return mcecol,mcerow
def mce2det(mcecol,mcerow):
if mcecol... | 17.75 | 45 | 0.679577 | [
"MIT"
] | LorenzoMinutolo/SigViz | ba150_ModuleMapping_fake.py | 568 | Python |
import datetime
from .. import db
tags = db.Table(
'post_tags',
db.Column('post_id', db.Integer, db.ForeignKey('post.id')),
db.Column('tag_id', db.Integer, db.ForeignKey('tag.id'))
)
class Post(db.Model):
id = db.Column(db.Integer(), primary_key=True)
title = db.Column(db.String(255), nullable=Fa... | 30.810345 | 94 | 0.641858 | [
"MIT"
] | PacktPublishing/Mastering-Flask-Web-Development | Chapter11/webapp/blog/models.py | 1,787 | Python |
# -*- coding: utf-8 -*-
"""Tests for :mod:`docdata`."""
| 14.25 | 31 | 0.491228 | [
"MIT"
] | cthoyt/docdata | tests/__init__.py | 57 | Python |
from enum import Enum
from .factory import createFromUri
import os
import requests
class Record(object):
"""
Create a Polarion test record,
:param polarion: Polarion client object
:param test_run: Test run instance
:param polarion_record: The data from Polarion of this testrun
:param index: T... | 33.851266 | 127 | 0.618678 | [
"MIT"
] | jesper-raemaekers/python-polarion | polarion/record.py | 10,697 | Python |
#!/usr/bin/env python
#
# Init file for Shotgun event daemon
#
# chkconfig: 345 99 00
# description: Shotgun event daemon
#
### BEGIN INIT INFO
# Provides: shotgunEvent
# Required-Start: $network
# Should-Start: $remote_fs
# Required-Stop: $network
# Should-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Short-Description:... | 33.179598 | 151 | 0.565301 | [
"MIT"
] | darkvertex/shotgunEvents | src/shotgunEventDaemon.py | 46,186 | Python |
"""
Project Euler Problem 7: https://projecteuler.net/problem=7
10001st prime
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we
can see that the 6th prime is 13.
What is the 10001st prime number?
References:
- https://en.wikipedia.org/wiki/Prime_number
"""
import itertools
import math
def pri... | 17.710145 | 75 | 0.582651 | [
"MIT"
] | 04n0/TheAlgorithms-Python | project_euler/problem_007/sol3.py | 1,222 | Python |
from datetime import datetime
import ujson
from django.db import transaction
from django.test import TestCase
from math import pi
from convertable_model.models import BarFooFooModel
from convertable_model.models import FooBarModel
from convertable_model.models import FooModel, BarModel
from convertable_model.models i... | 33.948052 | 92 | 0.55088 | [
"MIT"
] | FelixTheC/-django-json-convertible-models | convertable_model/tests.py | 5,228 | Python |
import os
import subprocess
usersList = subprocess.check_output("grep '/home/' /etc/passwd | cut -d: -f1", shell=True)
users = usersList.splitlines()
totalFails = 3
for user in users:
fails = subprocess.check_output("cat /var/log/auth.log | grep '" + user.decode('UTF-8') + " ' | grep 'ssh.*Failed' | wc -l", shell... | 30.571429 | 137 | 0.656542 | [
"MIT"
] | SoursosK/Linux-Security-Tools | forth.py | 428 | Python |
import requests
from collections import OrderedDict
from django.utils.http import urlencode
from allauth.socialaccount.providers.core.oauth2.client import (
OAuth2Client,
OAuth2Error,
)
class WeixinOAuth2Client(OAuth2Client):
def get_redirect_url(self, authorization_url, extra_params):
params =... | 33.574074 | 70 | 0.570877 | [
"MIT"
] | Cairnica/django-allauth | allauth/socialaccount/providers/other/weixin/client.py | 1,813 | Python |
# ---------------------------------------------------------------------
# Rotek.BT.get_metrics
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# NOC module... | 40.528736 | 98 | 0.474475 | [
"BSD-3-Clause"
] | nocproject/noc | sa/profiles/Rotek/BT/get_metrics.py | 3,526 | Python |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
chrome_path = r"C:\Users\iamdo\Downloads\chromedriver.exe" # specify your driver location
driver = webdriver.Chrome(chrome_path)
driver.get("https://github.com/login")
username = "your email" # specify your email
passwor... | 44.62069 | 98 | 0.743431 | [
"MIT"
] | iamdonmathew/github_repository | github.py | 1,294 | Python |
from django.contrib import admin
from .models import Post
#pythonadmin.site.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ("pk","text", "pub_date", "author")
search_fields = ("text",)
list_filter = ("pub_date",)
empty_value_display = "-пусто-"
admin.site.register(Post, PostAdmin... | 23.071429 | 55 | 0.69969 | [
"BSD-3-Clause"
] | bukvaq/yatube_project | yatube/posts/admin.py | 328 | Python |
import asyncio
from typing import List
from app.common import SkipListing
from app.scrapers.base import BaseScraper
class MaartenScraper(BaseScraper):
MAKELAARDIJ: str = "maarten"
BASE_URL: str = "https://www.maartenmakelaardij.nl"
# Specific functions
async def extract_object_urls(self, soup) -> L... | 29.897196 | 87 | 0.546733 | [
"MIT"
] | damienallen/makelaardij-notify | server/app/scrapers/maarten.py | 3,199 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | 35.655172 | 114 | 0.612186 | [
"MIT"
] | GETLIMS/LIMS-Backend | lims/addressbook/migrations/0001_initial.py | 1,034 | Python |
from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from axes.models import AccessAttempt
class Command(BaseCommand):
args = ''
help = ("List login attempts")
def handle(self, *args, **kwargs):
for at in AccessAttempt.objects.all():
... | 27.5 | 73 | 0.688312 | [
"MIT"
] | CBitLabs/django-axes | axes/management/commands/axes_list_attempts.py | 385 | Python |
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'artemis.settings')
from django.conf import settings
app = Celery('artemis')
app.config_from_object('djang... | 23.956522 | 67 | 0.784029 | [
"Apache-2.0"
] | hyooqi/artemis | artemis/celery.py | 551 | Python |
import logging
import json
import paho.mqtt.client as mqttc
from ioctlgw import version
from ioctlgw.componentstate import ComponentState
LOG = logging.getLogger(__name__)
class MqttConnector(object):
def __init__(self, service):
self.service = service
self.config = self.service.config
s... | 40.694444 | 117 | 0.63413 | [
"MIT"
] | natm/iocontrollergw | ioctlgw/mqttconnector.py | 4,395 | Python |
from tithiwa import *
tithiwabot = Tithiwa()
tithiwabot.open_session()
print("'" + tithiwabot.get_my_name() + "', '" + tithiwabot.get_my_about() + "'")
tithiwabot.quit()
browser = 3
#doing something else with browser
tithiwabot = Tithiwa(browser)
tithiwabot.browser = webdriver.Chrome()
tithiwabot.open_session()
print... | 27.6 | 80 | 0.71256 | [
"MIT"
] | pyvelkov/tithiwa | tithiwa/temp.py | 414 | Python |
from flask import Flask
from flask import make_response
from flask import render_template
from flask import request
from flask import session
from blog_site.common.database import Database
from blog_site.webapp.models.blog import Blog
from blog_site.webapp.models.user import User
app = Flask(__name__)
app.secret_key ... | 27.470588 | 103 | 0.685531 | [
"MIT"
] | jesh-anand/PythonMasterClass | blog_site/webapp/web_app.py | 3,269 | Python |
# Copyright 2019 Extreme Networks, 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... | 39.761905 | 74 | 0.790419 | [
"Apache-2.0"
] | Anshika-Gautam/orquesta | orquesta/constants.py | 835 | Python |
import time
from grapht.graph import DictGraph, StreamGraph
__author__ = 'willmcginnis'
if __name__ == '__main__':
print('DictGraph')
g = {0: [2], 1: [2, 3], 2: [1, 3], 3: [1, 2, 4, 6], 4: [3, 5], 5: [4, 6, 7], 6: [3, 4, 5], 7: [5, 8], 8: [7], 9: [8], 10: [9], 11: [8, 9], 12: [11], 13: [12], 14: [13], 15: [1]... | 30.627907 | 181 | 0.570995 | [
"BSD-3-Clause"
] | wdm0006/grapht | examples/adjacency.py | 1,317 | Python |
from typing import Union, List, Optional
from pyspark.sql.types import StructType, StructField, StringType, ArrayType, DataType
# This file is auto-generated by generate_schema so do not edit manually
# noinspection PyPep8Naming
class AuditEvent_EntitySchema:
"""
A record of an event made for purposes of mai... | 45.792 | 96 | 0.546646 | [
"Apache-2.0"
] | icanbwell/SparkFhirSchemas | spark_fhir_schemas/stu3/complex_types/auditevent_entity.py | 11,448 | Python |
import numpy as np
import matplotlib.pyplot as plt
import argparse
from camera import add_pmts
parser = argparse.ArgumentParser()
parser.add_argument('inputfile', help='A datafile created by the old SPECT camera')
parser.add_argument(
'--outputfile', '-o', required=False,
dest='outputfile',
help='If given... | 21.196721 | 83 | 0.614076 | [
"MIT"
] | tudo-spect/plot_spect_images | plot_spect_image.py | 1,293 | Python |
# Standard library
from unittest import mock
# Third-party
import polib
from django.test import TestCase, override_settings
from django.utils.translation import override
# First-party/Local
from i18n import DEFAULT_LANGUAGE_CODE
from licenses import FREEDOM_LEVEL_MAX, FREEDOM_LEVEL_MID, FREEDOM_LEVEL_MIN
from license... | 35.807916 | 103 | 0.540265 | [
"MIT"
] | kerahui/cc-licenses | licenses/tests/test_models.py | 30,759 | 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 required by applicable law or ag... | 30.909657 | 80 | 0.669522 | [
"Apache-2.0"
] | Aaravmaheshwari/magenta | magenta/models/rl_tuner/rl_tuner_ops.py | 9,922 | Python |
# -*- coding: utf-8 -*-
'''SRFax (www.srfax.com) python library'''
import re
import os.path
import base64
import logging
import requests
URL = 'https://www.srfax.com/SRF_SecWebSvc.php'
LOGGER = logging.getLogger(__name__)
RE_E164 = re.compile(r'^\+\d{7,15}$') # TODO: Replace this with phonenumberslite?
RE_NANP... | 31.17 | 108 | 0.573735 | [
"MIT"
] | sunbeamer/srfax-api-python | srfax/srfax.py | 9,351 | Python |
import keras
import keras.backend as K
class Shape(keras.layers.Layer):
def call(self, inputs):
return K.shape(inputs)
def compute_output_shape(self, input_shape):
return (len(input_shape),)
class Cast(keras.layers.Layer):
def __init__(self, dtype, **kwargs):
self.dtype = dtype
... | 22.92 | 48 | 0.645724 | [
"MIT"
] | yecharlie/convnet3d | convnet3d/layers/misc.py | 573 | Python |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/player/city/shared_hospital_corellia.iff"
result.attribute_template... | 26.764706 | 77 | 0.72967 | [
"MIT"
] | SWGANHServices/GameServer_Legacy | data/scripts/templates/object/building/player/city/shared_hospital_corellia.py | 455 | Python |
from MoveGetter import MoveGetter
import chess
class CommandLineMoveGetter(MoveGetter):
def getMove(self, board):
print("\n")
print(board)
self.printLegalMoves(board)
return self.getMoveFromCLI(board)
def printLegalMoves(self, board):
for index, move in enumerate(board... | 29.724138 | 68 | 0.574246 | [
"MIT"
] | okiyama/Chess-EEA-Opponent-Modelling | CommandLineMoveGetter.py | 862 | Python |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | 34.298643 | 79 | 0.600923 | [
"BSD-3-Clause"
] | ebolyen/qiime2 | qiime2/core/transform.py | 7,580 | Python |
import torch
import torch.nn.functional as F
def clamp_probs(probs):
eps = torch.finfo(probs.dtype).eps
return torch.clamp(probs, min=eps, max=1-eps)
def concrete_sample(logits, temperature, shape=torch.Size([])):
'''
Sampling for Concrete distribution.
See Eq. 10 of Maddison et al., 2017.
'... | 34.848485 | 75 | 0.643478 | [
"MIT"
] | iancovert/dl-selection | selection/layers/utils.py | 1,150 | Python |
#Django
from django.contrib import admin
#Model
from cride.rides.models import Ride
@admin.register(Ride)
class RideAdmin(admin.ModelAdmin):
pass | 16.777778 | 35 | 0.788079 | [
"MIT"
] | LhernerRemon/Rider | cride/rides/admin.py | 151 | Python |
downloadable_resource_urls = {
"default-glove-embeddings": {
"filename": "glove.tgz",
"url": "https://fibber-data.s3.amazonaws.com/glove.tgz",
"md5": "7deac3ce2cfd8be24f97bc4ba007a19c",
"untar": True,
"unzip": False,
},
"default-stopwords": {
"filename": "stop... | 35.545455 | 96 | 0.574464 | [
"MIT"
] | stungkit/fibber | fibber/resources/downloadable_resources.py | 5,083 | Python |
import os
import go_vncdriver
import tensorflow as tf
import argparse
import json
import envs
from model import policies
import checkpoint_utils
parser = argparse.ArgumentParser(description="Run commands")
parser.add_argument('logdir', type=str, help="Log directory path")
args = parser.parse_args()
with open(args.lo... | 25.782609 | 79 | 0.697302 | [
"MIT"
] | DFrolova/human-rl | universe-starter-agent/run.py | 1,186 | Python |
#!/usr/bin/env python3
# SPDX-FileCopyrightText: © 2022 Decompollaborate
# SPDX-License-Identifier: MIT
from __future__ import annotations
import enum
@enum.unique
class FileSectionType(enum.Enum):
Unknown = -2
Invalid = -1
Text = 1
Data = 2
Rodata = 3
Bss = 4
Reloc = 5
... | 28.923077 | 135 | 0.582067 | [
"MIT"
] | Decompollaborate/py-mips-disasm | spimdisasm/common/FileSectionType.py | 2,633 | Python |
import numpy as np
import pytest
from pytools.obj_array import make_obj_array
# {{{ test_unstructured_vertex_grid
@pytest.mark.parametrize("ambient_dim", [2, 3])
@pytest.mark.parametrize("dformat", ["xml", "hdf", "binary"])
def test_unstructured_vertex_grid(ambient_dim, dformat, npoints=64):
"""Test constructin... | 31.417085 | 79 | 0.621561 | [
"MIT"
] | alexfikl/pyvisfile | test/test_xdmf.py | 6,252 | Python |
import unittest
import torch
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
BertConfig,
BertForSequenceClassification,
GlueDataset,
GlueDataTrainingArguments,
Trainer,
TrainingArguments,
)
from transformers.adapters.composition import Fuse
from transforme... | 36.12766 | 119 | 0.643551 | [
"Apache-2.0"
] | AngadSethi/adapter-transformers | tests/test_adapter_trainer.py | 6,792 | Python |
from sklearn.metrics import roc_curve, auc
import numpy as np
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
import json
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
from pylab import rcParams
# rcParams['figure.figsize'] = 20, 20
rcParams... | 34.729167 | 113 | 0.676065 | [
"MIT"
] | buddhi1/CIFAR-10-project | utils.py | 5,001 | Python |
import datetime
import os
import re
import ujson
from django.conf import settings
from django.http import HttpResponse
from django.test import override_settings
from mock import MagicMock, patch
import urllib
from typing import Any, Dict, List
from zerver.lib.actions import do_create_user
from zerver.lib.test_classe... | 38.802747 | 110 | 0.61758 | [
"Apache-2.0"
] | rhencke/zulip | zerver/tests/test_home.py | 31,081 | Python |
################################################
# backend.py is part of COVID.codelongandpros.repl.co
# You should have recieved a copy of the three-clause BSD license.
# If you did not, it is located at:
# https://opensource.org/licenses/BSD-3-Clause
# Made by Scott Little, with help from StackOverflow
############... | 24.96875 | 86 | 0.612641 | [
"BSD-3-Clause"
] | CodeLongAndProsper90/COVID | backend.py | 1,598 | Python |
import unittest
from programy.services.lookups.countrycodes import CountryCodes
class CountryCodesTests(unittest.TestCase):
def test_names(self):
self.assertEqual(['Ukraine', 'UA', 'UKR', '804'], CountryCodes.NAMES['Ukraine'])
def test_two_digits(self):
self.assertEqual(['Ukraine', 'UA', 'UK... | 33.611111 | 91 | 0.67438 | [
"MIT"
] | RonKhondji/program-y | test/programytest/services/lookups/test_countrycodes.py | 605 | Python |
from . import *
#classes
from ._addon import _Addon
from ._plugin_instance import _PluginInstance
from ._plugin import _Plugin
#folders
from . import _util
from . import _structure
from . import _ui
from . import _network
from . import _volumetric
from . import _macro | 22.333333 | 45 | 0.798507 | [
"MIT"
] | devanshuDesai/nanome | nanome/_internal/__init__.py | 268 | Python |
import numpy as np
def non_max_suppression_fast(boxes, overlapThresh):
# if there are no boxes, return an empty list
if len(boxes) == 0:
return []
# if the boxes are integers, convert them to floats (due to divisions)
if boxes.dtype.kind == "i":
boxes = boxes.astype("float")
# initial... | 24.126761 | 108 | 0.615879 | [
"MIT"
] | dahem/coffe-images | coffee-maturation/src/models/non_maximum.py | 1,713 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.