max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
problems/sorting/quick_sort.py | colin-valentini/python-utils | 0 | 32000 |
def quick_sort(array):
'''
Prototypical quick sort algorithm using Python
Time and Space Complexity:
* Best: O(n * log(n)) time | O(log(n)) space
* Avg: O(n * log(n)) time | O(log(n)) space
* Worst: O(n^2) time | O(log(n)) space
'''
return _quick_sort(array, 0, len(array)-1)
def _quick_sort(arr... | 4.25 | 4 |
learning_files/loops.py | MineJockey/python-basics | 0 | 32001 | def loops():
# String Array
names = ["Apple", "Orange", "Pear"]
# \n is a newline in a string
print('\n---------------')
print(' For Each Loop')
print('---------------\n')
# For Each Loop
for i in names:
print(i)
print('\n---------------')
print(' For Loop')
prin... | 4.375 | 4 |
openplaning/openplaning.py | elcf/python-openplaning | 1 | 32002 | import numpy as np
from scipy import interpolate, signal
from scipy.special import gamma
import ndmath
import warnings
import pkg_resources
class PlaningBoat():
"""Prismatic planing craft
Attributes:
speed (float): Speed (m/s). It is an input to :class:`PlaningBoat`.
weight (float): Weigh... | 2.5625 | 3 |
curve2map.py | jmilou/image_utilities | 0 | 32003 | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 6 09:54:17 2015
@author: jmilli
"""
import numpy as np
from scipy.interpolate import interp1d
def create2dMap(values,inputRadii=None,maxRadius=None):
"""
This function takes a 1D radial distribution in input and builds a 2map
"""
nbValues=len(values)
... | 2.765625 | 3 |
lv1/hash_marathon.py | mrbartrns/programmers-algorithm | 0 | 32004 | <reponame>mrbartrns/programmers-algorithm<filename>lv1/hash_marathon.py
def solution(participant, completion):
answer = ''
# sort하면 시간절약이 가능
participant.sort() # [a, a, b]
completion.sort() # [a, b]
print(participant)
print(completion)
for i in range(len(completion)):
if participant[... | 3.8125 | 4 |
chemicals/data_reader.py | daar/chemicals | 0 | 32005 | <filename>chemicals/data_reader.py
# -*- coding: utf-8 -*-
"""Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2020 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"... | 1.6875 | 2 |
official/utils/misc/keras_utils.py | baranshad/models | 180 | 32006 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 2.421875 | 2 |
saleor/app/management/commands/install_app.py | greentornado/saleor | 3 | 32007 | <filename>saleor/app/management/commands/install_app.py
import json
from typing import Any, Optional
import requests
from django.core.exceptions import ValidationError
from django.core.management import BaseCommand, CommandError
from django.core.management.base import CommandParser
from ....app.validators import AppU... | 2.140625 | 2 |
google-cloud-sdk/.install/.backup/lib/googlecloudsdk/api_lib/sql/operations.py | KaranToor/MA450 | 1 | 32008 | # 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 required by applicable law or ag... | 2.109375 | 2 |
objectDetection/detect_images.py | pklink/python-opencv | 1 | 32009 | <filename>objectDetection/detect_images.py
import argparse
import glob
import os, shutil
import cv2
from YoloObjectDetector import YoloObjectDetector
parser = argparse.ArgumentParser(description="Detect Objects in all images in the given folder.")
parser.add_argument("-s", "--size", dest="size", default="320", type=... | 2.96875 | 3 |
countries/api/urls.py | isidaruk/eurovision_project | 0 | 32010 | <filename>countries/api/urls.py
from rest_framework.routers import DefaultRouter
from countries.api.views import CountryViewSet
router = DefaultRouter()
router.register('', CountryViewSet)
urlpatterns = router.urls
| 1.71875 | 2 |
python/code_challenges/stacks_and_queues/stacks_and_queues.py | brendanwelzien/data-structures-and-algorithms | 0 | 32011 | <reponame>brendanwelzien/data-structures-and-algorithms
class Node:
def __init__(self, value, next_p=None):
self.next = next_p
self.value = value
def __str__(self):
return f'{self.value}'
class InvalidOperationError(Exception):
pass
class Stack:
def __init__(self):
se... | 3.984375 | 4 |
square/main.py | vishwamshuklaRazorpay/vishwam_test | 0 | 32012 | <gh_stars>0
def main():
number = int(input("Enter number (Only positive integer is allowed)"))
print(f'{number} square is {number ** 2}')
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
main()
| 3.734375 | 4 |
src/GoTurnRemix.py | aakaashjois/Plant-Tracer | 0 | 32013 | <gh_stars>0
import torch
from torchvision import models
from torch import nn
class GoTurnRemix(nn.Module):
"""
Create a model based on GOTURN. The GOTURN architecture used a CaffeNet while GoTurnRemix uses AlexNet.
The rest of the architecture is the similar to GOTURN. A PyTorch implementation of ... | 2.953125 | 3 |
python/examples/provenance/index_svc/buildrandom.py | xkortex/medifor | 9 | 32014 | <reponame>xkortex/medifor
#!/usr/bin/env python3
import faiss
import numpy as np
def main(outfile):
d = 100
nlist = 100
k = 4
nb = 100000
np.random.seed(1234)
xb = np.random.random((nb, d)).astype('float32')
xb[:, 0] += np.arange(nb) / 1000.
quantizer = faiss.IndexFlatL2(d)
index... | 2.25 | 2 |
class3/exercises/exercise1.py | twin-bridges/netmiko_course | 11 | 32015 | <reponame>twin-bridges/netmiko_course
import os
from getpass import getpass
from pprint import pprint
from netmiko import ConnectHandler
# Code so automated tests will run properly
password = os.getenv("NETMIKO_PASSWORD") if os.getenv("NETMIKO_PASSWORD") else getpass()
arista1 = {
"device_type": "arista_eos",
... | 2.53125 | 3 |
invenio_records_rest/loaders/marshmallow.py | Glignos/invenio-records-rest | 0 | 32016 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Marshmallow loader for record deserialization.
Use marshmallow schema to transfor... | 2.5625 | 3 |
app/controllers/user.py | souravlahoti/GithubAction | 0 | 32017 | <gh_stars>0
from flask import jsonify
from flask_restful import Resource
class User(Resource):
def get(self, id):
data = {'name': '<NAME>'}
return jsonify(data)
def put(self, id):
pass
def patch(self, id):
pass
def delete(self, id):
pass
class UserList(Reso... | 2.578125 | 3 |
src/data_augmentation.py | AnweshCR7/autonomous_greenhouse | 1 | 32018 | <reponame>AnweshCR7/autonomous_greenhouse
import os
import cv2
import glob
import random
import numpy as np
import matplotlib.pyplot as plt
def plot_image(img):
plt.axis("off")
plt.imshow(img, origin='upper')
plt.show()
def flip(img, dir_flag):
# if flag:
return cv2.flip(img, dir_flag)
# els... | 2.8125 | 3 |
hashmap-left-join/hashmap_left_join/left_join.py | Sewar-web/data-structures-and-algorithms1 | 0 | 32019 | <filename>hashmap-left-join/hashmap_left_join/left_join.py
import os
def left_join( hash , hash1):
words = []
for value in hash.keys():
if value in hash1.keys():
words.append([value, hash [value],hash1[value] ])
else:
words.append([va... | 3.75 | 4 |
datable/web/columns.py | ofirr/dojango-datable | 0 | 32020 | # /usr/bin/env python
# -*- encoding: utf-8 -*-
from django.utils.text import capfirst
from django.utils.translation import ugettext as _
from datable.core.serializers import BooleanSerializer
from datable.core.serializers import DateSerializer
from datable.core.serializers import DateTimeSerializer
from datable.core... | 2.21875 | 2 |
maskrcnn_benchmark/modeling/roi_heads/car_cls_rot_head/roi_car_cls_rot_predictor.py | witwitchayakarn/6DVNET | 0 | 32021 | <reponame>witwitchayakarn/6DVNET
from torch import nn
import torch.nn.functional as F
class FPNPredictor(nn.Module):
def __init__(self, cfg):
super().__init__()
representation_size = cfg.MODEL.ROI_CAR_CLS_ROT_HEAD.MLP_HEAD_DIM
num_car_classes = cfg.MODEL.ROI_CAR_CLS_ROT_HEAD.NUMBER_CARS
... | 2.203125 | 2 |
coderdojochi/migrations/0021_auto_20180815_1757.py | rgroves/weallcode-website | 15 | 32022 | <reponame>rgroves/weallcode-website
# Generated by Django 2.0.6 on 2018-08-15 22:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('coderdojochi', '0020_mentor_shirt_size'),
]
operations = [
migrations.AddField(
model_name='... | 1.835938 | 2 |
archives/build_wget.py | onai/code-ecosystem-analyzer | 0 | 32023 | import sys
with open(sys.argv[1]) as handle:
for new_line in handle:
dest = new_line.split('/')[4] + '_' + new_line.split('/')[5] + '.zip'
#print('curl -Ls -I -o /dev/null -w \'%{url_effective}\\n\' ' + new_line.strip())
print('curl -L --user ' + sys.argv[2] + ':' + sys.argv[3] + ' ' + new_... | 2.375 | 2 |
authors/apps/followers/models.py | andela/ah-code-titans | 0 | 32024 | <reponame>andela/ah-code-titans
from django.db import models
from ..authentication.models import User
class Follower(models.Model):
"""
Store data on following statistics for users.
"""
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='follower')
followed = models.ForeignKey(... | 2.734375 | 3 |
dbt/adapters/doris/__init__.py | qiulin/dbt-doris | 2 | 32025 | <reponame>qiulin/dbt-doris<filename>dbt/adapters/doris/__init__.py
from dbt.adapters.doris.connections import DorisConnectionManager
from dbt.adapters.doris.connections import DorisCredentials
from dbt.adapters.doris.relation import DorisRelation
from dbt.adapters.doris.column import DorisColumn
from dbt.adapters.doris... | 1.390625 | 1 |
revelation/core/urls.py | Federico-Comesana/revelatte | 0 | 32026 | <reponame>Federico-Comesana/revelatte
from django.contrib.auth.decorators import login_required
from django.conf.urls import url
import views
urlpatterns = [
url(r'public/$',
views.RevelationModelListView.as_view(),
name='revelation-list'),
url(r'u/(?P<pk>\d+)/$',
views.UserProfileVie... | 2.015625 | 2 |
pycarddav/controllers.py | mathstuf/pycarddav | 0 | 32027 | #!/usr/bin/env python
# coding: utf-8
# vim: set ts=4 sw=4 expandtab sts=4:
# Copyright (c) 2011-2013 <NAME> & contributors
#
# 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 restricti... | 1.679688 | 2 |
_test_request.py | arshadkazmi42/crul | 6 | 32028 | <filename>_test_request.py
import unittest
from unittest.mock import Mock, patch
from request import Request
RESPONSE = {
"status": "success",
"message": "Processed"
}
class Response:
def __init__(self):
self.text = RESPONSE['message']
def json(self):
return RESPONSE
mock_respons... | 3.234375 | 3 |
kirbytoolkit/tests/test_jackknife.py | matthewkirby/kirby_toolkit | 0 | 32029 | <filename>kirbytoolkit/tests/test_jackknife.py
import numpy as np
import kirbytoolkit as ktk
def test_jackknife_arr():
arr = [1, 2, 2, 3, 4]
jkvar_true = 0.26
jkvar_code = ktk.jackknife_array(arr)
np.testing.assert_almost_equal(jkvar_code, jkvar_true, decimal=7)
# Test a longer array
arr = np... | 2.578125 | 3 |
demo-001.py | zhouyuanmin/MyCode | 1 | 32030 | <reponame>zhouyuanmin/MyCode
"""
使用装饰器限制函数的调用次数
"""
import functools
def call_limit(count):
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kw):
if decorator.calls >= count:
raise AssertionError(f"单个程序最多允许调用此方法{count}次")
decorator.calls += ... | 3.328125 | 3 |
test/tests/set.py | jvkersch/pyston | 0 | 32031 | <gh_stars>0
s1 = {1}
def sorted(s):
l = list(s)
l.sort()
return repr(l)
s1 = set() | set(range(3))
print sorted(s1)
s2 = set(range(1, 5))
print sorted(s2)
print repr(sorted(s1)), str(sorted(s1))
print sorted(s1 - s2)
print sorted(s2 - s1)
print sorted(s1 ^ s2)
print sorted(s1 & s2)
print sorted(s1 | s2)... | 3.53125 | 4 |
scripts/gen_train_test.py | wesleylp/CPE775 | 13 | 32032 | <reponame>wesleylp/CPE775
import os
import argparse
import glob
import pandas as pd
from cpe775 import utils
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('data_dir', metavar='DIR')
parser.add_argument('--out-dir', metavar='DIR')
args = parser.parse_args()
# ... | 2.65625 | 3 |
plot.py | corollari/gradient-descent | 1 | 32033 | <gh_stars>1-10
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import random
from sympy import symbols, diff, N
def fun(X, Y):
return 2*(np.exp(-X**2 - Y**2))# - np.exp(-(X - 1)**2 - (Y - 1)**2))
def symfun(X, Y):
return 2*(np.exp(1)**(-X**2 - Y**2))# - np.exp(1... | 2.40625 | 2 |
src/app.py | reinzor/selfieboot2016 | 0 | 32034 | <reponame>reinzor/selfieboot2016
'''
Selfiebooth <NAME> 2016 - CameraPuzzle
===========================
This demonstrates using Scatter widgets with a live camera.
You should see a shuffled grid of rectangles that make up the
camera feed. You can drag the squares around to see the
unscrambled camera feed or double cli... | 2.765625 | 3 |
deploy/test.py | zhxiaohe/starwars_api | 0 | 32035 | <reponame>zhxiaohe/starwars_api
#coding=utf-8
import requests,json
headers = {'X-Rundeck-Auth-Token': '<KEY>','Accept': 'application/json'}
headers['Content-type']='application/json'
rundeck_host= 'http://10.1.16.26:4440'
url = rundeck_host+'/api/16/project/fengyang/run/command'
data={
'project':'fengyang',
... | 2.28125 | 2 |
app/models/payments.py | StartFuture/workstation-backend | 1 | 32036 | import re
from flask_restful import Resource, reqparse
acceptedCreditCards = {
"visa": r"/^4[0-9]{12}(?:[0-9]{3})?$/",
"mastercard": r"/^5[1-5][0-9]{14}$|^2(?:2(?:2[1-9]|[3-9][0-9])|[3-6][0-9][0-9]|7(?:[01][0-9]|20))[0-9]{12}$/",
"amex": r"/^3[47][0-9]{13}$/",
"discover": r"/^65[4-9][0-9]{13}|64[4-9][0-9]{13}|... | 2.875 | 3 |
jmeter_api/configs/http_cache_manager/test_http_cache_manager.py | dashawn888/jmeter_api | 11 | 32037 | <filename>jmeter_api/configs/http_cache_manager/test_http_cache_manager.py<gh_stars>10-100
import xmltodict
import pytest
from jmeter_api.configs.http_cache_manager.elements import HTTPCacheManager
from jmeter_api.basics.utils import tag_wrapper
class TestHTTPCacheManagerArgs:
class TestClearCacheEachIteration:
... | 2.453125 | 2 |
main/configuration/token_config.py | anderswodenker/sams-app | 0 | 32038 | <filename>main/configuration/token_config.py
import configparser
import mapping
from main.helper.time_helper import get_token_time
class TokenConfig:
def __init__(self):
self.config = configparser.ConfigParser()
self.config_data = self.config['DEFAULT']
self.config.read(mapping.token_confi... | 2.8125 | 3 |
tests/data/dos.py | granrothge/multiphonon | 1 | 32039 | <reponame>granrothge/multiphonon
#!/usr/bin/env python
#
# <NAME> <<EMAIL>>
import os
datadir = os.path.abspath(os.path.dirname(__file__))
def loadDOS():
f = os.path.join(datadir, 'V-dos.dat')
from multiphonon.dos import io
E, Z, error = io.fromascii(f)
from multiphonon.dos.nice import nice_dos
E,... | 1.929688 | 2 |
weather/Weather.py | Eajay/chatting-bot-with-tasks | 0 | 32040 | <reponame>Eajay/chatting-bot-with-tasks
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
import re
import pymysql
import geocoder
import datetime
import os
class Weather:
def __init__(self, host, user, passwd, db, port):
settings_file_path = 'weath... | 2.71875 | 3 |
tests/test_networks/test_brokers/test_publishers/test_producers.py | Clariteia/minos_microservice_networks | 7 | 32041 | import asyncio
import unittest
from asyncio import (
gather,
sleep,
)
from unittest.mock import (
AsyncMock,
call,
)
from uuid import (
uuid4,
)
import aiopg
from minos.common import (
NotProvidedException,
)
from minos.common.testing import (
PostgresAsyncTestCase,
)
from minos.networks i... | 2.25 | 2 |
text_collector/spiders/sumut_go.py | gusman/web-crawler | 0 | 32042 | <gh_stars>0
import scrapy
import datetime
import re
from datetime import timedelta
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
class ItemNews(scrapy.Item):
date = scrapy.Field()
title = scrapy.Field()
content = scrapy.Field()
class SultraZonaSpider(scrapy.S... | 2.59375 | 3 |
test/conftest.py | eliasbrange/aws-cdk-template | 2 | 32043 | <filename>test/conftest.py
import os.path as op
import sys
path = op.abspath(op.join(op.dirname(op.realpath(__file__)), "..", "src"))
sys.path.append(path)
| 1.625 | 2 |
addons/stock_landed_costs/models/account_move.py | SHIVJITH/Odoo_Machine_Test | 0 | 32044 | <filename>addons/stock_landed_costs/models/account_move.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class AccountMove(models.Model):
_inherit = 'account.move'
landed_costs_ids = fields.One2many('stock.landed.cost'... | 2.21875 | 2 |
examples/highcharts/pie-donut.py | Jbrunn/python-highcharts | 370 | 32045 | # -*- coding: utf-8 -*-
"""
Highcharts Demos
Donut chart: http://www.highcharts.com/demo/pie-donut
"""
from highcharts import Highchart
H = Highchart(width = 850, height = 400)
data = [{
'y': 55.11,
'color': 'Highcharts.getOptions().colors[0]',
'drilldown': {
'name'... | 2.484375 | 2 |
computer_firm.py | GYosifov88/Python-Basics | 0 | 32046 | number_of_computers = int(input())
number_of_sales = 0
real_sales = 0
made_sales = 0
counter_sales = 0
total_ratings = 0
for i in range (number_of_computers):
rating = int(input())
rating_scale = rating % 10
possible_sales = rating // 10
total_ratings += rating_scale
if rating_scale == 2:
r... | 3.9375 | 4 |
cogs/messages.py | abdieg/cirila-bot-discord | 0 | 32047 | import discord
import os
import asyncio
from discord.ext import commands
from random import randint
from cogs.libs import Settings
from cogs.libs import Utils
class Messages(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, message):
... | 2.65625 | 3 |
features/best_move.py | raaahuuulll/chess-concepts | 0 | 32048 | <reponame>raaahuuulll/chess-concepts<gh_stars>0
from features.move import Move
class BestMove(Move):
# TODO: replace this with an attribute which specifies columns
@classmethod
def from_row(cls, row):
return cls(row.fen, row.best_move)
def features(self, prefix=None):
return super(Be... | 2.890625 | 3 |
util.py | logonod/demoss | 0 | 32049 | <reponame>logonod/demoss
import skimage.io
import skimage.transform
import numpy as np
def load_image( path ):
try:
img = skimage.io.imread( path ).astype( float )
except:
return None
if img is None: return None
if len(img.shape) < 2: return None
if len(img.shape) == 4: return No... | 2.53125 | 3 |
adgbot/slack.py | astrodatagroup/slack-bot | 2 | 32050 | <reponame>astrodatagroup/slack-bot
# -*- coding: utf-8 -*-
__all__ = ["post_message"]
import requests
from . import config
def post_message(message):
secrets = config.SLACK_JSON
r = requests.post(secrets["webhook_url"], json=dict(text=message))
r.raise_for_status()
| 2.046875 | 2 |
train_lirpa.py | eth-sri/3dcertify | 9 | 32051 | import argparse
import multiprocessing
import random
import time
import torch.optim as optim
from auto_LiRPA.eps_scheduler import LinearScheduler, AdaptiveScheduler, SmoothedScheduler, FixedScheduler
from auto_LiRPA.perturbations import *
from auto_LiRPA.utils import MultiAverageMeter
from torch.nn import CrossEntropy... | 1.929688 | 2 |
qcs_api_client/models/client_application.py | rigetti/qcs-api-client-python | 2 | 32052 | <reponame>rigetti/qcs-api-client-python
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union
import attr
from ..models.client_applications_download_link import ClientApplicationsDownloadLink
from ..types import UNSET, Unset
from ..util.serialization import is_not_none
T = TypeVar("T", bound="... | 1.992188 | 2 |
Configuration/Eras/python/Modifier_run2_GEM_2017_cff.py | ckamtsikis/cmssw | 852 | 32053 | <reponame>ckamtsikis/cmssw<filename>Configuration/Eras/python/Modifier_run2_GEM_2017_cff.py
import FWCore.ParameterSet.Config as cms
run2_GEM_2017 = cms.Modifier()
| 1.125 | 1 |
d4rl/carla/data_collection_agent_lane.py | chappers/d4rl | 552 | 32054 | # !/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
# Modified by <NAME> on 20 April 2020
import argparse
import datetime
impo... | 2.3125 | 2 |
wren/pomo.py | kthy/wren | 1 | 32055 | <reponame>kthy/wren
# -*- coding: utf-8 -*-
"""Gettext manipulation methods."""
from os import remove
from os.path import exists
from pathlib import Path
from shutil import copyfile, copystat
from typing import Sequence
from filehash import FileHash
from polib import MOFile, POFile, mofile
from wren.change import Ch... | 2.546875 | 3 |
mysite/polls/urls.py | cs-fullstack-fall-2018/django-intro1-psanon19 | 0 | 32056 | <reponame>cs-fullstack-fall-2018/django-intro1-psanon19<gh_stars>0
from django.urls import path
from . import views
urlpatterns = [
path('language/', views.language),
path('system/', views.system),
path('ide/', views.ide),
path('', views.nothing)
] | 1.578125 | 2 |
Boston_House_Prices.py | Anuska-Ghosh2002/bostonproj | 0 | 32057 | <filename>Boston_House_Prices.py
import streamlit as st
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
from sklearn.datasets import load_boston
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.linear_model import ... | 3.953125 | 4 |
tests/controller/worker/test_worker_manager.py | scailfin/flowserv-core | 1 | 32058 | <filename>tests/controller/worker/test_worker_manager.py
# This file is part of the Reproducible and Reusable Data Analysis Workflow
# Server (flowServ).
#
# Copyright (C) 2019-2021 NYU.
#
# flowServ is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for mo... | 2.609375 | 3 |
pyconcz/announcements/migrations/0002_announcement_font_size.py | martinpucala/cz.pycon.org-2019 | 6 | 32059 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-11 05:18
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('announcements', '0001_initial'),
]
operations = [
... | 1.695313 | 2 |
docs/_ext/db_tables_extension.py | wdr-data/wdr-okr | 2 | 32060 | <reponame>wdr-data/wdr-okr
"""Custom Sphinx extension to inject database documentation into a ReST document."""
from docutils import nodes
from docutils.parsers.rst import Directive
import sys
import os
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = ... | 1.875 | 2 |
vb2py/PythonCard/__init__.py | ceprio/xl_vb2py | 0 | 32061 | <gh_stars>0
"""
Created: 2001/08/05
Purpose: Turn PythonCard into a package
__version__ = "$Revision: 1.1.1.1 $"
__date__ = "$Date: 2001/08/06 19:53:11 $"
"""
| 1.25 | 1 |
xschem/bandgap_opamp/test/bandgap_bmr_test_op.py | yrrapt/caravel_amsat_txrx_ic | 15 | 32062 | import SpiceInterface
import TestUtilities
# create the test utility object
test_utilities_obj = TestUtilities.TestUtilities()
test_utilities_obj.netlist_generation('bandgap_opamp_test_op.sch', 'rundir')
# create the spice interface
spice_interface_obj = SpiceInterface.SpiceInterface(netlist_path="rundir/bandgap_opa... | 2.0625 | 2 |
cloudmesh-exercises/cloudmesh-common-2.py | cybertraining-dsc/fa19-516-170 | 0 | 32063 | # fa19-516-170 E.Cloudmesh.Common.2
from cloudmesh.common.dotdict import dotdict
color = {"red": 255, "blue": 255, "green": 255, "alpha": 0}
color = dotdict(color)
print("A RGB color: ", color.red, color.blue, color.green, color.alpha) | 2.71875 | 3 |
ex18.py | arunkumarang/python | 0 | 32064 | <gh_stars>0
#this one is like your scripts with argv
def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
#ok, the *args is actually pointless, we can just do this
def print_two_again(arg1, arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)
#this just takes one argument
def prin... | 3.578125 | 4 |
study_tool/entities/menu.py | cubeman99/russian-study-tool | 0 | 32065 | <filename>study_tool/entities/menu.py<gh_stars>0
from enum import IntEnum
import os
import pygame
import random
import time
import cmg
import cmg.mathlib
from cmg.application import *
from cmg.graphics import *
from cmg.input import *
from study_tool.config import Config
from study_tool.entities.entity import Entity
... | 2.578125 | 3 |
zhangwei_helper/function/Regedit.py | zwzw911/zhangwei_helper | 0 | 32066 | '''
对windows的注册表进行操作
_open_key: 返回key
_read_key_value:读取key下一个value的值和类型
_save_key_value:以某种类型的方式,把值保存到某个key中
read_PATH_value:读取环境变量PATH的值
append_value_in_PATH:为PATH添加一个值
del_value_in_PATH:从PATH中删除一个值
check_key_value_exists(key,value_name):检查某个key小,value_name是否存在
create_value(key,value_name,value_type,value): 直接调用_sav... | 2.578125 | 3 |
deep_staple/HybridIdLoader.py | multimodallearning/deep_staple | 0 | 32067 | import warnings
from collections.abc import Iterable
from collections import OrderedDict
import torch
import numpy as np
from torch.utils.data import Dataset
from deep_staple.utils.torch_utils import interpolate_sample, augmentNoise, spatial_augment, torch_manual_seeded, ensure_dense
from deep_staple.utils.common_uti... | 1.757813 | 2 |
scripts/model_assembly/parquet_explorer.py | rsulli55/automates | 17 | 32068 | <gh_stars>10-100
import sys
import json
import pandas as pd
def main():
parquet_filename = sys.argv[1]
json_filename = parquet_filename.replace(".parquet", ".json")
print(json_filename)
parquet_df = pd.read_parquet(parquet_filename)
parquet_json = parquet_df.to_json()
parquet_data = json.loa... | 2.578125 | 3 |
day02/main.py | aschmied/advent-of-code-2020 | 0 | 32069 | <reponame>aschmied/advent-of-code-2020<filename>day02/main.py<gh_stars>0
def main():
valid_passwords_by_range_policy = 0
valid_passwords_by_position_policy = 0
with open('input') as f:
for line in f:
policy_string, password = parse_line(line.strip())
policy = Policy.parse(pol... | 3.578125 | 4 |
captcha_cnn/runbycolab.py | Rhysn/captcha_break | 0 | 32070 | <reponame>Rhysn/captcha_break
#! /usr/bin/python3
# coding:utf-8
#pip install graphic-verification-code
from captcha.image import ImageCaptcha
import random,gvcode
import numpy as np
import tensorflow as tf
number = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h... | 2.78125 | 3 |
progs/PyEpoch-master/PyEpoch-master/example.py | am-3/TimeZoned | 0 | 32071 | <reponame>am-3/TimeZoned
# PyEpoch Module Example File.
import pyepoch
# -- TODAY() --
# The today() function returns today's date.
today = pyepoch.today()
print("Today's date & time:")
print(today)
# -- TIMEZONE() --
# The timezone() function returns a date with a different timezone.
# timezone() takes two(2) arg... | 3.90625 | 4 |
plugins.disable/warpy_plugin/warpy_plugin.py | StarryPy/StarryPy-Historic | 38 | 32072 | # -*- coding: UTF-8 -*-
from base_plugin import SimpleCommandPlugin
from plugins.core.player_manager_plugin import permissions, UserLevels
from utility_functions import build_packet, move_ship_to_coords, extract_name
from packets import (
Packets,
WarpAliasType,
WarpWorldType,
WarpActionType,
player... | 2.6875 | 3 |
sum/4-sum-II.py | windowssocket/py_leetcode | 3 | 32073 | # LTE using two pointers O(n**3)
class Solution(object):
def fourSumCount(self, A, B, C, D):
# corner case:
if len(A) == 0:
return 0
A.sort()
B.sort()
C.sort()
D.sort()
count = 0
for i in range(len(A)):
for j in range(len(B)... | 3.15625 | 3 |
event/filetype_check_pull_request_handler.py | micnncim/spinnakerbot | 0 | 32074 | <reponame>micnncim/spinnakerbot
from .handler import Handler
from .pull_request_event import GetPullRequest, GetRepo
format_message = ('We prefer that non-test backend code be written in Java or Kotlin, rather ' +
'than Groovy. The following files have been added and written in Groovy:\n\n' +
'{}\n\n' ... | 2.390625 | 2 |
venv/lib/python3.8/site-packages/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py | Retraces/UkraineBot | 2 | 32075 | /home/runner/.cache/pip/pool/8f/3e/26/6ee86ef4171b7194b098a053f1e488bca8ba920931fd5f9fb809ad9a37 | 0.761719 | 1 |
deployment/code/scp-03-Permission.py | weiping-bj/SCP-Workaround-in-AWS-ChinaRegions | 1 | 32076 | <filename>deployment/code/scp-03-Permission.py
import json
import os
import boto3
topicArn = os.environ['TOPIC_ARN']
assumedRole = os.environ['ASSUMED_ROLE']
scpBoundary = os.environ['SCP_BOUNDARY_POLICY']
sns_client = boto3.client('sns')
sts_client = boto3.client('sts')
def lambda_handler(event, context):
prin... | 2.234375 | 2 |
betfairlightweight/endpoints/navigation.py | rozzac90/betfair | 1 | 32077 | from requests import ConnectionError
from ..exceptions import APIError
from ..utils import check_status_code
from .baseendpoint import BaseEndpoint
class Navigation(BaseEndpoint):
"""
Navigation operations.
"""
def list_navigation(self, session=None):
"""
This Navigation Data for App... | 2.734375 | 3 |
datasets/fbp_dataset.py | Zumo09/Feedback-Prize | 0 | 32078 | <gh_stars>0
import os
from tqdm import tqdm
from functools import reduce
from typing import Dict, List, Callable, Tuple
import numpy as np
import pandas as pd
from sklearn.preprocessing import OrdinalEncoder
import torch
from torch.utils.data import Dataset
class FBPDataset(Dataset):
def __init__(
self,... | 2.140625 | 2 |
mtw/fl_user/urls.py | sukumar1612/medical-transcription-website | 2 | 32079 | <gh_stars>1-10
from django.urls import path
from fl_user import views
app_name = 'fl_user'
urlpatterns = [
path('receive_data/',views.receive_data, name='receive_data'),
path('doctorhome/', views.doctorhome, name='doctorhome'),
path('fluhome/', views.fluhome, name='fluhome'),
path('sluhome/', views.s... | 1.65625 | 2 |
check_purefa_hw.py | frank-m/nagios-plugins | 0 | 32080 | #!/usr/bin/env python
# Copyright (c) 2018, 2019, 2020 Pure Storage, Inc.
#
# * Overview
#
# This short Nagios/Icinga plugin code shows how to build a simple plugin to monitor Pure Storage FlashArrays.
# The Pure Storage Python REST Client is used to query the FlashArray.
#
# * Installation
#
# The script should be co... | 2.375 | 2 |
flaskr/models.py | ukeskin/cevrimici-kitap-galerisi | 0 | 32081 | <gh_stars>0
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired
from database import db
class User(object):
def __init__(self, name, avatar, email, password):
self.name = name
self.email = email
self.password = password... | 3.03125 | 3 |
project/interpreter_gql/interpreter_utils/set_operations.py | makar-pelogeiko/formal-lang-course | 0 | 32082 | <filename>project/interpreter_gql/interpreter_utils/set_operations.py
from pyformlang.regular_expression import Regex
from pyformlang.regular_expression.regex_objects import Symbol
from project.interpreter_gql.memory import MemBox
from project.interpreter_gql.interpreter_utils.type_utils import get_target_type
from pro... | 2.40625 | 2 |
2021/day-09/solve.py | alexandru-dinu/aoc-2020 | 1 | 32083 | from __future__ import annotations
from argparse import ArgumentParser
from collections import deque
import numpy as np
def count_lte(mat: np.ndarray) -> np.ndarray:
"""
lte[i,j] = count (neighbours <= mat[i,j])
. t .
l . r
. b .
"""
aug = np.pad(mat.astype(float), (1, 1), mode="constant... | 2.671875 | 3 |
applications/tensorflow2/image_classification/data/data_transformer.py | payoto/graphcore_examples | 260 | 32084 | <reponame>payoto/graphcore_examples
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import tensorflow as tf
from tensorflow.python.ops import math_ops
import logging
from . import imagenet_processing
from custom_exceptions import UnsupportedFormat, DimensionError
class DataTransformer:
logger = loggin... | 2.421875 | 2 |
social/urls.py | zhongmei57485/SwiperPro | 0 | 32085 | <reponame>zhongmei57485/SwiperPro<gh_stars>0
from django.urls import path
from social import apis
urlpatterns=[
path('recommend',apis.recommend),
path('like',apis.like),
path('dislike',apis.dislike),
path('superlike',apis.superlike),
path('rewind',apis.rewind),
path('like-me',apis.like_me),
] | 1.734375 | 2 |
GPIB_Control.py | TheHWcave/GPIB-to-USB | 7 | 32086 | <reponame>TheHWcave/GPIB-to-USB
#MIT License
#
#Copyright (c) 2019 TheHWcave
#
#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 us... | 1.515625 | 2 |
scripts/check_spec.py | soasme/PeppaPEG | 30 | 32087 | <reponame>soasme/PeppaPEG
import os.path
import subprocess
import sys
import json
import yaml
import shlex
def test_spec():
executable = sys.argv[1]
specs_file = sys.argv[2]
if specs_file.endswith('.json'):
with open(specs_file) as f:
try:
specs = json.load(f)
... | 2.640625 | 3 |
interlacer/utils.py | MedicalVisionGroup/interlacer | 0 | 32088 | import numpy as np
import tensorflow as tf
def split_reim(array):
"""Split a complex valued matrix into its real and imaginary parts.
Args:
array(complex): An array of shape (batch_size, N, N) or (batch_size, N, N, 1)
Returns:
split_array(float): An array of shape (batch_size, N, N, 2) conta... | 3.375 | 3 |
workspace/src/barc/src/modify_cam_param.py | Cyphysecurity/darc | 1 | 32089 | #!/usr/bin/env python
'''
modify camera parameters using v4l
'''
import os
# change /dev/video6 resolution
#os.system('v4l2-ctl -d /dev/video6 -v width=640,height=480')
os.system('v4l2-ctl -d /dev/video6 -v width=160,height=120')
| 2.140625 | 2 |
GenerateSyntheticData.py | dragonfly-asl/SyntheticDataGenerator | 0 | 32090 | # /bin/env python
# coding: utf-8
from __future__ import print_function
import sys
import argparse
import logging
import os
import math
import cv2
import numpy as np
class GenerateSyntheticData:
import PythonMagick as Magick
def __init__(self, logger=None):
if logger == None:
logging.b... | 2.546875 | 3 |
front/services/ingest_matches_service.py | jimixjay/acestats | 0 | 32091 | from service_objects import services
import numpy as np
import pandas as pd
from django.db import connection
import datetime
from front.models import Match, Match_Stats, Player, Tourney, Tourney_Level, Surface
class IngestMatchesService(services.Service):
def process(self):
cursor = connection.cursor()
... | 2.5 | 2 |
test/test_websocket.py | lmacken/binance-chain-python | 22 | 32092 | <reponame>lmacken/binance-chain-python<filename>test/test_websocket.py
# Copyright 2019, <NAME>, <NAME>, and the binance-chain-python contributors
# SPDX-License-Identifier: MIT
"""
Binance DEX WebSocket Test Suite
"""
import asyncio
import pytest
from binancechain import HTTPClient, WebSocket
def on_error(msg):
... | 2.359375 | 2 |
opentaxii/config.py | eclecticiq/OpenTAXII | 84 | 32093 | <filename>opentaxii/config.py<gh_stars>10-100
import os
from collections import defaultdict
import yaml
from libtaxii.constants import ST_TYPES_10, ST_TYPES_11
current_dir = os.path.dirname(os.path.realpath(__file__))
ENV_VAR_PREFIX = 'OPENTAXII_'
CONFIG_ENV_VAR = 'OPENTAXII_CONFIG'
DEFAULT_CONFIG_NAME = 'defaults.... | 2.6875 | 3 |
classifier/quant_trees.py | bradysalz/MinVAD | 0 | 32094 | <reponame>bradysalz/MinVAD<gh_stars>0
def tree_16b(features):
if features[12] <= 0.0026689696301218646:
if features[2] <= 0.00825153129312639:
if features[19] <= 0.005966400067336508:
if features[19] <= 0.0029812112336458085:
if features[17] <= 0.001915214421615019:
return 0
... | 2.328125 | 2 |
DS_Alog_Python/array_employeelist.py | abhigyan709/dsalgo | 1 | 32095 | <reponame>abhigyan709/dsalgo
class Employee:
def __init__(self, name, emp_id, email_id):
self.__name=name
self.__emp_id=emp_id
self.__email_id=email_id
def get_name(self):
return self.__name
def get_emp_id(self):
return self.__emp_id
def get_email_id(self):
... | 3.359375 | 3 |
build/lib/sshColab/code.py | libinruan/ssh_Colab | 1 | 32096 | import subprocess
import secrets
import getpass
import os
import requests
import urllib.parse
import time
from google.colab import files, drive, auth
from google.cloud import storage
import glob
def connect(LOG_DIR = '/log/fit'):
print('It may take a few seconds for processing. Please wait.')
root_password = s... | 2.171875 | 2 |
static/py/discussionNum.py | m1-llie/SCU_hotFollowing | 1 | 32097 | # -*- coding: utf-8 -*-
import pymysql
import json
def countNum(table):
# 打开数据库连接
db = pymysql.connect("cd-cdb-6sbfm2hw.sql.tencentcdb.com", "root", "Mrsnow@0", "spider")
# 使用cursor()方法创建一个可以执行SQL语句的游标对象cursor
cursor = db.cursor()
sql = "SELECT COUNT(*) FROM" + table + "WHERE text like '%川大%'"
... | 3.296875 | 3 |
python/ray/tests/test_list_actors.py | jianoaix/ray | 0 | 32098 | import pytest
import sys
import ray
from ray._private.test_utils import wait_for_condition
def test_list_named_actors_basic(ray_start_regular):
@ray.remote
class A:
pass
a = A.remote()
assert not ray.util.list_named_actors()
a = A.options(name="hi").remote()
assert len(ray.util.list... | 2.140625 | 2 |
python3/TableCloumnInfo.py | shengpli/LearnPython | 0 | 32099 | <filename>python3/TableCloumnInfo.py
class tablecloumninfo:
col_name=""
data_type=""
comment=""
def __init__(self,col_name,data_type,comment):
self.col_name=col_name
self.data_type=data_type
self.comment=comment
| 3.03125 | 3 |