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 datetime
import random
import csv
import sys
book_titles = [
'Advanced Deep Learning with Keras',
'Hands-On Machine Learning for Algorithmic Trading',
'Architects of Intelligence',
'Deep Reinforcement Learning Hands-On',
'Natural Language Processing with TensorFlow',
'Hands-On Reinforcement Learning with Python... | 33.114286 | 129 | 0.696721 | [
"MIT"
] | PacktWorkshops/The-Django-Workshop | Old Code Backup/chapters9,10,11/_newChapter10/Exercise01/bookr/reviews/management/commands/DjangoWorkshopReviewsData.py | 2,318 | Python |
from rate_limiter.Limit import Limit
from rate_limiter.Parser import Parser
from rate_limiter.LimitProcessor import LimitProcessor
from rate_limiter.LogLine import LogLine
from typing import Dict, List
from datetime import datetime
class IpRateLimiter:
# used to store unban time. Also used to maintain what is cur... | 34.829787 | 86 | 0.627673 | [
"MIT"
] | v-shash/ackerman | rate-limiter/rate_limiter/IPRateLimiter.py | 3,274 | Python |
import numpy as np
import tensorflow as tf
from pyuvdata import UVData, UVCal, UVFlag
from . import utils
import copy
import argparse
import itertools
import datetime
from pyuvdata import utils as uvutils
from .utils import echo
from .utils import PBARS
from . import cal_utils
from . import modeling
import re
OPTIMIZ... | 39.659114 | 170 | 0.637591 | [
"MIT"
] | aewallwi/calamity | calamity/calibration.py | 77,018 | Python |
import os
SQLALCHEMY_DATABASE_URI = os.environ.get('DB_HOST')
SECRET_KEY = os.environ.get('SECRET_KEY')
SQLALCHEMY_TRACK_MODIFICATIONS = False | 28.6 | 51 | 0.818182 | [
"MIT"
] | cojok/python_play_around | flask_qa/flask_qa/settings.py | 143 | Python |
"""
Script for processing image (Pre OCR)
"""
import cv2
import numpy as np
import sys
import os.path
if len(sys.argv) != 3:
print "%s input_file output_file" % (sys.argv[0])
sys.exit()
else:
input_file = sys.argv[1]
output_file = sys.argv[2]
if not os.path.isfile(input_file):
print "No such file... | 27.549669 | 119 | 0.583534 | [
"MIT"
] | sheeshmohsin/insta_hack | panverification/panapp/process_image.py | 8,320 | Python |
from django.forms import (
CheckboxSelectMultiple,
EmailInput,
FileInput,
HiddenInput,
NumberInput,
PasswordInput,
Textarea,
TextInput,
URLInput,
)
from django.utils.safestring import mark_safe
from .bootstrap import get_bootstrap_setting, get_field_renderer, get_form_renderer, get_... | 31.431373 | 123 | 0.651279 | [
"BSD-3-Clause"
] | Natureshadow/django-bootstrap4 | src/bootstrap4/forms.py | 4,809 | Python |
"""
Revision ID: 0304a_merge
Revises: 0304_remove_org_to_service, 0303a_merge
Create Date: 2019-07-29 16:18:27.467361
"""
# revision identifiers, used by Alembic.
revision = "0304a_merge"
down_revision = ("0304_remove_org_to_service", "0303a_merge")
branch_labels = None
import sqlalchemy as sa
from alembic import o... | 15.666667 | 61 | 0.75 | [
"MIT"
] | cds-snc/notification-api | migrations/versions/0304a_merge.py | 376 | Python |
import argparse
import os.path
from os import walk
import sys
import xml.etree.ElementTree
from lib.config import get_env_var
from lib.transifex import (pull_source_files_from_transifex, should_use_transifex,
pull_xtb_without_transifex, combine_override_xtb_into_original)
from lib.grd_string_... | 38.403846 | 90 | 0.732098 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | mamylinx/presearch-core | script/pull-l10n.py | 1,997 | Python |
# Copyright (c) 2019, Xilinx
# 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 conditions an... | 43.322581 | 131 | 0.710164 | [
"BSD-3-Clause"
] | Tobi-Alonso/ResNet50-PYNQ | host/synth_bench_power.py | 5,372 | Python |
def get_workout(day):
if day == 'Monday':
return 'Chest+biceps'
elif day == 'Tuesday':
return 'Back+triceps'
elif day == 'Wednesday':
return 'Core'
elif day == 'Thursday':
return 'Legs'
elif day == 'Friday':
return 'Shoulders'
elif day in ('Saturday', 'Su... | 25 | 76 | 0.618 | [
"MIT"
] | pruty20/100daysofcode-with-python-course | days/34-36-refactoring/refactoring_yo.py | 1,000 | Python |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | 35.729167 | 94 | 0.609329 | [
"MIT"
] | XiangyuL-Microsoft/azure-cli-extensions | src/anf-preview/setup.py | 1,715 | Python |
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2015 Tom Barron. All rights reserved.
# Copyright (c) 2016 Mike Rooney. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this... | 40.928406 | 79 | 0.622503 | [
"Apache-2.0"
] | sapcc/cinder | cinder/volume/drivers/netapp/dataontap/client/client_base.py | 17,722 | Python |
from typing import Optional
from data_structures.singly_linked_list_node import SinglyLinkedListNode
def rotate_list(head: Optional[SinglyLinkedListNode], amount: int) -> Optional[SinglyLinkedListNode]:
if not head:
return None
if not head.next:
return head
current = head
number = 1
... | 22.074074 | 101 | 0.667785 | [
"MIT"
] | ahcode0919/python-ds-algorithms | singly_linked_lists/rotate_list.py | 596 | Python |
#/*
# * Player - One Hell of a Robot Server
# * Copyright (C) 2004
# * Andrew Howard
# *
# *
# * This library is free software; you can redistribute it and/or
# * modify it under the terms of the GNU Lesser General Public
# * License as published by the Free Software Foundation; either
# ... | 28.710526 | 78 | 0.62374 | [
"BSD-3-Clause"
] | parasol-ppl/PPL_utils | physicalrobots/player/client_libs/libplayerc/bindings/python/test/test_camera.py | 2,182 | Python |
from cwltool.main import main
from .util import get_data
def test_missing_cwl_version():
"""No cwlVersion in the workflow."""
assert main([get_data('tests/wf/missing_cwlVersion.cwl')]) == 1
def test_incorrect_cwl_version():
"""Using cwlVersion: v0.1 in the workflow."""
assert main([get_data('tests/w... | 27.076923 | 67 | 0.713068 | [
"Apache-2.0"
] | jayvdb/cwltool | tests/test_cwl_version.py | 352 | Python |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 38.148387 | 109 | 0.624472 | [
"Apache-2.0"
] | kevin0120/airflow | airflow/providers/cncf/kubernetes/utils/pod_launcher.py | 11,826 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-08-25 10:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Cre... | 52.516432 | 181 | 0.578759 | [
"MIT"
] | sxfang32/meiduo_29 | meiduo_mall/meiduo_mall/apps/goods/migrations/0001_initial.py | 11,722 | Python |
"""
Low-level wrapper for PortMidi library
Copied straight from Grant Yoshida's portmidizero, with slight
modifications.
"""
import sys
from ctypes import (CDLL, CFUNCTYPE, POINTER, Structure, c_char_p,
c_int, c_long, c_uint, c_void_p, cast,
create_string_buffer, byref)
import c... | 25.76506 | 71 | 0.697919 | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | EnjoyLifeFund/macHighSierra-py36-pkgs | mido/backends/portmidi_init.py | 4,277 | Python |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
from niftynet.layer.base_layer import TrainableLayer
from niftynet.layer.convolution import ConvolutionalLayer as Conv
from niftynet.layer.downsample import DownSampleLayer as Down
from niftynet.layer.residual_unit import ResidualUnit as Re... | 41.818182 | 73 | 0.582609 | [
"Apache-2.0"
] | BRAINSia/NiftyNet | niftynet/layer/downsample_res_block.py | 2,300 | Python |
#!/usr/bin/env python3
# -*- encoding=utf-8 -*-
# description:
# author:jack
# create_time: 2018/9/17
"""
desc:pass
"""
class __init__:
pass
if __name__ == '__main__':
pass | 10.555556 | 26 | 0.6 | [
"Apache-2.0"
] | Mryan2005/bot-sdk-python | dueros/directive/Base/__init__.py | 190 | Python |
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.callbacks import LearningRateScheduler
from tensorflow.keras.layers import Activation
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import GlobalAveragePooling2D
from... | 25.259259 | 72 | 0.693182 | [
"MIT"
] | thisisjako/UdemyTF | Chapter9_AdvancedDL/Chapter9_7_AdvancedTechniques2/dogsCatsTransferLearning.py | 2,728 | Python |
# IDLSave - a python module to read IDL 'save' files
# Copyright (c) 2010 Thomas P. Robitaille
# Many thanks to Craig Markwardt for publishing the Unofficial Format
# Specification for IDL .sav files, without which this Python module would not
# exist (http://cow.physics.wisc.edu/~craigm/idl/savefmt).
# This code was... | 29.355876 | 89 | 0.562559 | [
"BSD-3-Clause"
] | ikamensh/scipy | scipy/io/idl.py | 26,479 | Python |
from typing import List, Optional, Any, Dict
from checkov.common.graph.checks_infra.enums import Operators
from .equals_attribute_solver import EqualsAttributeSolver
class NotEqualsAttributeSolver(EqualsAttributeSolver):
operator = Operators.NOT_EQUALS
def __init__(self, resource_types: List[str], attribute... | 39.866667 | 96 | 0.770903 | [
"Apache-2.0"
] | 0xflotus/checkov | checkov/common/checks_infra/solvers/attribute_solvers/not_equals_attribute_solver.py | 598 | Python |
#!/usr/bin/env python
""" These tests only check whether plots are created,
not that they look correct!
"""
import unittest
import os
import sys
from glob import glob
import numpy as np
import matador.cli.dispersion
from matador.scrapers import res2dict, magres2dict
from matador.hull import QueryConvexHull
from mata... | 31.769388 | 93 | 0.558232 | [
"MIT"
] | AJMGroup/matador | tests/test_plotting.py | 15,567 | Python |
def is_dark(wf):
if not wf.alfred_env.get('theme_background'):
return True
rgb = [int(x) for x in wf.alfred_env['theme_background'][5:-6].split(',')]
return (0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]) / 255 < 0.5
def get_icon(wf, name):
name = '%s-dark' % name if is_dark(wf) else name
return "ico... | 30.863636 | 92 | 0.656848 | [
"MIT"
] | r0x73/alfred-zebra | src/helpers.py | 679 | Python |
# -*- coding: utf-8 -*- #
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 27.480769 | 74 | 0.671798 | [
"Apache-2.0"
] | bshaffer/google-cloud-sdk | lib/googlecloudsdk/third_party/apis/cloudbilling/v1/resources.py | 1,429 | Python |
# coding: utf-8
"""
Laserfiche API
Welcome to the Laserfiche API Swagger Playground. You can try out any of our API calls against your live Laserfiche Cloud account. Visit the developer center for more details: <a href=\"https://developer.laserfiche.com\">https://developer.laserfiche.com</a><p><strong>Build# ... | 31.93617 | 314 | 0.603598 | [
"BSD-2-Clause"
] | Layer8Err/laserfiche-api | laserfiche_api/models/get_edoc_with_audit_reason_request.py | 4,503 | Python |
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from allauth.socialaccount.helpers import render_authentication_error
from allauth.socialaccount.providers.oauth.client import (OAuthClient,
OAuthError)
from allauth.socia... | 40.941176 | 96 | 0.630747 | [
"MIT"
] | rawjam/django-allauth | allauth/socialaccount/providers/oauth/views.py | 4,176 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 34.707483 | 183 | 0.640141 | [
"Apache-2.0"
] | test-wiz-sec/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/machinelearningservices/v20200901preview/get_machine_learning_compute.py | 5,102 | Python |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
import os, json, hashlib
from torch.autograd import Function
from http import client as http_client
import antares_custom_op
def generate_antares_expression(antares_ir, inputs):
input_dict, kwargs = {}, {}
for i in range(len(in... | 32.164557 | 94 | 0.702086 | [
"MIT"
] | kdtree/antares | frameworks/antares/pytorch/custom_op.py | 2,541 | Python |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 35.659091 | 77 | 0.760357 | [
"Apache-2.0"
] | Explorer1092/aliyun-openapi-python-sdk | aliyun-python-sdk-live/aliyunsdklive/request/v20161101/ApplyRecordTokenRequest.py | 1,569 | Python |
"""
A simple class to help with paging result sets
"""
import logging
from flask import request, url_for, Markup
__author__ = 'Stephen Brown (Little Fish Solutions LTD)'
log = logging.getLogger(__name__)
class Pager(object):
"""
Standard Pager used on back end of website.
When viewing page 234 of 100... | 28.351916 | 116 | 0.593831 | [
"Apache-2.0"
] | michaelwalkerfl/littlefish | build/lib/littlefish/pager.py | 8,137 | Python |
"""Support for TPLink HS100/HS110/HS200 smart switch."""
import logging
import time
from pyHS100 import SmartDeviceException, SmartPlug
from homeassistant.components.switch import (
ATTR_CURRENT_POWER_W,
ATTR_TODAY_ENERGY_KWH,
SwitchDevice,
)
from homeassistant.const import ATTR_VOLTAGE
import homeassista... | 31.5 | 87 | 0.582665 | [
"Apache-2.0"
] | ABOTlegacy/home-assistant | homeassistant/components/tplink/switch.py | 5,607 | Python |
import cpboard
import periphery
import pytest
import smbus
import sys
def pytest_addoption(parser):
group = parser.getgroup('i2cslave')
group.addoption("--bus", dest='i2cbus', type=int, help='I2C bus number')
group.addoption("--serial-wait", default=20, dest='serial_wait', type=int, help='Number of millise... | 28 | 162 | 0.655152 | [
"MIT"
] | notro/cp-smbusslave | tests/i2cslave/conftest.py | 1,708 | Python |
from typing import Dict
# TODO consolidate some of these imports
from vyper.semantics.types.user.struct import StructDefinition
from vyper.semantics.types.value.address import AddressDefinition
from vyper.semantics.types.value.array_value import BytesArrayDefinition
from vyper.semantics.types.value.bytes_fixed import ... | 31.888889 | 95 | 0.699187 | [
"Apache-2.0"
] | GDGSNF/vyper | vyper/semantics/environment.py | 1,722 | Python |
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
import datetime # for checking renewal date range.
from django import forms
class RenewBookForm(forms.Form):
"""Form for a librarian to renew books."""
renewal_date = forms.DateField(
help_... | 34.348837 | 74 | 0.650643 | [
"CC0-1.0"
] | PMPL-Arieken/django-locallibrary-tutorial | catalog/forms.py | 1,477 | Python |
#!/usr/bin/env python
# Import modules
import numpy as np
import sklearn
from sklearn.preprocessing import LabelEncoder
import pickle
from sensor_stick.srv import GetNormals
from sensor_stick.features import compute_color_histograms
from sensor_stick.features import compute_normal_histograms
from visualization_msgs.ms... | 35.961988 | 108 | 0.70583 | [
"MIT"
] | navinrahim/RoboND-Perception-Project | pr2_robot/scripts/project_run.py | 12,299 | Python |
from flask import render_template, request, redirect, url_for, flash
from datetime import datetime as dt
from app.forms import AdicionarQuarto, VerificarDisponibilidade
from app.models import Rooms, Hotels, User, Reservation, Status
from app import db
def adicionar_quarto(user_id):
form_reserva = VerificarDisponi... | 45.416058 | 118 | 0.61829 | [
"MIT"
] | ES-UFABC/Grupo-17 | app/scripts/ocupacao_quartos.py | 6,235 | Python |
#!/usr/bin/env python3
#
# Copyright 2016 WebAssembly Community Group participants
#
# 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
#
# Unles... | 30.54023 | 105 | 0.579225 | [
"Apache-2.0"
] | ChristianGutman/wabt | test/utils.py | 5,314 | Python |
import pandas as pd
import os
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_curve, auc
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import precision_recall_curve
from sklearn.metrics import average_precision_score
import time
#Criteo's CTR Prediction Ch... | 34.593558 | 147 | 0.598626 | [
"MIT"
] | alvarodemig/Algorithms-Performance-Comparison | AlgPerformComparison.py | 22,555 | Python |
from dataclasses import dataclass, field
from typing import List
@dataclass
class Doc:
class Meta:
name = "doc"
elem: List[str] = field(
default_factory=list,
metadata={
"type": "Element",
"namespace": "",
"pattern": r"\]",
}
)
| 17.277778 | 40 | 0.511254 | [
"MIT"
] | tefra/xsdata-w3c-tests | output/models/ms_data/regex/re_i45_xsd/re_i45.py | 311 | Python |
"""
Train LearnedPDReconstructor on 'lodopab'.
"""
import numpy as np
from dival import get_standard_dataset
from dival.measure import PSNR
from dival.reconstructors.learnedpd_reconstructor import LearnedPDReconstructor
from dival.reference_reconstructors import (
check_for_params, download_params, get_hyper_params... | 32.019608 | 79 | 0.752603 | [
"MIT"
] | MBaltz/dival | dival/examples/ct_train_learnedpd.py | 1,633 | Python |
import numpy as np
import pytest
from agents.common import BoardPiece, NO_PLAYER, PLAYER1, PLAYER2, pretty_print_board, initialize_game_state, \
string_to_board, apply_player_action, connected_four, check_connect_topleft_bottomright
def test_initialize_game_state():
ret = initialize_game_state()
assert... | 27.616967 | 173 | 0.59313 | [
"MIT"
] | Sibimobon/Connect4 | tests/test_common.py | 10,743 | Python |
def types():
from .config_result import GraphenePipelineConfigValidationResult
from .config import (
GrapheneEvaluationErrorReason,
GrapheneEvaluationStack,
GrapheneEvaluationStackEntry,
GrapheneEvaluationStackListItemEntry,
GrapheneEvaluationStackPathEntry,
Graph... | 36.965909 | 92 | 0.744543 | [
"Apache-2.0"
] | kbd/dagster | python_modules/dagster-graphql/dagster_graphql/schema/pipelines/__init__.py | 3,253 | Python |
# 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) AutoRest Code Generator.
# Changes may ... | 49.169231 | 144 | 0.702753 | [
"MIT"
] | changlong-liu/autorest.python | docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_configuration.py | 3,196 | Python |
def factorial(n):
if n == 0:
return 1.0
else:
return float(n) * factorial(n-1)
def taylor_exp(n):
return [1.0/factorial(i) for i in range(n)]
def taylor_sin(n):
res = []
for i in range(n):
if i % 2 == 1:
res.append((-1)**((i-1)/2)/float(fa... | 20.44 | 60 | 0.483366 | [
"MIT"
] | UW-HPC/Parallelizing-Python-Workshop | lab4/taylor.py | 511 | Python |
"""
Support for TopoJSON was added in OGR 1.11 to the `GeoJSON` driver.
Starting at GDAL 2.3 support was moved to the `TopoJSON` driver.
"""
import fiona
from fiona.env import GDALVersion
import os
import pytest
from collections import OrderedDict
gdal_version = GDALVersion.runtime()
driver = "TopoJSON" if gdal_vers... | 37.833333 | 87 | 0.725404 | [
"BSD-3-Clause"
] | HirniMeshram1/Fiona | tests/test_topojson.py | 1,362 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Youssef Restom and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.desk.doctype.notification_log.notification_log import (
enqueue_create_notific... | 32.594595 | 84 | 0.665837 | [
"MIT"
] | Govind-Jangid/erpnext_telegram | erpnext_telegram_integration/extra_notifications/doctype/extra_notification_log/extra_notification_log.py | 1,206 | Python |
import os
import sys
import logging
from typing import Optional, List
from datetime import datetime
from pythonjsonlogger import jsonlogger
from . import dirs
from .decorators import deprecated
# NOTE: Will be removed in a future version since it's not compatible with running a multi-service process
# TODO: prefix w... | 29.877698 | 106 | 0.666747 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | minhlt9196/activeseconds-aw-core | aw_core/log.py | 4,153 | Python |
from txgcv.base.algorithm import Algorithm
from txgcv.base.parameter import Parameter
__all__ = ["Algorithm", "Parameter"] | 24.8 | 42 | 0.798387 | [
"BSD-3-Clause"
] | dongyaoli10x/txgcv | txgcv/base/__init__.py | 124 | Python |
# -----------------------------------------------------------------------------
# Task 002
print('''
Задача 002:
===========
Каждый следующий элемент ряда Фибоначчи получается при сложении двух
предыдущих. Начиная с 1 и 2, первые 10 элементов будут:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
\x1b[33m
Найдите сумму... | 22.851064 | 82 | 0.554935 | [
"MIT"
] | z1365/euler | t002-fibanatchi.py | 1,383 | Python |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open("python/requirements.txt", "r") as fh:
install_requires = fh.read().splitlines()
setuptools.setup(
name="fastquant",
version="0.1.3.16",
author="Lorenzo Ampil",
author_email="lorenzo.ampil@gmail.com",
... | 35.896552 | 83 | 0.684918 | [
"MIT"
] | beatobongco/fastquant | setup.py | 1,041 | Python |
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
import requests.exceptions
from urlparse import urlsplit
from collections import deque
import re
def crawl(url):
new_urls = deque(["http://{}".format(url)])
processed_urls = set()
emails = []
while ... | 30.428571 | 77 | 0.537894 | [
"Unlicense"
] | vesche/snippets | autocapstone/email_crawl.py | 1,491 | Python |
from gensim.models import word2vec
print("Learning Word2Vec embeddings")
tok_file = 'data/preprocessed/lemmatized.txt'
sentences = word2vec.LineSentence(tok_file)
model = word2vec.Word2Vec(sentences=sentences, size=10, window=5, workers=3, min_count=1)
model.wv.save_word2vec_format('models/vejica_word2vec.emb')
print... | 38.333333 | 89 | 0.811594 | [
"MIT"
] | gregorkrz/vejice | scripts/experiments/learn_word2vec.py | 345 | Python |
##########################################################################
#
# Copyright (c) 2012, Image Engine Design 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:
#
# * Redistrib... | 34.787879 | 129 | 0.724303 | [
"BSD-3-Clause"
] | cedriclaunay/gaffer | python/GafferUI/PathFilterWidget.py | 4,592 | Python |
from sympy.core.backend import sin, cos, tan, pi, symbols, Matrix, zeros, S
from sympy.physics.mechanics import (Particle, Point, ReferenceFrame,
RigidBody, Vector)
from sympy.physics.mechanics import (angular_momentum, dynamicsymbols,
inertia, i... | 36.035573 | 83 | 0.530767 | [
"BSD-3-Clause"
] | Abhi58/sympy | sympy/physics/mechanics/tests/test_functions.py | 9,117 | Python |
import cv2
import numpy as np
import matplotlib.pyplot as plt
def Canny(img):
# Gray scale
def BGR2GRAY(img):
b = img[:, :, 0].copy()
g = img[:, :, 1].copy()
r = img[:, :, 2].copy()
# Gray scale
out = 0.2126 * r + 0.7152 * g + 0.0722 * b
out = out.astype(np.uint8)
return out
# Gaussian filter for... | 22.419231 | 91 | 0.553954 | [
"MIT"
] | lusi1990/ImageProcessing100Wen | Question_41_50/answers_py/answer_44.py | 5,829 | Python |
"""
timedelta support tools
"""
import numpy as np
from pandas._libs.tslibs import NaT
from pandas._libs.tslibs.timedeltas import Timedelta, parse_timedelta_unit
from pandas.core.dtypes.common import is_list_like
from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries
from pandas.core.arrays.timedeltas impo... | 36.401163 | 85 | 0.615557 | [
"BSD-3-Clause"
] | cdeil/pandas | pandas/core/tools/timedeltas.py | 6,261 | Python |
from functools import reduce
from itertools import chain
from typing import Optional, Set
import pandas as pd
from sqlalchemy import (
func,
or_,
orm,
sql,
)
import fiber
from fiber.condition.base import _BaseCondition
from fiber.database import (
compile_sqla,
read_with_progress,
)
from fiber... | 32.165138 | 79 | 0.595455 | [
"MIT"
] | hpi-dhc/fiber | fiber/condition/database.py | 10,518 | Python |
#
# PySNMP MIB module PAN-ENTITY-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///mnt/d/data/MIBS/text_mibs/paloalto/PAN-ENTITY-EXT-MIB
# Produced by pysmi-0.3.4 at Wed Feb 10 13:07:35 2021
# On host QS-IL-COSTAY platform Linux version 5.4.72-microsoft-standard-WSL2 by user coye
# Using Python version 3.8.5 (... | 113.616438 | 1,375 | 0.769472 | [
"Apache-2.0"
] | QualiSystems/cloudshell-firewall-panos | cloudshell/firewall/paloalto/panos/mibs/PAN-ENTITY-EXT-MIB.py | 8,294 | Python |
from setuptools import setup, find_packages
# declare these here since we use them in multiple places
_tests_require = [
'pytest',
'pytest-cov',
'flake8',
]
setup(
# package info
name='cheapskate_bal',
description='Cheapskate labs single/dual plane balancer',
version='0.0.2',
url='htt... | 23.943396 | 73 | 0.643814 | [
"Unlicense"
] | kevinpowell/balancer | cheapskate_bal/setup.py | 1,269 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Run this script to train a QR-DQN agent in the selected environment
"""
from cnn_deepmind import CNNDeepmind_Multihead
from eqrdqn import QRDQN
from atari_wrappers import make_atari, wrap_deepmind
import pickle
import numpy as np
import matplotlib.pyplot as plt
env ... | 27.634146 | 67 | 0.60812 | [
"MIT"
] | uncharted-technologies/risk-and-uncertainty | Archive/main/Atari/train_atari.py | 1,133 | Python |
from ..commands.help import HelpCommand
from ..commands.exit import ExitCommand
from ..commands.purchase import PurchaseCommand
class CommandState:
"""
The __state value should not be accessed directly,
instead the get() method should be used.
"""
__state = {
'commands': {
... | 25.52381 | 58 | 0.617537 | [
"MIT"
] | itsSayantan/pyshop | src/state/CommandState.py | 536 | Python |
#!/bin/bash
from pkg_resources import require
require('numpy')
require('h5py')
import sys, os
import numpy as np
import h5py
cxifilenames = sys.argv[2:]
output_dims = tuple()
print "Using CXI file for dims: ", cxifilenames[0]
with h5py.File(cxifilenames[0], 'r') as cxi:
output_dtype = cxi['entry_1']['data_1']['... | 32.666667 | 112 | 0.644658 | [
"MIT"
] | ulrikpedersen/benchpress | cxi2hdf5.py | 1,666 | Python |
#from sql_gen.sql_gen.filters import *
class Prompter(object):
def __init__(self, template_source):
self.template_source = template_source
def get_prompts(self):
result=[]
for undeclared_var in self.template_source.find_undeclared_variables():
result.append(Prompt(undeclare... | 30.297297 | 98 | 0.67529 | [
"MIT"
] | vecin2/em-dev-tools | build/lib.linux-x86_64-2.7/sql_gen/sql_gen/prompter.py | 1,121 | Python |
import logging
import os
import select
import socket
from typing import Union, List
log = logging.getLogger(__name__)
class Receiver:
def __init__(self, irc_socket: socket.socket, socket_timeout: int) -> None:
self._irc_socket = irc_socket
self._socket_timeout = socket_timeout
try:
... | 31.06 | 79 | 0.594334 | [
"MIT"
] | LoLei/ircbot | src/receiver/receiver.py | 1,553 | Python |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 33.348048 | 79 | 0.639497 | [
"Apache-2.0"
] | Alex-Sizov/nova | nova/network/model.py | 19,642 | Python |
import bs4
import requests
import operator
res = requests.get("http://dollarrupee.in/")
soup = bs4.BeautifulSoup(res.text, "lxml")
rate = soup.select(".item-page p strong")
rupee = float(rate[0].text)
print("Today's rate: $1 = ₹{}".format(rupee))
choice = int(input(
"\nWhat do you want to convert?\n1. Dollars t... | 26.851852 | 84 | 0.628966 | [
"MIT"
] | urmilshroff/netscraper | rupee.py | 731 | Python |
# -*- coding: utf-8 -*-
"""
"""
from ill import api
tn = api.request_document('8236596')
print(tn)
#api.download_papers()
#NOT YET IMPLEMENTED
#Not downloaded
#api.delete_online_papers(api.downloaded_paper_ids)
#main.fill_form('610035')
print('Done with the request') | 16.111111 | 52 | 0.67931 | [
"MIT"
] | ScholarTools/ill_filler | ill_filler_quick_testing.py | 290 | Python |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import pytest
from flexget.event import fire_event
from flexget.manager import Session
from flexget.plugins.modify.variables import Variables
@pytest.mark.usefixtures('t... | 29.925532 | 117 | 0.602204 | [
"MIT"
] | Daeymien/Flexget | flexget/tests/test_variables.py | 2,813 | Python |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 11 15:00:26 2018
@author: Alex
# reads and parses local html
"""
#%% Import libraries
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
import codecs
import os
import re
import pickle
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
impo... | 28.324324 | 118 | 0.639472 | [
"MIT"
] | avbatchelor/insight-articles-project | src/scraping/read_and_parse.py | 6,288 | Python |
"""
.. module: lemur.domains.models
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from sqlalchemy import Column, Integer, String, Boolean, Index
from lemur.database impo... | 25.774194 | 62 | 0.635795 | [
"Apache-2.0"
] | DZ521111/lemur | lemur/domains/models.py | 799 | Python |
import cv2
import os
import numpy as np
from image_processor import process_image
from processor_properties import ProcessorProperties
import time
class Camera:
def __init__(self):
self.cap = cv2.VideoCapture(0)
def snapshot(self):
ret, frame = self.cap.read()
return frame
if __nam... | 27.027778 | 69 | 0.599178 | [
"MIT"
] | korrawat/athack-susan | camera_skeleton.py | 973 | Python |
# encoding: utf-8
"""Placeholder-related objects.
Specific to shapes having a `p:ph` element. A placeholder has distinct behaviors
depending on whether it appears on a slide, layout, or master. Hence there is a
non-trivial class inheritance structure.
"""
from pptx.enum.shapes import MSO_SHAPE_TYPE, PP_PLACEHOLDER
f... | 35.987624 | 87 | 0.673499 | [
"MIT"
] | Adriyst/python-pptx | pptx/shapes/placeholder.py | 14,539 | Python |
# #########################################################################
# Copyright (c) , UChicago Argonne, LLC. All rights reserved. #
# #
# See LICENSE file. #
# ##############... | 36.319475 | 165 | 0.625798 | [
"BSD-3-Clause"
] | AdvancedPhotonSource/cdisupp | scripts/alien_tools.py | 16,598 | Python |
#!/usr/bin/env python2
import rospy
from gnss_status_viewer import Status
from nmea_msgs.msg import Sentence
import sys
import copy
# Previous and current Status
prev = None
curr = None
def print_current_status(status):
"""
Prints the current status
:param status:
:return:
"""
print(status)... | 19.351852 | 60 | 0.655502 | [
"MIT"
] | naoki-mizuno/gnss_status_viewer | nodes/gnss_status_viewer_node.py | 1,045 | Python |
'''
Generate uv position map of 300W_LP.
'''
import os, sys
import numpy as np
import scipy.io as sio
import random as ran
from skimage.transform import SimilarityTransform
from skimage import io, util
import skimage.transform
from time import time
import cv2
import matplotlib.pyplot as plt
sys.path.append('..')
impor... | 41.294521 | 180 | 0.636092 | [
"MIT"
] | Nnemr/PRNet | get_300WLP_maps.py | 6,029 | Python |
from comet_ml import Experiment
experiment = Experiment(api_key="oda8KKpxlDgWmJG5KsYrrhmIV", project_name="consensusnet")
import numpy as np
from keras.models import Model
from keras.layers import Dense, Dropout, Activation, Flatten, BatchNormalization, Input
from keras.layers import Conv1D, MaxPooling1D, Conv2D
imp... | 32.777778 | 107 | 0.753898 | [
"MIT"
] | ajuric/consensus-net | experiments/karla/diplomski-rad/blade/pb/datasets/n3-all-indels/finished-experiments/model-n3-indel-5.py | 1,475 | Python |
# Generated by Django 3.1.1 on 2022-01-06 23:38
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '00... | 60.436364 | 330 | 0.636282 | [
"MIT"
] | JGabriel-AbreuM/Pokedex | pokedex/accounts/migrations/0001_initial.py | 3,324 | Python |
# coding=utf-8
# Copyright 2020 The Edward2 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 o... | 39.58498 | 80 | 0.674988 | [
"Apache-2.0"
] | mhavasi/edward2 | baselines/imagenet/ensemble.py | 10,015 | Python |
from collections import defaultdict
from .tree import Tree
from .visitors import Transformer_InPlace
from .common import ParserConf
from .lexer import Token, PatternStr
from .parsers import earley
from .grammar import Rule, Terminal, NonTerminal
def is_discarded_terminal(t):
return t.is_term and t.filter_out
d... | 34.294574 | 117 | 0.6033 | [
"MIT"
] | larryk85/eosio.depman | lark/reconstruct.py | 4,424 | Python |
"""py.test fixtures for Pyramid.
http://pyramid.readthedocs.org/en/latest/narr/testing.html
"""
import datetime as datetime_module
import logging
import os
import pkg_resources
import pytest
import webtest
from dcicutils.qa_utils import notice_pytest_fixtures, MockFileSystem
from pyramid.request import apply_reques... | 32.627397 | 118 | 0.605508 | [
"MIT"
] | dbmi-bgm/cgap-portal | src/encoded/tests/conftest.py | 11,909 | Python |
# 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) AutoRest Code Generator.
# Changes may ... | 39.019231 | 127 | 0.672334 | [
"MIT"
] | Azure/autorest.python | test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py | 12,174 | Python |
import os
from glob import glob
from tqdm import tqdm
from pathlib import Path
# from kaggle_isic_2020.lib import dirs # Doesn't work on unix, why?
# Test
source_dir = "/home/common/datasets/SIIM-ISIC_2020_Melanoma/jpeg/test/"
dest_dir = "/home/common/datasets/SIIM-ISIC_2020_Melanoma/jpeg/test_compact/"
# dirs.crea... | 33.666667 | 121 | 0.735974 | [
"MIT"
] | olavosamp/kaggle_isic_2020 | dataset_stats/convert_dataset_test_set.py | 606 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cv2
import pdb
import numpy as np
from os.path import join
from ops import l2_dist_360
from MeanOverlap import MeanOverlap
def catData(totalData, newData):
""" Concat data from scratch """
if totalData is None:
totalData = newData[np.newaxis].copy(... | 35.890052 | 157 | 0.59008 | [
"MIT"
] | remega/OF | Deep360Pilot-CVPR17-tf1.2/util.py | 6,855 | Python |
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2015, Code for America
# This is open source software, released under a standard 3-clause
# BSD-style license; see the file LICENSE for details.
import os
import datetime
import re
from flask import Flask, render_template, request, abort, redirect, url_for, make_response, ... | 38.440748 | 141 | 0.592753 | [
"BSD-3-Clause"
] | codeforamerica/srtracker | app.py | 18,492 | Python |
# Copyright 2015 moco_beta
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | 50.759825 | 112 | 0.649088 | [
"Apache-2.0"
] | mocobeta/janome | tests/test_dic.py | 11,845 | Python |
import sys
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import smtplib
import logging
logger = logging.getLogger("crawler")
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler('sc_appointment_check.log')
fh.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - ... | 31.114286 | 100 | 0.669421 | [
"Apache-2.0"
] | jzhang-cloud/e-appointment-checker | sc_appointment_check.py | 3,267 | Python |
# -*- coding: utf-8 -*-
"""Top-level package for PrecisionMapper."""
import requests
from requests import ConnectionError
from datetime import datetime
from bs4 import BeautifulSoup
__author__ = """Thibault Ducret"""
__email__ = 'hello@tducret.com'
__version__ = '0.0.2'
_DEFAULT_BEAUTIFULSOUP_PARSER = "html.parser"... | 38.178862 | 79 | 0.610733 | [
"MIT"
] | tducret/precisionmapper-python | precisionmapper/__init__.py | 9,394 | Python |
from __future__ import absolute_import, unicode_literals
import sys
from subprocess import CalledProcessError
import pytest
from virtualenv.info import PY2
from virtualenv.seed.wheels.acquire import download_wheel, pip_wheel_env_run
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, get_embed_wheel
from virtual... | 34.73913 | 118 | 0.698373 | [
"MIT"
] | MShaffar19/virtualenv | tests/unit/seed/wheels/test_acquire.py | 2,397 | Python |
# Copyright European Organization for Nuclear Research (CERN)
#
# 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
#
# Authors:
# - Mario Lassnig, <mar... | 37.849462 | 132 | 0.69446 | [
"Apache-2.0"
] | Pranay144/rucio | lib/rucio/core/identity.py | 7,040 | Python |
import pygame
import os
from pygame.locals import *
import config
import game
import engine
import menu
from random import randint
import _fighter
from pygame_functions import *
class Scenario:
def __init__(self, game, scenario):
self.game = game
self.scenario = scenario
pygame.mixer... | 55.076923 | 470 | 0.528195 | [
"MIT"
] | Lewiscowles1986/pyKombat | .history/src/fightScene_20190422211023.py | 11,465 | Python |
from fastapi import HTTPException, status
from sqlalchemy.orm import Session
from blog import hashing, models, schemas
def create(request: schemas.User, db: Session):
new_user = models.User(name=request.name,
email=request.email,
password=hashing.Hash.bcrypt(... | 28.742857 | 74 | 0.592445 | [
"MIT"
] | cristian-rincon/blog-api | app/blog/repository/user.py | 1,006 | Python |
# -*- coding: utf-8 -*
__author__ = 'shawn'
t = (1,)
print t
t = (1)
print t
t = (1, 2, 3)
print t
| 9.181818 | 22 | 0.50495 | [
"MIT"
] | BeeBubble/SnakeRace | Liao Xue Feng Py2 Edu/tuple.py | 101 | Python |
try:
from django.utils.unittest import TestCase
except ImportError:
from django.test import TestCase
try:
from django.utils import unittest
except ImportError:
import unittest
from mock import Mock
import string
from evennia.server.portal import irc
from twisted.conch.telnet import IAC, WILL, DONT, S... | 39.585526 | 97 | 0.590327 | [
"BSD-3-Clause"
] | Antrare/evennia | evennia/server/portal/tests.py | 6,017 | Python |
#==========================================================================
#
# Copyright Insight Software Consortium
#
# 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... | 32.539823 | 201 | 0.67404 | [
"Apache-2.0"
] | CapeDrew/DCMTK-ITK | Wrapping/WrapITK/Languages/Python/itkExtras/__init__.py | 33,093 | Python |
from mwb_help import deck_is_available, create_deck,\
model_is_available, add_model, add_note
from scraper_lxml import get_note_default, get_note_simple
class AnkiDutchDeck():
def __init__(self, deck_name=None):
if deck_name is None:
deck_name = 'tidbits'
if not deck_is_available(... | 37.737864 | 85 | 0.563931 | [
"MIT"
] | gaganpreet/learning-dutch | add_cards.py | 3,887 | Python |
#!/usr/bin/env python
from distutils.core import setup
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='pyzkaccess',
description='Python interface to ZKTeco ZKAccess C3-100/200/400 controllers',
version='0.2',
author='Igor Derkach',
author_email=... | 29.897436 | 81 | 0.632933 | [
"Apache-2.0"
] | cybrnode/pyzkaccess | setup.py | 1,166 | Python |
from genomics_demo.dna import DNA
import pytest
def test_bad_sequence_raises_error():
with pytest.raises(ValueError):
DNA('ATB')
def test_complimentary_sequence_works():
assert DNA('GTC').complimentary_sequence == DNA('CAG')
assert DNA('ATC').complimentary_sequence == DNA('TAG')
assert DNA('... | 29.183333 | 69 | 0.670474 | [
"MIT"
] | nickdelgrosso/genomics_workshop_demo | tests/test_dna.py | 1,751 | Python |
import json
def read_cfg(model_repository):
pass | 11 | 31 | 0.745455 | [
"MIT"
] | drunkcoding/model-inference | service/server_cfg.py | 55 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.