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 |
|---|---|---|---|---|---|---|---|---|
import requests
from datetime import datetime
import psycopg2
import time
def setup():
# Create database connection
conn = psycopg2.connect(database="postgres", user="postgres",
password="password", host="127.0.0.1", port="5432")
return conn
def call_api():
URL = "https://api... | 24.870968 | 95 | 0.597925 | [
"MIT"
] | johnjdailey/JS-Realtime-Dashboard | server/models/bitcoin_price_API.py | 771 | Python |
import sys
import re
import pandas as pd
network_filename = sys.argv[1]
m = re.match("networks/(?P<dataset>.*?)_similarity", network_filename)
dataset = m.groupdict()['dataset']
G=nx.read_gml(network_filename)
labels=pd.read_csv(f"munged_data/{dataset}/labels.csv", index_col=0)
metadata = pd.read_csv(f"data/intermed... | 33.869565 | 86 | 0.762516 | [
"MIT"
] | menchelab/UMAPanalysis | src/classification/predict_with_umap.py | 779 | Python |
"""
This file offers the methods to automatically retrieve the graph Streptomyces sp. NRRLF5008.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--pro... | 33.009259 | 223 | 0.677419 | [
"MIT"
] | AnacletoLAB/ensmallen | bindings/python/ensmallen/datasets/string/streptomycesspnrrlf5008.py | 3,565 | Python |
from django.db import models
from django.contrib.auth.models import User
# Which data the user already has:
# SuperUserInformation
# User: Jose
# Email: training@pieriandata.com
# Password: testpassword
# Create your models here.
class UserProfileInfo(models.Model):
# Create relationship (don't inherit... | 33.6 | 92 | 0.717857 | [
"MIT"
] | warpalatino/public | Python learnings/Django projects/learning_users/basic_app/models.py | 840 | Python |
#pythran export compute_mask(int[:,:], int[:,:])
#runas import numpy as np; coords = np.array([[0, 0, 1, 1, 2, 2]]); indices = np.array([[0, 3, 2]]); compute_mask(coords, indices)
import numpy as np
def compute_mask(coords, indices): # pragma: no cover
"""
Gets the mask for the coords given the indices in sli... | 30.714286 | 130 | 0.584377 | [
"BSD-3-Clause"
] | AlifeLines/pythran | pythran/tests/pydata/compute_mask.py | 8,385 | Python |
# Copyright (c) OpenMMLab. All rights reserved.
import argparse
import math
import os
import os.path as osp
import mmcv
from mmocr.utils import convert_annotations
def collect_files(img_dir, gt_dir):
"""Collect all images and their corresponding groundtruth files.
Args:
img_dir (str): The image dir... | 28.240506 | 79 | 0.613178 | [
"Apache-2.0"
] | GHuiXin/mmocr | tools/data/textdet/funsd_converter.py | 4,462 | Python |
# Thai Thien
# 1351040
import pytest
import cv2
import sys
import sys, os
import numpy as np
import upload
# make sure it can find matcher.py file
sys.path.append(os.path.realpath(os.path.dirname(__file__)+"/.."))
import util
from matcher import Matcher
# make sure it can find detector.py file
sys.path.append(os.pat... | 25.121212 | 66 | 0.693004 | [
"MIT"
] | ttpro1995/CV_Assignment02 | test/test_meow_data.py | 1,658 | Python |
# Generated by Django 3.2.4 on 2021-07-23 15:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pythons_auth', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='pythonsuser',
name='is_staff',
... | 23.041667 | 53 | 0.584087 | [
"MIT"
] | BoyanPeychinov/python_web_framework | pythons/pythons/pythons_auth/migrations/0002_auto_20210723_1847.py | 553 | Python |
"""
Classes and functions useful for rewriting expressions for optimized code
generation. Some languages (or standards thereof), e.g. C99, offer specialized
math functions for better performance and/or precision.
Using the ``optimize`` function in this module, together with a collection of
rules (represented as instan... | 30.278431 | 96 | 0.643051 | [
"BSD-3-Clause"
] | Abhishek-IOT/sympy | sympy/codegen/rewriting.py | 7,721 | Python |
import logging
from django.conf import settings
from daiquiri.core.utils import import_class
from .adapter import OaiAdapter
from .models import Record
logger = logging.getLogger(__name__)
def get_metadata_format(metadata_prefix):
return next(metadata_format for metadata_format in settings.OAI_METADATA_FORMAT... | 33.15942 | 106 | 0.697115 | [
"Apache-2.0"
] | UCBerkeleySETI/daiquiri | daiquiri/oai/utils.py | 2,288 | Python |
from redbot.core.bot import Red
from cogwhitelist.cogwhitelist import CogWhitelist
def setup(bot: Red):
bot.add_cog(CogWhitelist(bot))
| 20.142857 | 50 | 0.787234 | [
"MIT"
] | Tominous/Swift-Cogs | cogwhitelist/__init__.py | 141 | Python |
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the Qt for Python examples of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:BSD$
## ... | 38.779661 | 85 | 0.664773 | [
"MIT"
] | 4RCAN3/GenPai | gen/Lib/site-packages/PySide2/examples/network/fortuneserver.py | 4,576 | Python |
"""This module takes the data.log file produced by main.cpp and
fetches Bogota's addresses based on the coordinates in the file.
TODO: check if system has requirements - if not, install them
* requests
* subprocess (upcoming)
TODO: include exact time of match
TODO: progress bar
FIXME: select best from multiple addres... | 24.62963 | 86 | 0.630827 | [
"MIT"
] | jdnietov/wazeReading | locate.py | 1,330 | Python |
"""
SC101 Baby Names Project
Adapted from Nick Parlante's Baby Names assignment by
Jerry Liao.
YOUR DESCRIPTION HERE
"""
import tkinter
import babynames
import babygraphicsgui as gui
FILENAMES = [
'data/full/baby-1900.txt', 'data/full/baby-1910.txt',
'data/full/baby-1920.txt', 'data/full/baby-1930.txt',
... | 35.86 | 112 | 0.636178 | [
"MIT"
] | beomgyutxt/stanCode_project | stancode_project/baby_names/babygraphics.py | 5,395 | Python |
import numpy as np
from future.cmorph import _dilate
rows = 1024
cols = 1024
srows = 64
scols = 64
image = np.random.randint(0, 255, rows * cols, dtype=np.uint8).reshape(
(rows, cols)
)
selem = np.random.randint(0, 1, srows * scols, dtype=np.uint8).reshape(
(srows, scols)
)
out = np.zeros((rows, cols), dtype=... | 21.823529 | 71 | 0.679245 | [
"BSD-3-Clause"
] | fluiddyn/transonic | doc/for_dev/scikit-image/setup_codes/cmorph__dilate.py | 371 | Python |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
# -----------------------------------------------------------------------------
try:
basestri... | 41.367534 | 126 | 0.424018 | [
"MIT"
] | tssujt/ccxt | python/ccxt/bigone.py | 27,013 | Python |
# -*- test-case-name: wokkel.test.test_muc -*-
#
# Copyright (c) Ralph Meijer.
# See LICENSE for details.
"""
XMPP Multi-User Chat protocol.
This protocol is specified in
U{XEP-0045<http://xmpp.org/extensions/xep-0045.html>}.
"""
from dateutil.tz import tzutc
from zope.interface import implements
from twisted.inter... | 29.234124 | 79 | 0.607447 | [
"MIT"
] | Gandi/wokkel | wokkel/muc.py | 45,576 | Python |
#!/usr/bin/env python3
"""
Copyright Google Inc. 2019
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 wri... | 34.15493 | 112 | 0.684536 | [
"Apache-2.0"
] | 16D070061/training-data-analyst | blogs/beamadvent/day2a.py | 2,425 | Python |
# coding: utf-8
"""
Velo Payments APIs
## Terms and Definitions Throughout this document and the Velo platform the following terms are used: * **Payor.** An entity (typically a corporation) which wishes to pay funds to one or more payees via a payout. * **Payee.** The recipient of funds paid out by a payor.... | 134.475 | 4,651 | 0.770961 | [
"Apache-2.0"
] | velopaymentsapi/velo-python | test/test_ping.py | 5,383 | Python |
class Argument(object):
def __init__(self, argument = None, base: bool = False):
self.arg = argument
self.is_base = base
def __repr__(self):
return self.arg
def __str__(self):
return self.arg
def is_pipe(self):
return self.arg == ">>" or self.arg == "<<"
| 21 | 60 | 0.571429 | [
"MIT"
] | ii-Python/Sprint-v2 | sprint/core/parser/args.py | 315 | Python |
"""
Cubic spline planner
Author: Atsushi Sakai(@Atsushi_twi)
"""
import math
import numpy as np
import bisect
class Spline:
"""
Cubic Spline class
"""
def __init__(self, x, y):
self.b, self.c, self.d, self.w = [], [], [], []
self.x = x
self.y = y
self.nx = len(x) # ... | 23.400844 | 79 | 0.462495 | [
"Apache-2.0"
] | hadleyhzy34/mpc_python_traj | cubic_spline_planner.py | 5,546 | Python |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def f(x):
return 1-x
data=pd.read_csv("test.csv")
print(data)
roll=data["Rollno"]
t1 =data["t1"]
t2 = data["t2"]
print(roll,t1,t2)
plt.pie(t1,labels=roll,autopct="%1.2f%%")
plt.title("Marks in test1")
plt.show()
plt.pie(t2,labels=roll,autopct="... | 20.821429 | 104 | 0.596913 | [
"MIT"
] | Maurya232Abhishek/Python-repository-for-basics | ML/Graph/pieChart2.py | 1,166 | Python |
#!/usr/bin/env python3
## Copyright 2021 Aon plc
##
## 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... | 29.576087 | 91 | 0.674752 | [
"Apache-2.0"
] | strozfriedberg/cobaltstrike-config-extractor | libcsce/bin/csce.py | 2,721 | Python |
"""
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft Corporation (“Microsoft”) grants you a nonexclusive, perpetual,
royalty-free right to use, copy, and modify the software code provided by us
("Software Code"). You may not sublicense the Software Code or any use of it
(except to your affiliates... | 34.666667 | 79 | 0.696897 | [
"MIT"
] | Voda88/EasyAzureMLOPS | scripts/train_model.py | 4,592 | Python |
"""This module provides functionality for wrapping key infrastructure components
from distutils and setuptools.
"""
from __future__ import print_function
import argparse
import copy
import json
import os
import os.path
import platform
import stat
import sys
import warnings
from contextlib import contextmanager
# pyl... | 38.586377 | 124 | 0.656698 | [
"MIT"
] | pekkarr/scikit-build | skbuild/setuptools_wrap.py | 39,088 | Python |
# The code for this extension is based on https://github.com/ulrobix/sphinxcontrib-contentui
| 46.5 | 92 | 0.806452 | [
"Apache-2.0"
] | NivekNey/sparkling-water | doc/src/site/sphinx/extensions/contentui/__init__.py | 93 | Python |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2020 Ansible Project
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
from an... | 34.1 | 115 | 0.699413 | [
"MIT"
] | tr3ck3r/linklight | exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/tests/unit/plugins/become/test_ksu.py | 1,364 | Python |
print "Hello World!"
print "Hello Again"
print "I like typing this."
print "This is fun."
print "Yay! Printing"
print "Id much rather you 'not'."
print 'I "said" do not touch this.'
| 22.75 | 35 | 0.697802 | [
"MIT"
] | llinmeng/PythonStudy | python_ex/01ex.py | 182 | Python |
# Copyright 2019 The Meson development 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 ... | 41.014304 | 186 | 0.590298 | [
"Apache-2.0"
] | Linux-Defender/meson | mesonbuild/cmake/traceparser.py | 31,540 | Python |
# -*- coding: utf-8 -*-
'''
A Runner module interface on top of the salt-ssh Python API.
This allows for programmatic use from salt-api, the Reactor, Orchestrate, etc.
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Libs
import salt.client.ssh.client
def cmd(
tgt,
fun,... | 21.175 | 78 | 0.602125 | [
"Apache-2.0"
] | 0xf10e/salt | salt/runners/ssh.py | 847 | Python |
from __future__ import print_function
from flask import Flask, Response
from pyzbar import pyzbar
from picamera.array import PiRGBArray
from picamera import PiCamera
from datetime import datetime
import numpy as np
import cv2
import time
camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 32
rawCap... | 26.539683 | 73 | 0.623206 | [
"MIT"
] | shihu/qr-reader | main.py | 1,672 | Python |
#!/usr/bin/python -i
import Block
import rlcompleter, readline
readline.parse_and_bind("tab: complete")
device = Block.Block("86:00.0",2,"libcomanche-blknvme.so")
buffer = device.allocate_io_buffer(4096,32,-1)
info = device.get_volume_info()
info
| 19.307692 | 58 | 0.756972 | [
"Apache-2.0"
] | Bhaskers-Blu-Org1/comanche | src/components/api/wrappers/test.py | 251 | Python |
import json
import boto3
def lambda_handler(event, context):
print(event)
lex = boto3.client('lex-runtime')
lex_resp = lex.post_text(
botName = 'dining_concierge_bot',
botAlias = 'Test',
userId = 'user01',
inputText = event['messages'][0]['unstructured']['text'],
act... | 23.961538 | 65 | 0.457464 | [
"MIT"
] | nikhilkhaneja/Dining-Concierge-using-AWS-1 | Lambda functions/LF0.py | 623 | Python |
# coding=utf-8
import os, clr
os.chdir(os.path.dirname(__file__))
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
from System import Drawing, Array, ComponentModel, Diagnostics, IO
from System.Windows import Forms
import System.Object as object
import System.String as string
from ... | 38.375546 | 128 | 0.600819 | [
"MIT"
] | hefeifan98/HowtoSim_Script | 2021/changeLineWidth.py | 8,788 | Python |
from src.NN import NetWrapper
from src.games.Tictactoe import Tictactoe
from src.Player import *
from src.MCTS import MCTS
import yaml
with open("config.yaml", 'r') as f:
config = yaml.safe_load(f)
game = Tictactoe(**config['GAME'])
nn = NetWrapper(game, **config['NN'])
nn.load_model("models/the_bestest_of_model... | 30.619048 | 139 | 0.710731 | [
"MIT"
] | gemasphi/alpha-zero-torch | test.py | 643 | Python |
from decimal import Decimal
import setoptconf as soc
GOOD_NAMES = ("foo", "foo_bar", "foo123", "foo_bar_baz")
BAD_NAMES = ("_foo", "1foo", "FOO", "foo_", "foo__bar", "foo-bar")
def test_name():
for name in GOOD_NAMES:
yield check_good_name, name
for name in BAD_NAMES:
yield check_bad_name,... | 19.612245 | 66 | 0.636837 | [
"MIT"
] | carlio/setoptconf-tmp | test/test_settings.py | 961 | Python |
#
# Copyright 2019 Xilinx 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 writi... | 35.467213 | 115 | 0.633175 | [
"Apache-2.0"
] | bryanloz-xilinx/Vitis-AI | tools/RNN/rnn_quantizer/pytorch_binding/pytorch_nndct/export/op_descriptor.py | 17,308 | Python |
# -*- coding: utf-8 -*-
import os
import tempfile
import pytest
@pytest.fixture(scope="module")
def master(request, salt_factories):
return salt_factories.spawn_master(request, "master-1")
@pytest.fixture(scope="module")
def minion(request, salt_factories, master):
return salt_factories.spawn_minion(reques... | 27.858333 | 81 | 0.647921 | [
"Apache-2.0"
] | cmcmarrow/pytest-salt-factories | tests/integration/factories/master/test_master.py | 3,343 | Python |
# -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
from os import listdir
from os.path import isfile, join
import numpy as np
import soundfile as sf
from scipy import io
import scipy.signal as sp
from src.features import gtgram
ROOT = Path(__file__).resolve().parents[2]
# set the path to th... | 43.968354 | 165 | 0.539513 | [
"MIT"
] | oesst/HRTF_neural_model | src/data/generateData.py | 6,947 | Python |
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRe... | 44.154545 | 234 | 0.680255 | [
"MIT"
] | AikoBB/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py | 24,285 | Python |
# MIT License
# Copyright (c) 2022 Muhammed
# 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, publi... | 50 | 186 | 0.750833 | [
"MIT"
] | PR0FESS0R-99/LuciferMoringstar-Robot | LuciferMoringstar_Robot/admins/chat.py | 2,760 | Python |
The next greater element of some element x in an array is the first greater element that is to the right of x in the same array.
You are given two distinct 0-indexed integer arrays nums1 and nums2, where nums1 is a subset of nums2.
For each 0 <= i < nums1.length, find the index j such that nums1[i] == nums2[j] and de... | 39.5 | 215 | 0.670359 | [
"MIT"
] | vijay2020pc/100-days-of-code | leetcode-CP/Problem solving/496. Next Greater Element I.py | 1,896 | Python |
#!/usr/bin/env python
import common
import json
import docker_utils
nginx_sites_available = '/etc/nginx/sites-available'
CERT_DIR = '/root/certs'
import subprocess
def create_certificates(domains):
format_args = {'cert_dir': CERT_DIR}
import os.path
if not os.path.isfile(os.path.join(CERT_DIR, 'acmeCA.... | 38.708185 | 341 | 0.558886 | [
"Unlicense"
] | bcoding/docker-host-scripts | py/update_nginx_vhosts.py | 10,877 | Python |
# -*- coding: utf-8 -*-
"""Main IPython class."""
#-----------------------------------------------------------------------------
# Copyright (C) 2001 Janko Hauser <jhauser@zscout.de>
# Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu>
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distribu... | 39.53305 | 147 | 0.587781 | [
"BSD-3-Clause"
] | CMU-IDS-2022/final-project-the-evaluators | venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py | 148,921 | Python |
# Copyright 2022 StackHPC
#
# 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... | 43.771186 | 79 | 0.648725 | [
"Apache-2.0"
] | bahnwaerter/nova | nova/tests/unit/limit/test_placement.py | 15,495 | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djorgification.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Djang... | 34.125 | 78 | 0.690476 | [
"MIT"
] | sendsent/djorgification | manage.py | 546 | Python |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as AddressProvider
class Provider(AddressProvider):
building_number_formats = ('###', '##', '#')
street_name_formats = ('{{street_prefix}}{{street_suffix}}', )
street_address_formats = ('{{street_name}} {{building_number}}'... | 51.567568 | 80 | 0.599581 | [
"BSD-3-Clause"
] | AMuratTuran/mkn | oscar/lib/python2.7/site-packages/faker/providers/address/sv_SE/__init__.py | 5,828 | Python |
from aioanticaptcha.antinetworking import *
import asyncio
class geetestProxyon(antiNetworking):
js_api_domain = ""
gt = ""
challenge = ""
geetest_lib = ""
async def solve_and_return_solution(self):
if (
await self.create_task(
{
"clientKey... | 30.423729 | 72 | 0.494708 | [
"MIT"
] | andrersp/aioanticaptcha | aioanticaptcha/geetestproxyon.py | 1,795 | Python |
# coding: utf-8
# Copyright (c) 2016, 2022, 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... | 35.495614 | 245 | 0.66922 | [
"Apache-2.0",
"BSD-3-Clause"
] | LaudateCorpus1/oci-python-sdk | src/oci/devops/models/create_deployment_details.py | 8,093 | Python |
import song_generator
from markov_gen import markov_generator
import os, json
nino_dir = '/'.join(os.path.dirname(os.path.realpath(__file__)).split('/')[:-1])
import generator
generator.set_dir_write_note(nino_dir + '/trainer/generated_notes')
def gen_kwargs():
kwargs = {
#What the general scale for t... | 37.588235 | 177 | 0.667337 | [
"MIT"
] | NinoDoko/nino_pianino | ninopianino/markov_trainer.py | 4,473 | Python |
"""
Main agent for DQN
"""
import math
import random
import shutil
import gym
import torch
from tensorboardX import SummaryWriter
from torch.backends import cudnn
from tqdm import tqdm
from agents.base import BaseAgent
from graphs.losses.huber_loss import HuberLoss
from graphs.models.dqn import DQN
from utils.env_uti... | 37.30315 | 134 | 0.629868 | [
"MIT"
] | Cheng-XJTU/Pytorch-Project-Template | agents/dqn.py | 9,475 | Python |
a = [1, 1]
for i in range(10):
a.append(a[-1] + a[-2])
print a
| 10.714286 | 28 | 0.44 | [
"MIT"
] | amiraliakbari/sharif-mabani-python | by-session/ta-921/j5/list7.py | 75 | Python |
# Copyright (c) 2013, RC and contributors
# For license information, please see license.txt
import frappe
from frappe import _
def execute(filters=None):
columns = get_columns()
data = get_data(filters)
return columns, data
def get_columns():
return [
{
"fieldname": "po_number",
"fieldtype": "Data",
"... | 26.580247 | 103 | 0.640502 | [
"MIT"
] | Ehtasham-Muzaffar/turk | turk/turk/report/pending_order_detail/pending_order_detail.py | 2,153 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import string
from telethon import events
from telethon.utils import add_surrogate
from telethon.tl.types import Messag... | 31.464646 | 88 | 0.579775 | [
"MIT"
] | Abhiramabr/weaponx | userbot/plugins/new.py | 3,119 | Python |
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from accounts.models import BookingAgent
class Station(models.Model):
name=models.CharField(max_length=30)
def __str__(self):
return self.name
# Create your models here.
class Train(models.Model):
... | 30.559322 | 118 | 0.659641 | [
"MIT"
] | shobhit907/reserway | reserway/bookings/models.py | 5,409 | Python |
# Copyright (c) 2020, NVIDIA CORPORATION.
#
# 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... | 28.696581 | 77 | 0.586746 | [
"Apache-2.0"
] | Chetank99/cuml | python/cuml/dask/preprocessing/label.py | 6,715 | Python |
#!/usr/bin/env python
#
# Copyright (C) 2019 The Android Open Source Project
#
# 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... | 32.962963 | 80 | 0.705243 | [
"MIT"
] | FabriSC/Alioth-SC | tools/check_target_files_vintf.py | 8,010 | Python |
# coding: utf-8
import re
from sqlalchemy import BigInteger
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import DDL
from sqlalchemy import DefaultClause
from sqlalchemy import event
from sqlalchemy import exc
from sqlalchemy import ForeignKey
from sqlalchemy import Index
from sqlalche... | 35.085538 | 79 | 0.487647 | [
"MIT"
] | AngelLiang/hacking-sqlalchemy | test/dialect/mysql/test_reflection.py | 39,787 | Python |
"""
Django settings for myproject project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
... | 24.993197 | 91 | 0.685084 | [
"BSD-2-Clause"
] | panipp/cs459_2018 | myproject/myproject/settings.py | 3,674 | Python |
from __future__ import annotations
import operator
import re
import sys
import types
from enum import Enum
from typing import TYPE_CHECKING, Optional, List, Union, Iterable, Type, Tuple
from olo.expression import UnaryExpression, BinaryExpression, Expression
from olo.funcs import DISTINCT, Function
if TYPE_CHECKING:... | 32.464338 | 120 | 0.584092 | [
"Apache-2.0"
] | kadaliao/olo | olo/query.py | 22,303 | Python |
# 6. Больше числа п. В программе напишите функцию, которая принимает два
# аргумента: список и число п. Допустим, что список содержит числа. Функция
# должна показать все числа в списке, которые больше п.
import random
def main():
list_num = [random.randint(0, 100) for i in range(20)]
print(list_num)
n = ... | 28.75 | 80 | 0.650725 | [
"MIT"
] | SergeHall/Tony-Gaddis-Python-4th | chapter_07/06_larger_than_n.py | 848 | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "snippets_java.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| 23.272727 | 77 | 0.777344 | [
"MIT"
] | edilio/snippets-javaos | snippets_java/manage.py | 256 | Python |
import ast
import math
import copy
with open('input.txt', 'r') as f:
lines = f.readlines()
lines = [line[:-1] for line in lines]
lines = [ast.literal_eval(line) for line in lines]
def reduce(num):
explodeCriteriaMet = True
splitCriteriaMet = True
while explodeCriteriaMet or splitCriteriaMet:
... | 29.089474 | 123 | 0.486159 | [
"MIT"
] | StrangeGirlMurph/Coding-Projects | 07-AdventOfCode2021/18/day-18.py | 5,527 | Python |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import unittest
import code
class TestDay01(unittest.TestCase):
# Part 01
def test_example01(self):
expense_report = [1721, 299]
expected = 514579
result = code.part01(expense_report)
self.assertEqual(result, expected)
# Do... | 23.264706 | 44 | 0.635904 | [
"MIT"
] | mr-bigbang/advent-of-code | 2020/01/test.py | 791 | Python |
from rcrs_core.commands.Command import Command
from rcrs_core.worldmodel.entityID import EntityID
from rcrs_core.connection import URN
from rcrs_core.connection import RCRSProto_pb2
class AKTell(Command):
def __init__(self, agent_id: EntityID, time: int, message: str) -> None:
super().__init__()
... | 35.478261 | 92 | 0.708333 | [
"BSD-3-Clause"
] | roborescue/rcrs-core-python | rcrs_core/commands/AKTell.py | 816 | Python |
import sys
import cj_function_lib as cj
import init_file as variables
import mdbtools as mdt
#print variables.ProjMDB
#print variables.QSWAT_MDB
wwqrng = cj.extract_table_from_mdb(variables.QSWAT_MDB, 'wwqrng', variables.path + "\\wwqrng.tmp~")
wwq_defaults={}
for record in wwqrng: # Getting a list of parameter n... | 27.068966 | 99 | 0.719745 | [
"MIT"
] | VUB-HYDR/2018_Chawanda_etal | workflow_lib/wwq_dbase.py | 785 | Python |
from rdkit import Chem
from AnalysisModule.routines.util import load_pkl
# logit_result = yaml_fileread("../logistic.yml")
logit_result = load_pkl("../clf3d/logistic.pkl")
"""
epg-string --> maxscore
--> [(f, s)] --> xx, yy, zz, [(x, y, d)] --> refcode, amine
"""
from rdkit.Chem import rdDepictor
from r... | 33.390625 | 203 | 0.621432 | [
"MIT"
] | qai222/ATMOxide | Revision/vis3d/prepare.py | 2,137 | Python |
#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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | 31.241379 | 76 | 0.743929 | [
"Apache-2.0"
] | BachiLi/graphics | tensorflow_graphics/version.py | 906 | Python |
"Plugin registration"
from pylint.lint import PyLinter
from .checkers import register_checkers
from .suppression import suppress_warnings
def register(linter: PyLinter) -> None:
"Register the plugin"
register_checkers(linter)
suppress_warnings(linter)
| 22.25 | 42 | 0.790262 | [
"BSD-3-Clause"
] | troyjfarrell/pylint_django_translations | pylint_django_translations/plugin.py | 267 | Python |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from __future__ import division
import copy
from fnmatch import translate
from math import isinf, isnan
from os.path import isfile
from re import compile
import requests
from prometheus_client.samples im... | 47.554054 | 120 | 0.627327 | [
"BSD-3-Clause"
] | DingGGu/integrations-core | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | 56,304 | Python |
import seq_db
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
engine = create_engine('mysql+pymysql://ppliu:some_pass@sauron.ucsd.edu/test')
seq_db.Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
session = Session()
"""
try:
s = seq_db.CLIPSeq()
s.sample_name... | 20.825 | 78 | 0.684274 | [
"MIT"
] | YeoLab/gscripts | gscripts/expr_db/test_seqdb.py | 833 | Python |
# Copyright 2017 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 38.611111 | 80 | 0.699356 | [
"Apache-2.0"
] | ios-bazel-users/xctestrunner | simulator_control/simulator_util.py | 26,410 | Python |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter # useful for `logit` scale
# Fixing random state for reproducibility
np.random.seed(19680801)
# make up some data in the interval ]0, 1[
y = np.random.normal(loc=0.5, scale=0.4, size=1000)
y = y[(y > 0) & (y < 1)]
y.sort(... | 22.672727 | 78 | 0.700882 | [
"MIT"
] | Henrynaut/Py622 | logAxes.py | 1,247 | Python |
# The MIT License (MIT)
#
# Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
#
# 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 ... | 40.23494 | 91 | 0.636473 | [
"MIT"
] | rhthomas/Adafruit_CircuitPython_NRF24L01 | adafruit_bus_device/i2c_device.py | 6,679 | Python |
# Solution of;
# Project Euler Problem 564: Maximal polygons
# https://projecteuler.net/problem=564
#
# A line segment of length $2n-3$ is randomly split into $n$ segments of
# integer length ($n \ge 3$). In the sequence given by this split, the
# segments are then used as consecutive sides of a convex $n$-polygon, ... | 44.416667 | 79 | 0.68793 | [
"MIT"
] | lcsm29/project-euler | py/py_0564_maximal_polygons.py | 1,599 | Python |
# Copyright Red Hat, 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... | 38.691358 | 79 | 0.674537 | [
"Apache-2.0"
] | MScienceLLC/python-mscachetclient | contrib/example.py | 3,134 | Python |
import itertools
import json
import logging
import time
from typing import Optional, Union, Set, List
import click
from lib.amazon import get_current_key, release_for, get_releases, get_events_file, save_event_file
from lib.env import Config
from lib.instance import Instance
from lib.releases import Hash, Release
lo... | 32.582609 | 108 | 0.622098 | [
"BSD-2-Clause"
] | compiler-explorer/compiler-explorer-image | bin/lib/ce_utils.py | 3,747 | Python |
a = int(input('Digite um número para saber sua tabuada :'))
n1 = a*1
n2 = a*2
n3 = a*3
n4 = a*4
n5 = a*5
n6 = a*6
n7 = a*7
n8 = a*8
n9 = a*9
n10 = a*10
print('A sua tabuada é')
print('{} x 1 = {}'.format(a, n1))
print('{} x 2 = {}'.format(a, n2))
print('{} x 3 = {}'.format(a, n3))
print('{} x 4 = {}'.format(a, n4))
pri... | 24 | 59 | 0.498106 | [
"MIT"
] | emerfelippini/Curso_em_video-Aulas_Python | ex009a.py | 530 | Python |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from profiles.models import Developer, Provider
class DeveloperInline(admin.StackedInline):
model = Developer
can_delete = False
verbose_name_plural = 'Developer'
fk_name = 'use... | 26.096774 | 78 | 0.74042 | [
"Apache-2.0"
] | pacslab/ChainFaaS | ServerlessController/profiles/admin.py | 809 | Python |
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver import Firefox, Chrome, PhantomJS
... | 31.58982 | 99 | 0.660696 | [
"Apache-2.0"
] | yoonseo0917/PKUAutoSubmit | main.py | 11,423 | Python |
#!/usr/bin/python
# Copyright (c) 2017, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | 33.241803 | 120 | 0.631365 | [
"Apache-2.0"
] | hanielburton/oci-ansible-collection | plugins/modules/oci_identity_mfa_totp_device_facts.py | 8,111 | Python |
from django.views.generic.base import TemplateResponseMixin, View
from django.http import HttpResponseRedirect
from django.forms.formsets import formset_factory
from django.forms.models import modelformset_factory, inlineformset_factory
from django.views.generic.detail import SingleObjectMixin, SingleObjectTemplateResp... | 31.898734 | 102 | 0.661111 | [
"MIT"
] | hovel/django-extra-views | extra_views/formsets.py | 7,560 | Python |
from __future__ import unicode_literals
from flask import Flask,render_template,url_for,request
from text_summarization import text_summarizer
import time
import spacy
nlp = spacy.load('en_core_web_sm')
app = Flask(__name__)
# Web Scraping Pkg
from bs4 import BeautifulSoup
# from urllib.request import urlo... | 31.793651 | 182 | 0.751872 | [
"MIT"
] | ramachandra742/Text-Summarization-projects | Automatic extractive Text Summarization using RoBERTa/Deploy Flask app/app.py | 2,003 | Python |
import os
import sys
import time
import shutil
import random
import subprocess
from itertools import starmap
from tempfile import mkdtemp, NamedTemporaryFile
from .. import current, FlowSpec
from ..metaflow_config import DATATOOLS_S3ROOT
from ..util import is_stringish,\
to_bytes,\
... | 35.472136 | 86 | 0.514728 | [
"Apache-2.0"
] | anthonypreza/metaflow | metaflow/datatools/s3.py | 22,915 | Python |
#© 2017-2020, ETH Zurich, D-INFK, lubu@inf.ethz.ch
from rpcudp.protocol import RPCProtocol
from twisted.internet import reactor
from talosstorage.checks import QueryToken
from talosstorage.chunkdata import CloudChunk
class RPCServer(RPCProtocol):
# Any methods starting with "rpc_" are available to clients.
... | 36.6 | 125 | 0.726776 | [
"Apache-2.0"
] | chunchuan-wang/droplet-engine | talosblockchain/global_tests/test_udprpc_server.py | 733 | Python |
import datetime
import os
import re
from peewee import *
from playhouse.reflection import *
from .base import IS_SQLITE_OLD
from .base import ModelTestCase
from .base import TestModel
from .base import db
from .base import requires_models
from .base import requires_sqlite
from .base import skip_if
from .base_models i... | 35.283557 | 79 | 0.567169 | [
"MIT"
] | Abhishek5101/peewee | tests/reflection.py | 21,029 | Python |
#!/usr/bin/env python
import datetime
import logging
import os
import re
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# https://www2.ed.gov/about/offices/list/oig/areports.html
# Oldest report: 1995
# options:
# standard since/year options for a year range to f... | 36.734513 | 140 | 0.687907 | [
"CC0-1.0"
] | crdunwel/inspectors-general | inspectors/education.py | 8,302 | Python |
import os
from io import StringIO
from pathlib import Path
from quom import Quom
from quom.__main__ import main
FILE_MAIN_HPP = """
int foo = 3;
int foo();
"""
FILE_MAIN_CPP = """
int foo() { return 42; }
"""
RESULT = """
int foo = 3;
int foo();
int foo() { return 42; }
"""
def test_source_directory(fs):
o... | 23.111111 | 85 | 0.618132 | [
"MIT"
] | Chaoses-Ib/quom | tests/test_quom/test_source_directory.py | 1,456 | Python |
from combat import Combat, RecursiveCombat
with open("test_input.txt") as f:
game = Combat.parse_from_file(f)
f.seek(0)
recursive_game = RecursiveCombat.parse_from_file(f)
# 1st round
round_1 = game[1]
assert round_1.player_1==[2, 6, 3, 1, 9, 5]
assert round_1.player_2==[8, 4, 7, 10]
# 28th round
round_... | 18.326531 | 55 | 0.699332 | [
"MIT"
] | DallogFheir/aoc-2020 | day-22/test.py | 898 | Python |
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Replaces GN files in tree with files from here that
make the build use system libraries.
"""
from __future__ import print_function... | 31.5 | 72 | 0.687698 | [
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Cela-Inc/WebARonARCore | build/linux/unbundle/replace_gn_files.py | 2,520 | Python |
from random import choice, randint, sample, shuffle
from ga4stpg import graph
from ga4stpg.edgeset import EdgeSet
from ga4stpg.graph import UGraph
from ga4stpg.graph.disjointsets import DisjointSets
from ga4stpg.graph.priorityqueue import PriorityQueue
class MutatitionReplaceByLowerEdge:
def __init__(s... | 32.480392 | 115 | 0.55086 | [
"MIT"
] | GiliardGodoi/ppgi-stpg-gpx | ga4stpg/edgeset/mutate.py | 3,313 | Python |
# Lint as: python2, python3
# Copyright 2019 Google 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 req... | 40.895408 | 136 | 0.748487 | [
"Apache-2.0"
] | TimoKerr/tfx | tfx/orchestration/kubeflow/kubeflow_dag_runner.py | 16,031 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from refinery.units.pattern import PatternExtractor
from refinery.units import RefineryCriticalException
from refinery.lib.patterns import wallets
class xtw(PatternExtractor):
"""
Extract Wallets: Extracts anything that looks like a cryptocurrency wallet address.... | 35.137931 | 88 | 0.651619 | [
"BSD-3-Clause"
] | binre/refinery | refinery/units/pattern/xtw.py | 1,019 | Python |
# pylint: disable=missing-class-docstring,missing-module-docstring
# Discord Packages
from discord.ext.commands.errors import CommandError
class NoDM(CommandError):
pass
class NoToken(Exception):
pass
| 17.75 | 66 | 0.784038 | [
"MIT"
] | Roxedus/PoengBott | cogs/utils/my_errors.py | 213 | Python |
# -*- coding: utf-8 -*-
'''
feature: v1, 2, 3, 4, 10, 11
feature: v1, 2, 3, 4, 11, 13, 14, 17, 18, 19, 22, 23
model: v10
'''
import itertools
import json
import gc
import glob
import os
import time
import cv2
import re
import nltk
import torch
import imagehash
import lightgbm as lgb
import xgboost as xgb
import matplot... | 45.611088 | 151 | 0.557434 | [
"MIT"
] | okotaku/pet_finder | code/exp/v18.py | 110,820 | Python |
class NeuralNet():
def __init__(self, game):
pass
def train(self, examples):
"""
This function trains the neural network with examples obtained from
self-play.
Input:
examples: a list of training examples, where each example is of form
... | 30.15 | 80 | 0.554726 | [
"Apache-2.0"
] | MaxU11/playground | pommerman/NN/neural_net.py | 1,206 | Python |
"""
File name: utils
Author: rameshpr
Date: 11/5/18
"""
import numpy as np
from ctypes import *
from typing import List, Tuple
import cv2
from pyyolo.darknet import c_array, IMAGE, METADATA, predict_image, get_network_boxes, \
do_nms_obj, do_nms_sort, free_image, free_detections, ndarray_image
import ... | 29.148936 | 130 | 0.652798 | [
"Apache-2.0"
] | isarandi/pyyolo | pyyolo/utils.py | 4,110 | Python |
# coding: utf-8
"""
Cloudsmith API
The API to the Cloudsmith Service
OpenAPI spec version: v1
Contact: support@cloudsmith.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import cloudsmith_api
f... | 18.555556 | 68 | 0.691018 | [
"Apache-2.0"
] | cloudsmith-io/cloudsmith-api | bindings/python/src/test/test_rates_api.py | 835 | Python |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the :mod:`colour.recovery` module.
"""
import numpy as np
import unittest
from colour.colorimetry import (
MSDS_CMFS,
SDS_ILLUMINANTS,
SpectralShape,
reshape_msds,
reshape_sd,
sd_to_XYZ_integration,
)
from colour.rec... | 28.976471 | 78 | 0.568006 | [
"BSD-3-Clause"
] | JGoldstone/colour | colour/recovery/tests/test__init__.py | 2,463 | Python |
#!/usr/bin/env python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory... | 31.553957 | 98 | 0.582991 | [
"MIT"
] | binariumpay/binarium | contrib/seeds/generate-seeds.py | 4,386 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.