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 |
|---|---|---|---|---|---|---|---|---|
from cardboard.cards.core import cards, card
| 22.5 | 44 | 0.822222 | [
"MIT"
] | Julian/cardboard | cardboard/cards/__init__.py | 45 | Python |
"""
Listas
Listas em Python funcionam como vetores/matrizes (arrays) em outras linguagens, com a diferença
de serem DINÂMICO e também de podermos colocar QUALQUER tipo de dado.
Linguagens C/Java: Arrays
- Possuem tamanho e tipo de dado fixo;
Ou seja, nestas linguagens se você criar um array do tipo int e com tamanh... | 25.703812 | 116 | 0.712949 | [
"MIT"
] | vdonoladev/aprendendo-programacao | Python/Programação_em_Python_Essencial/5- Coleções/listas.py | 8,882 | Python |
import sys
import numpy as np
import cv2
def overlay(img, glasses, pos):
sx = pos[0]
ex = pos[0] + glasses.shape[1]
sy = pos[1]
ey = pos[1] + glasses.shape[0]
if sx < 0 or sy < 0 or ex > img.shape[1] or ey > img.shape[0]:
return
img1 = img[sy:ey, sx:ex]
img2 = glasses[:, :, 0:3]... | 25.666667 | 106 | 0.566401 | [
"MIT"
] | FLY-CODE77/opencv | project/snowapp/snow.py | 2,387 | Python |
import pandas as pd
from tidyframe import nvl
def test_nvl_series():
test_list = [0, 1, None, pd.np.NaN]
test_series = pd.Series(test_list)
nvl(test_series, 10)
def test_nvl_list():
test_list = [0, 1, None, pd.np.NaN]
nvl(test_list, 10)
def test_nvl_int():
nvl(None, 10)
def test_nvl_str(... | 14.769231 | 39 | 0.643229 | [
"MIT"
] | Jhengsh/tidyframe | tests/test_nvl.py | 384 | Python |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
try:
from builtins import object
from builtins import str
except ImportError:
from __bu... | 31.978495 | 80 | 0.599866 | [
"BSD-3-Clause"
] | 2acoin/2acoin | external/rocksdb/buckifier/targets_builder.py | 2,974 | Python |
# Copyright 2017 Bruno Ribeiro, Mayank Kakodkar, Pedro Savarese
#
# 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 applicabl... | 44.346154 | 104 | 0.580225 | [
"Apache-2.0"
] | PurdueMINDS/MCLV-RBM | py/util/config.py | 5,765 | Python |
# The Core of Toby
from flask import Flask, request, jsonify, g
import os
import logging
from ax.log import trace_error
from ax.connection import DatabaseConnection
from ax.datetime import now
from ax.tools import load_function, get_uuid, decrypt
from ax.exception import InvalidToken
logger = logging.getLogger('werkz... | 30.157143 | 100 | 0.658456 | [
"MIT"
] | axxiao/toby | toby.py | 2,111 | Python |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 40.96281 | 107 | 0.632705 | [
"Apache-2.0"
] | JakobSteixner/google-ads-python | google/ads/googleads/v10/services/services/feed_service/client.py | 19,826 | Python |
# Standard Library
import unittest
# YouTubeTimestampRedditBot
from src.utils.youtube import is_youtube_url_without_timestamp
class Youtube(unittest.TestCase):
def test_is_youtube_url_without_timestamp(self):
dicts = [
# no timestamps
{"input": "https://youtube.com/asdf", "expecte... | 39.172414 | 88 | 0.582746 | [
"MIT"
] | ConorSheehan1/YouTubeTimestampRedditBot | tests/unit/utils/test_youtube.py | 1,136 | Python |
'''
Harness Toolset
Copyright (c) 2015 Rich Kelley
Contact:
@RGKelley5
RK5DEVMAIL[A T]gmail[D O T]com
www.frogstarworldc.com
License: MIT
'''
import threading
import builtins
import sys
from random import randint
from harness.core import framework
from harness.core import threads
from collect... | 20.919786 | 146 | 0.674335 | [
"MIT"
] | Rich5/Harness | harness/core/module.py | 3,912 | Python |
"""
load the dataset example and return the maximum image size, which is used to definite the spike generation network;
images with different size are focused onto the center of the spike generation network;
the generated poisson spikes are recorded and saved for further use.
"""
"""
on 12th November
by xiaoquinNUDT
ve... | 45.909677 | 127 | 0.657532 | [
"BSD-2-Clause"
] | Mary-Shi/Three-SNN-learning-algorithms-in-Brian2 | Spike generation/spike_recorder_focal.py | 7,116 | Python |
# https://repl.it/@thakopian/day-4-2-exercise#main.py
# write a program which will select a random name from a list of names
# name selected will pay for everyone's bill
# cannot use choice() function
# inputs for the names - Angela, Ben, Jenny, Michael, Chloe
# import modules
import random
# set varialbles for in... | 41.295455 | 176 | 0.760044 | [
"MIT"
] | thakopian/100-DAYS-OF-PYTHON-PROJECT | BEGIN/DAY_04/04.1-day-4-2-exercise-solution.py | 1,817 | Python |
# -*- coding: utf-8 -*-
from .expr import *
def_Topic(
Title("Legendre polynomials"),
Section("Particular values"),
Entries(
"9bdf22",
"217521",
"d77f0a",
"9b7f05",
"a17386",
"13f971",
"a7ac51",
"3df748",
"674afa",
"85eebc",
... | 35.141956 | 172 | 0.621095 | [
"MIT"
] | pascalmolin/fungrim | formulas/legendre_polynomial.py | 11,141 | Python |
import asyncio
import time
import pytest
from async_lru import alru_cache
pytestmark = pytest.mark.asyncio
async def test_expiration(check_lru, loop):
@alru_cache(maxsize=4, expiration_time=2, loop=loop)
async def coro(val):
return val
inputs = [1, 2, 3]
coros = [coro(v) for v in inputs]
... | 23.363636 | 66 | 0.658885 | [
"MIT"
] | vera1118/async_lru | tests/test_expiration.py | 771 | Python |
from pathlib import Path
def dir_touch(path_file) -> None:
Path(path_file).mkdir(parents=True, exist_ok=True)
def file_touch(path_file) -> None:
p = Path(path_file)
p.parents[0].mkdir(parents=True, exist_ok=True)
p.touch()
def index_or_default(lst, val, default=-1):
return lst.index(val) if va... | 20.047619 | 54 | 0.703088 | [
"MIT"
] | r3w0p/memeoff | src/tools.py | 421 | Python |
from django.db import models
import os
def get_image_path(instance, filename):
return os.path.join('pics', str(instance.id), filename)
# Create your models here.
class Pets(models.Model):
pet_foto = models.ImageField(upload_to=get_image_path, blank=True, null=True)
DOG = 'C'
CAT = 'G'
... | 30.431818 | 101 | 0.605676 | [
"MIT"
] | JuniorGunner/ConcilBackendTest | src/doghouse/models.py | 1,341 | Python |
# coding: utf-8
"""
TextMagic API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
... | 27.034247 | 119 | 0.558905 | [
"MIT"
] | imissyouso/textmagic-rest-python | TextMagic/models/reopen_chats_bulk_input_object.py | 3,947 | Python |
import os
import unittest
import abc
from funkyvalidate.examples.existing_directory import ExistingDirectory
from funkyvalidate.examples.existing_file import ExistingFile
from funkyvalidate import InterfaceType, meets
form_path = lambda *parts: os.path.abspath(os.path.join(*parts))
test_dir = form_path(__file__, '... | 35.950276 | 94 | 0.716306 | [
"MIT"
] | OaklandPeters/funkyvalidate | funkyvalidate/tests/test_interfaces.py | 6,507 | Python |
# Copyright 2017 VMware, 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 a... | 44.190955 | 78 | 0.690243 | [
"Apache-2.0"
] | yebinama/vmware-nsx | vmware_nsx/services/lbaas/nsx_v3/v2/lb_driver_v2.py | 8,794 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-26 15:51
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('core', '0009_auto_20171126_1058'),
... | 32.381818 | 108 | 0.585065 | [
"MIT"
] | gabrielnaoto/checkapp | check/core/migrations/0010_auto_20171126_1351.py | 1,781 | Python |
A, B, C, D = map(int, input().split())
s1 = set(range(A, B + 1))
s2 = set(range(C, D + 1))
print(len(s1) * len(s2) - len(s1.intersection(s2)))
| 20.714286 | 51 | 0.551724 | [
"MIT"
] | c-yan/yukicoder | yc208/799.py | 145 | Python |
# 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 itertools
import json
import logging
import os
from argparse import Namespace
import numpy as np
from fairseq import metrics, options,... | 40.028953 | 95 | 0.587492 | [
"MIT"
] | 227514/Supervised-Simultaneous-MT | fairseq/tasks/translation.py | 17,973 | Python |
from typing import List, Optional
import scrapy
from scrapy import Item
from jedeschule.items import School
from jedeschule.spiders.school_spider import SchoolSpider
def first_or_none(item: List) -> Optional[str]:
try:
return item[0]
except IndexError:
return None
class BrandenburgSpider(S... | 36.953125 | 113 | 0.556871 | [
"MIT"
] | MartinGer/jedeschule-scraper | jedeschule/spiders/brandenburg.py | 2,365 | Python |
#!/usr/bin/env python
"""Base test classes for API handlers tests."""
# pylint:mode=test
import json
import logging
import os
import threading
import portpicker
import requests
from google.protobuf import json_format
from grr import gui
from grr_api_client.connectors import http_connector
from grr.gui import api_au... | 31.14486 | 79 | 0.722731 | [
"Apache-2.0"
] | nickamon/grr | grr/gui/api_regression_http.py | 6,665 | Python |
#encoding=utf-8
from __future__ import unicode_literals
from django.apps import AppConfig
class CourseConfig(AppConfig):
name = 'course'
verbose_name = u"课程管理"
| 17.1 | 39 | 0.760234 | [
"Apache-2.0"
] | wyftddev/MXOline | apps/course/apps.py | 179 | Python |
from pathlib import Path
import unittest
from saw_client import *
from saw_client.llvm import Contract, array, array_ty, void, i32
class ArraySwapContract(Contract):
def specification(self):
a0 = self.fresh_var(i32, "a0")
a1 = self.fresh_var(i32, "a1")
a = self.alloc(array_ty(2, i32),
... | 27.794118 | 76 | 0.639153 | [
"BSD-3-Clause"
] | GaloisInc/saw-script | saw-remote-api/python/tests/saw/test_llvm_array_swap.py | 945 | Python |
import docker
if __name__ == '__main__':
client = docker.from_env()
i = -1
name = 'evtd_'
while(True):
try:
i += 1
container = client.containers.get('{}{}'.format(name,i))
print(container.logs(tail=1))
# container.stop()
# container.re... | 26.111111 | 68 | 0.485106 | [
"MIT"
] | Laighno/evt | nettests/monitor.py | 470 | Python |
import os
from pathlib import Path
from typing import Callable, Optional, Tuple, Union
import torchvision
from torch import nn
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
from torchvision.datasets import STL10, ImageFolder
def build_custom_pipeline():
"""Builds augmentatio... | 31.492908 | 99 | 0.596329 | [
"MIT"
] | fariasfc/solo-learn | solo/utils/classification_dataloader.py | 8,881 | Python |
import collections
class Solution:
"""
@param board: a board
@param click: the position
@return: the new board
"""
def updateBoard(self, board, click):
# Write your code here
b = []
for s in board:
temp = []
for c in s:
temp.append(... | 34.794872 | 121 | 0.342668 | [
"MIT"
] | jiadaizhao/LintCode | 1101-1200/1189-Minesweeper/1189-Minesweeper.py | 1,357 | Python |
#!/usr/bin/env python
#
#===- exploded-graph-rewriter.py - ExplodedGraph dump tool -----*- python -*--#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------... | 38.535917 | 79 | 0.522921 | [
"Apache-2.0"
] | 0xmmalik/clang | utils/analyzer/exploded-graph-rewriter.py | 40,771 | Python |
import numpy as np
from pddlgym.core import get_successor_states, InvalidAction
from pddlgym.inference import check_goal
def get_all_reachable(s, A, env, reach=None):
reach = {} if not reach else reach
reach[s] = {}
for a in A:
try:
succ = get_successor_states(s,
... | 29.625 | 75 | 0.477848 | [
"MIT"
] | GCrispino/vi-pddlgym | mdp.py | 1,896 | Python |
# pylint: disable=invalid-name
# Requires Python 3.6+
# Ref: https://www.sphinx-doc.org/en/master/usage/configuration.html
"""Configuration for the Sphinx documentation generator."""
import sys
from functools import partial
from pathlib import Path
from setuptools_scm import get_version
# -- Path setup ------------... | 33.427119 | 96 | 0.673461 | [
"BSD-3-Clause"
] | JerryKwan/proxy.py | docs/conf.py | 9,865 | Python |
import pyJHTDB
# M1Q4
ii = pyJHTDB.interpolator.spline_interpolator(pyJHTDB.dbinfo.channel5200)
ii.write_coefficients()
# M2Q8
ii = pyJHTDB.interpolator.spline_interpolator(pyJHTDB.dbinfo.channel5200, m = 2, n = 3)
ii.write_coefficients()
# M2Q14
ii = pyJHTDB.interpolator.spline_interpolator(pyJHTDB.dbinfo.channel5... | 22.75 | 87 | 0.785714 | [
"Apache-2.0"
] | idies/pyJHTDB | examples/get_channel_spline_coefficients.py | 364 | Python |
from flask import Flask, request, jsonify, make_response
from flask_sqlalchemy import SQLAlchemy
import uuid
from werkzeug.security import generate_password_hash, check_password_hash
import jwt
import datetime
from functools import wraps
from flask_mail import Mail, Message
import bcrypt
import re
from validate_email i... | 34.849558 | 178 | 0.675047 | [
"MIT"
] | lucas-almeida-silva/gama-sports | server/API.py | 11,841 | Python |
from discord.ext import commands
import discord
class EphemeralCounterBot(commands.Bot):
def __init__(self):
super().__init__()
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
# Define a simple View that gives us a counter button
clas... | 39.520833 | 89 | 0.702688 | [
"MIT"
] | NextChai/discord.py | examples/views/ephemeral.py | 1,897 | Python |
"""Test the creation of all inventories."""
import stewi
from stewi.globals import paths, STEWI_VERSION, config
year = 2018
def test_inventory_generation():
# Create new local path
paths.local_path = paths.local_path + "_" + STEWI_VERSION
error_list = []
for inventory in config()['databases']:
... | 24.612903 | 85 | 0.63827 | [
"CC0-1.0"
] | matthewlchambers/standardizedinventories | tests/test_inventory_generation.py | 763 | Python |
# define a function, which accepts 2 arguments
def cheese_and_crackers(cheese_count, boxes_of_crackers):
# %d is for digit
print "You have %d cheeses!" % cheese_count
print "You have %d boxes of crackers!" % boxes_of_crackers
print "Man that's enough for a party!"
# go to a new line after the end
print "Get a bla... | 27.178947 | 92 | 0.717661 | [
"MIT"
] | python-practice/lpthw | ex19/ex19-sd.py | 2,582 | Python |
from setuptools import setup, find_packages
setup(
name="squirrel-and-friends",
version="0.1",
packages=find_packages(),
install_requires=[
"emoji==0.5.4", "nltk==3.5", "pyspellchecker==0.5.4",
"numerizer==0.1.5", "lightgbm==2.3.1",
"albumentations==0.5.2", "opencv-python==4.5.1... | 32.722222 | 62 | 0.568761 | [
"MIT"
] | JacobXPX/squirrel-and-friends | setup.py | 589 | Python |
#!/usr/bin/env python
import os
import sys
import warnings
if __name__ == "__main__":
here = os.path.dirname(__file__)
there = os.path.join(here, '..')
there = os.path.abspath(there)
sys.path.insert(0, there)
print "NOTE Using jingo_offline_compressor from %s" % there
os.environ.setdefault("DJ... | 26.111111 | 71 | 0.725532 | [
"BSD-3-Clause"
] | peterbe/django-jingo-offline-compressor | example/manage.py | 470 | Python |
# Copyright (c) 2016, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of con... | 39.842027 | 79 | 0.625533 | [
"BSD-3-Clause"
] | AbinMM/PYNQ | pynq/lib/logictools/tests/test_fsm_generator.py | 26,734 | Python |
# Bit Manipulation
# Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case letters. If no such two words exist, return 0.
#
# Example 1:
#
# Input: ["abcw","baz","foo","bar","x... | 29.513514 | 244 | 0.581502 | [
"MIT"
] | gesuwen/Algorithms | LeetCode/318 Maximum Product of Word Lengths.py | 1,092 | Python |
from flask_mail import Message
from flask import render_template
from . import mail
subject_pref = 'Pitches'
sender_email = "ruthjmimo@gmail.com"
def mail_message(subject,template,to,**kwargs):
sender_email = 'ruthjmimo@gmail.com'
email = Message(subject, sender=sender_email, recipients=[to])
email.body=... | 31.928571 | 66 | 0.740492 | [
"MIT"
] | ruthjelimo/Pitch-app | app/email.py | 447 | Python |
"""Test mysensors MQTT gateway with unittest."""
import os
import tempfile
import time
from unittest import TestCase, main, mock
from mysensors import ChildSensor, Sensor
from mysensors.gateway_mqtt import MQTTGateway
class TestMQTTGateway(TestCase):
"""Test the MQTT Gateway."""
def setUp(self):
"""... | 39.16 | 79 | 0.598698 | [
"MIT"
] | jslove/pymysensors | tests/test_gateway_mqtt.py | 7,832 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.20.7
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
fr... | 34.960526 | 169 | 0.641325 | [
"Apache-2.0"
] | mariusgheorghies/python | kubernetes/client/models/io_cert_manager_acme_v1_challenge_spec_solver_dns01_cloudflare_api_token_secret_ref.py | 5,314 | Python |
#
# These are settings for Heroku Production Environment
#
from .common import *
import dj_database_url
# We don't want any debug warnings giving
# away unnecessary information to attackers
DEBUG = False
# We grab the secret key from the environment because it is
# our production key and no can know it
SECRET_KE... | 23.204082 | 73 | 0.761653 | [
"MIT"
] | JumboCode/YEF | backend/src/settings/prod.py | 1,137 | Python |
def metade(x=0):
res = x / 2
return res
def dobro(x=0):
res = 2 * x
return res
def aumentar(x=0, y=0):
res = x * (1 + y / 100)
return res
def reduzir(x=0, y=0):
res = x * (1 - y / 100)
return res
def moeda(x=0, m='R$'):
res = f'{m}{x:.2f}'.replace('.', ',')
return res
| 13.208333 | 41 | 0.473186 | [
"MIT"
] | bernardombraga/Solucoes-exercicios-cursos-gratuitos | Curso-em-video-Python3-mundo3/ex108/moeda.py | 317 | Python |
"""Highlevel API for managing PRs on Github"""
import abc
import logging
from copy import copy
from enum import Enum
from typing import Any, Dict, List, Optional
import gidgethub
import gidgethub.aiohttp
import aiohttp
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
#: State for Github Issue... | 35.078431 | 85 | 0.55981 | [
"MIT"
] | erictleung/bioconda-utils | bioconda_utils/githubhandler.py | 7,156 | Python |
import re
from ._video import Video
from ._channel import Channel
from ._playlist import Playlist
from ._videobulk import _VideoBulk
from ._channelbulk import _ChannelBulk
from ._playlistbulk import _PlaylistBulk
from ._auxiliary import _parser, _filter, _src
class Search:
def __init__(self):
pass
@... | 40.435897 | 107 | 0.640457 | [
"MIT"
] | SlumberDemon/AioTube | src/_query.py | 3,154 | Python |
#-*- coding: utf-8 -*-
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from climatespider.items import ClimatespiderItem
from scrapy.selector import Selector
from dateutil.parser import parse
import re
import datetime
from scrapy.exceptions import CloseSpider
def getyester... | 66.274648 | 140 | 0.568165 | [
"Apache-2.0"
] | burnman108/climateSpider | climatespider/climatespider/spiders/AO_wugspider.py | 9,411 | Python |
"""
VRChat API Documentation
The version of the OpenAPI document: 1.6.8
Contact: me@ruby.js.org
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from vrchatapi.api_client import ApiClient, Endpoint as _Endpoint
from vrchatapi.model_utils import ( # ... | 36.510513 | 201 | 0.450378 | [
"MIT"
] | vrchatapi/vrchatapi-python | vrchatapi/api/worlds_api.py | 74,664 | Python |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... | 48.482227 | 95 | 0.641951 | [
"Apache-2.0"
] | Aryan-Abhishek/oppia | scripts/linters/js_ts_linter_test.py | 40,919 | Python |
# Load both the 2016 and 2017 sheets by name
all_survey_data = pd.read_excel("fcc_survey.xlsx", sheet_name = ['2016', '2017'])
# View the data type of all_survey_data
print(type(all_survey_data))
'''
<script.py> output:
<class 'collections.OrderedDict'>
'''
# Load all sheets in the Excel file
all_survey_data = ... | 24.210526 | 134 | 0.691304 | [
"MIT"
] | Ali-Parandeh/Data_Science_Playground | Datacamp Assignments/Data Engineer Track/2. Streamlined Data Ingestion with pandas/11_select_multiple_sheets.py | 920 | Python |
from custom_src.NodeInstance import NodeInstance
from custom_src.Node import Node
# USEFUL
# self.input(index) <- access to input data
# self.outputs[index].set_val(val) <- set output data port value
# self.main_widget <- access to main widget
# self.exec_output(index) ... | 34.482143 | 97 | 0.671673 | [
"MIT"
] | Shirazbello/Pyscriptining | packages/std/nodes/std___Or0/std___Or0___METACODE.py | 1,931 | Python |
"""
Test that we keep references to failinfo as needed.
"""
import fiu
# Object we'll use for failinfo
finfo = [1, 2, 3]
fiu.enable('p1', failinfo = finfo)
assert fiu.fail('p1')
assert fiu.failinfo('p1') is finfo
finfo_id = id(finfo)
del finfo
assert fiu.failinfo('p1') == [1, 2, 3]
assert id(fiu.failinfo('p1')) ... | 15.136364 | 51 | 0.666667 | [
"MIT"
] | lwllvyb/libfiu-hack | tests/test-failinfo_refcount.py | 333 | Python |
"""
ASGI config for logkit project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTIN... | 22.882353 | 78 | 0.784062 | [
"Apache-2.0"
] | zhaheyan/logkit | logkit/logkit/asgi.py | 389 | Python |
import sys
from os import listdir
from os.path import isfile, join, dirname, realpath
import struct
import gzip
def list_dir(d):
return [f for f in listdir(d) if isfile(join(d, f))]
def store(p, file):
try:
output_file = open(p, "w", encoding="utf-8", errors="xmlcharrefreplace")
output_file.... | 23.089286 | 80 | 0.595514 | [
"Unlicense"
] | ennioVisco/topocity | tools/batchrun/storage.py | 1,293 | Python |
from django.conf import settings
from django.conf.urls import include
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('Blog.urls')),
path('tinymce/', include('tinymce.urls')),
]
urlp... | 28.928571 | 89 | 0.750617 | [
"MIT"
] | collins-hue/Django-Blog-Comment | BlogComment/BlogComment/urls.py | 405 | Python |
from math import sqrt
from PrefrontalCortex import Impulse
from Decisions import Decisions
from Decision import Decision
import random as rand
# The job of the Neo-cortex is to evaluate, think, and consider.
# It is a slow brain part, but a highly important one, it's job is to perform tasks for the prefrontal cortex ... | 37.378531 | 130 | 0.587666 | [
"ISC"
] | Sebastianchr22/GDMC-master | stock-filters/NeoCortex.py | 6,616 | Python |
#!/usr/bin/env python
# coding: utf-8
import random
import numpy as np
import sys, os
import pandas as pd
import torch
from torchsummary import summary
from torchtext import data
import torch.nn as nn
import torch.utils.data
from torch.utils.data import Dataset, TensorDataset,DataLoader, RandomSampler
from torch.util... | 45.982609 | 118 | 0.703101 | [
"Apache-2.0"
] | suhasgupta791/mids-w251-final-project | utils/utils.py | 5,288 | Python |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import codecs
import os
import re
import tarfile
import shutil
import tempfile
import hashlib
import glob
import platform
... | 36.542435 | 79 | 0.624735 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | AndrewGaspar/spack | lib/spack/spack/binary_distribution.py | 39,612 | Python |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 tianyou pan <sherry0429 at SOAPython>
"""
from engine import ServiceEngineModule
from template import ServiceParamTemplate
__all__ = ['ServiceEngineModule', 'ServiceParamTemplate'] | 25.444444 | 57 | 0.759825 | [
"Apache-2.0"
] | sherry0429/SOAForPython | toBusUsege/service_module/service_core/__init__.py | 229 | Python |
try:
from rgbmatrix import graphics
except ImportError:
from RGBMatrixEmulator import graphics
class Color:
def __init__(self, color_json):
self.json = color_json
def color(self, keypath):
return self.__find_at_keypath(keypath)
def graphics_color(self, keypath):
color = s... | 24.692308 | 65 | 0.61215 | [
"MIT"
] | ajbowler/mlb-led-scoreboard | data/config/color.py | 642 | Python |
from typing import List
from lxml import etree
from cssselect import GenericTranslator
from kloppy.domain import Event, EventType
class CSSPatternMatcher:
def __init__(self, pattern: str):
self.expression = GenericTranslator().css_to_xpath([pattern])
def match(self, events: List[Event]) -> List[Lis... | 32.459459 | 69 | 0.507077 | [
"BSD-3-Clause"
] | JanVanHaaren/kloppy | kloppy/domain/services/matchers/css.py | 1,201 | Python |
'''
Created on Nov 16, 2021
@author: mballance
'''
from mkdv.tools.hdl.hdl_tool_config import HdlToolConfig
import os
class HdlTool(object):
def config(self, cfg : HdlToolConfig):
raise NotImplementedError("config not implemented for %s" % str(type(self)))
def setup(self, cfg : HdlToolConfig... | 28.421053 | 84 | 0.67963 | [
"Apache-2.0"
] | fvutils/pymkdv | src/mkdv/tools/hdl/hdl_tool.py | 540 | Python |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 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 using named arguments for RPCs."""
from test_framework.test_framework import GuldenTestFramework
... | 34.514286 | 101 | 0.679636 | [
"MIT"
] | Gulden/gulden-official | test/functional/rpc_named_arguments.py | 1,208 | Python |
# Copyright 2020 Maruan Al-Shedivat. 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 appli... | 38.068182 | 80 | 0.643881 | [
"Apache-2.0"
] | alshedivat/cen | cen/regularizers/entropy.py | 3,350 | Python |
from django.contrib import admin
# from .models import related models
from .models import CarMake, CarModel
# Register your models here.
# CarModelInline class
class CarModelInline(admin.StackedInline):
model = CarModel.car_makes.through
extra = 3
# CarModelAdmin class
class CarModelAdmin(admin.ModelAdmin):
... | 26 | 44 | 0.77592 | [
"Apache-2.0"
] | RafaelJon/agfzb-CloudAppDevelopment_Capstone | server/djangoapp/admin.py | 598 | Python |
class Student:
def __init__(self,name):
self.name = name
self.exp = 0
self.lesson = 0
self.AddEXP(10)
def Hello(self):
print('Hello World! My name is {}!'.format(self.name))
def Coding(self):
print('{}: Currently coding...'.format(self.name))
self.exp += 5
self.lesson += 1
def Sho... | 20.804348 | 58 | 0.61233 | [
"MIT"
] | GemmyTheGeek/GemmyTheNerd | GemmyTheNerd/studentclass.py | 957 | Python |
import os
# toolchains options
ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK... | 27.435115 | 152 | 0.571508 | [
"Apache-2.0"
] | LoveCeline/rt-thread | bsp/stm32/libraries/templates/stm32f10x/rtconfig.py | 3,594 | Python |
# pylint: disable=wildcard-import, unused-wildcard-import
"""Model store which handles pretrained models from both
mxnet.gluon.model_zoo.vision and gluoncv.models
"""
from mxnet import gluon
from .ssd import *
from .faster_rcnn import *
from .fcn import *
from .pspnet import *
from .cifarresnet import *
from .cifarresn... | 38.918919 | 95 | 0.693287 | [
"Apache-2.0"
] | Ellinier/gluon-cv | gluoncv/model_zoo/model_zoo.py | 4,320 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 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 wallet import RPCs.
Test rescan behavior of importaddress, importpubkey, importprivkey, and
impor... | 46.913043 | 126 | 0.66469 | [
"MIT"
] | 124327288/bitcoin | test/functional/wallet_import_rescan.py | 10,790 | Python |
# pylint: disable=E1101,W0232
import numpy as np
from warnings import warn
import textwrap
from pandas import compat
from pandas.compat import u, lzip
from pandas._libs import lib, algos as libalgos
from pandas.core.dtypes.generic import (
ABCSeries, ABCIndexClass, ABCCategoricalIndex)
from pandas.core.dtypes.mi... | 34.122711 | 79 | 0.576176 | [
"BSD-3-Clause"
] | Adirio/pandas | pandas/core/arrays/categorical.py | 87,593 | Python |
from django.db import models
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from django.shortcuts import redirect
from django.urls import reverse
from django.utils import timezone
import requests
from . import exceptions
class Gateway(models.Model):
label = models.CharFie... | 55.913669 | 190 | 0.702651 | [
"MIT"
] | farahmand-m/django-payir | payir/models.py | 7,772 | Python |
class Car:
def needFuel(self):
pass
def getEngineTemperature(self):
pass
def driveTo(self, destination):
pass | 15.7 | 36 | 0.55414 | [
"MIT"
] | TestowanieAutomatyczneUG/laboratorium-9-Sienkowski99 | src/car.py | 157 | Python |
from setuptools import setup
import mp_sync
setup(
name='mp_sync',
version=mp_sync.__version__,
description='Moon Package for Sync repository(google drive, notion, mongodb(local/web), local file)',
url='https://github.com/hopelife/mp_sync',
author='Moon Jung Sam',
author_email='monblue@snu.ac.k... | 30 | 105 | 0.655556 | [
"MIT"
] | hopelife/mp_sync | setup.py | 666 | Python |
import string
import sbxor
"""
Detect single-character XOR
One of the 60-character strings in this file (4.txt) has been encrypted by single-character XOR.
Find it.
"""
if __name__ == "__main__":
with open("data/4.txt", "r") as data_file:
data = data_file.read().split("\n")
candidates = []
for ... | 26.5 | 96 | 0.6 | [
"MIT"
] | elevenchars/cryptopals | set1/detectsb.py | 795 | Python |
#!/usr/bin/env python
import csv
import os
import argparse
import dateutil.parser
import json
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--dir", type=str, required=True,
help="name of the data directory")
args = parser.parse_args()
return ar... | 27.619048 | 71 | 0.486782 | [
"MIT"
] | florath/jhu2db | jhu2json.py | 1,740 | Python |
import asyncio
from aiotasks import build_manager
loop = asyncio.get_event_loop()
loop.set_debug(True)
manager = build_manager(loop=loop)
@manager.task()
async def task_01(num):
print("Task 01 starting: {}".format(num))
await asyncio.sleep(2, loop=loop)
print("Task 01 stopping")
ret... | 15.472222 | 45 | 0.644524 | [
"BSD-3-Clause"
] | cr0hn/aiotasks | examples_old/memory_backend/basic_wait.py | 557 | Python |
import random
import time
class unit :
def __init__(self, HP, Atk) :
self.HP = HP
self.Atk = Atk
def DoAtk(self, OtherUnit) :
self.DoDmg(self.Atk, OtherUnit)
def DoDmg(self, dmg, OtherUnit) :
OtherUnit.HP-=dmg
class hero(unit) :
def __init__(self, HP, Atk) :
super... | 29.550725 | 64 | 0.518391 | [
"MPL-2.0"
] | ZoneTwelve/CE3058-Network-and-Database-Programming | week-3/HeroAndMonster.py | 2,039 | Python |
"""The tests for hls streams."""
from datetime import timedelta
from unittest.mock import patch
from urllib.parse import urlparse
import av
from homeassistant.components.stream import request_stream
from homeassistant.const import HTTP_NOT_FOUND
from homeassistant.setup import async_setup_component
import homeassista... | 29.616279 | 78 | 0.698469 | [
"Apache-2.0"
] | BoresXP/core | tests/components/stream/test_hls.py | 5,094 | Python |
# -*- coding: utf-8 -*-
## @package pycv_tutorial.color_space
#
# 画像処理: 色空間の変換
# @author tody
# @date 2016/06/27
import cv2
import matplotlib.pyplot as plt
# RGB画像の表示
def showImageRGB(image_file):
image_bgr = cv2.imread(image_file)
image_rgb = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2RGB)
plt... | 19.123711 | 58 | 0.60593 | [
"MIT"
] | OYukiya/PyIntroduction | opencv/pycv_tutorial/color_space.py | 1,941 | Python |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | 34.84375 | 78 | 0.627803 | [
"Apache-2.0"
] | diogocs1/comps | web/addons/stock/__init__.py | 1,115 | Python |
import numpy as np
import tensorflow as tf
from copy import deepcopy
from abc import ABC, abstractmethod
from tensorflow.keras import Model as M
from rls.utils.indexs import OutputNetworkType
from rls.nn.networks import get_visual_network_from_type
from rls.nn.models import get_output_network_from_type
... | 33.975104 | 97 | 0.578163 | [
"Apache-2.0"
] | kiminh/RLs | rls/utils/build_networks.py | 16,408 | Python |
from decimal import Decimal
from django.db import models
from polymorphic.models import PolymorphicModel
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericFo... | 36.657895 | 169 | 0.649103 | [
"MIT"
] | JohnRomanski/django-auction | auction/models/bases.py | 6,965 | Python |
# __init.py
from .home import Home
from .alarm import Alarm
from .light import Light
from .lock import Lock | 18.166667 | 24 | 0.770642 | [
"MIT"
] | abkraynak/smart-home | home/__init__.py | 109 | Python |
import msgpack
import zlib
import numpy as np
import helper_functions as hf
import datetime_helper as dh
def strip_data_by_time(t_data, data, t_min, t_max):
data = np.array([s for s, t in zip(data, t_data) if t >= t_min and t <= t_max])
t_data = np.array([t for t in t_data if t >= t_min and t <= t_max])
return t_da... | 39.461538 | 92 | 0.705653 | [
"MIT"
] | ArthurBernard/quant-reseach | src/example_helper.py | 2,052 | Python |
#!/usr/bin/env python
#
# $Id$
#
# Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Print detailed information about a process.
Author: Giampaolo Rodola' <g.rodola@gmail.com>
"""
import os
... | 33.422222 | 79 | 0.505098 | [
"BSD-3-Clause"
] | hybridlogic/psutil | examples/process_detail.py | 4,512 | Python |
# -*- coding: utf-8 -*-
"""Cisco DNA Center Clients API wrapper.
Copyright (c) 2019-2021 Cisco Systems.
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 limi... | 36.509506 | 108 | 0.614559 | [
"MIT"
] | cisco-en-programmability/dnacentersdk | dnacentersdk/api/v1_3_1/clients.py | 9,602 | Python |
#!/usr/bin/python
"""
Sample program to add SSO options to a Manager/Pinbox.
:Copyright:
Copyright 2014 Lastline, Inc. All Rights Reserved.
Created on: Dec 8, 2014 by Lukyan Hritsko
"""
import requests
import argparse
import ConfigParser
import os.path
import logging
import re
from lxml import etre... | 33.886154 | 93 | 0.579769 | [
"Apache-2.0"
] | YmonOy/lastline_api | examples/add_saml_sso_from_metadata.py | 11,013 | Python |
"""
Forgot Password Web Controller
"""
# Standard Library
import os
# Third Party Library
from django.views import View
from django.shortcuts import render
from django.utils.translation import gettext as _
# Local Library
from app.modules.core.context import Context
from app.modules.entity.option_entity import Optio... | 28.878049 | 121 | 0.734797 | [
"BSD-3-Clause"
] | arxcdr/silverback | app/controllers/web/forgot_password.py | 1,185 | Python |
import os
import dj_database_url
from decouple import config, Csv
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/... | 27.821918 | 91 | 0.693747 | [
"MIT"
] | Brayonski/Instagram-1 | instagram/settings.py | 4,062 | Python |
from django import forms
from .models import Image, Comments
#......
class NewStoryForm(forms.ModelForm):
class Meta:
model = Image
fields = ('image', 'image_caption')
class NewCommentForm(forms.ModelForm):
class Meta:
model = Comments
fields = ('comment',)
| 23 | 43 | 0.64214 | [
"MIT"
] | cossie14/Slygram | instagram/forms.py | 299 | Python |
import json
import os
import re
from yandeley.models.annotations import Annotation
from yandeley.response import SessionResponseObject
class File(SessionResponseObject):
"""
A file attached to a document.
.. attribute:: id
.. attribute:: size
.. attribute:: file_name
.. attribute:: mime_type... | 33.97561 | 119 | 0.603494 | [
"Apache-2.0"
] | shuichiro-makigaki/yandeley-python-sdk | yandeley/models/files.py | 4,179 | Python |
import unittest
from pyjsg.validate_json import JSGPython
class MemberExampleTestCase(unittest.TestCase):
def test1(self):
x = JSGPython('''doc {
last_name : @string, # exactly one last name of type string
first_name : @string+ # array or one or more first names
... | 28.4 | 77 | 0.533803 | [
"CC0-1.0"
] | hsolbrig/pyjsg | tests/test_issues/test_member_example.py | 710 | Python |
#!/usr/bin/env python
# Copyright 2016 Vimal Manohar
# 2016 Johns Hopkins University (author: Daniel Povey)
# Apache 2.0
from __future__ import print_function
import sys, operator, argparse, os
from collections import defaultdict
# This script reads 'ctm-edits' file format that is produced by get_ctm_e... | 51.010618 | 125 | 0.641058 | [
"Apache-2.0"
] | HunterJiang/kaldi | egs/wsj/s5/steps/cleanup/internal/segment_ctm_edits.py | 52,847 | Python |
from lightning_transformers.task.nlp.translation.datasets.wmt16 import WMT16TranslationDataModule
from lightning_transformers.task.nlp.translation.datasets.smiles import SMILESTranslationDataModule
| 40 | 99 | 0.9 | [
"Apache-2.0"
] | zhaisilong/lightning-transformers | lightning_transformers/task/nlp/translation/datasets/__init__.py | 200 | Python |
from __future__ import annotations
from typing import TYPE_CHECKING, cast
from .enums import ChannelType
from .messageable import Messageable
if TYPE_CHECKING:
from .state import State
from .types import Channel as ChannelPayload
from .types import DMChannel as DMChannelPayload
from .types import Gro... | 33.655914 | 123 | 0.66869 | [
"MIT"
] | XiehCanCode/revolt.py | revolt/channel.py | 3,130 | Python |
'''
Author: what-is-me
E-mail: nt_cqc@126.com
Github: https://github.com/what-is-me
LeetCode: https://leetcode-cn.com/u/what-is-me/
Date: 2021-05-17 23:22:14
LastEditors: what-is-me
LastEditTime: 2021-05-19 12:33:23
Description: 查询单个单词/词组意思
'''
import re
import urllib.parse
import requests
class getimg... | 31.410788 | 100 | 0.480713 | [
"Apache-2.0"
] | what-is-me/WordListEnquiry | Dict-search/__init__.py | 8,022 | Python |
#!/usr/bin/env python
import contextlib as __stickytape_contextlib
@__stickytape_contextlib.contextmanager
def __stickytape_temporary_dir():
import tempfile
import shutil
dir_path = tempfile.mkdtemp()
try:
yield dir_path
finally:
shutil.rmtree(dir_path)
with __stickytape_temporary_... | 182.636364 | 3,959 | 0.673027 | [
"Apache-2.0"
] | gdlg/k8s-debugger-pycharm-pluggin | src/main/resources/pydev_tunnel/tunnel_single_script.py | 18,082 | Python |
"""
nuts_finder
-----------
You give it a point, it tells you all the EU NUTS regions
"""
import geojson
import requests
import re
from io import BytesIO
from zipfile import ZipFile
from shapely import geometry
from functools import lru_cache
import logging
YEAR_REGEX = "NUTS ([0-9]+)"
SCALE_REGEX = "1:([0-9]+) Milli... | 36.055046 | 97 | 0.637913 | [
"MIT"
] | nestauk/nuts_finder | nuts_finder/nuts_finder.py | 3,930 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.