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 |
|---|---|---|---|---|---|---|
core/migrations/0003_auto_20190805_1144.py | ArthurGorgonio/suggestclasses | 0 | 12795351 | <filename>core/migrations/0003_auto_20190805_1144.py
# Generated by Django 2.1.5 on 2019-08-05 14:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20190509_1508'),
]
operations = [
migrations.CreateModel(
... | 1.742188 | 2 |
rawdisk/scheme/__init__.py | dariusbakunas/rawdisk | 3 | 12795352 | <reponame>dariusbakunas/rawdisk
# -*- coding: utf-8 -*-
__all__ = ['mbr', 'gpt', 'common']
from . import common
from . import mbr
from . import gpt
| 1.023438 | 1 |
sewer/dns_providers/__init__.py | dnet/sewer | 0 | 12795353 | from .common import BaseDns # noqa: F401
from .auroradns import AuroraDns # noqa: F401
from .cloudflare import CloudFlareDns # noqa: F401
| 1.046875 | 1 |
expanse_su_estimator/sbatch_parser.py | alex-wenzel/expanse-su-estimator | 0 | 12795354 | <reponame>alex-wenzel/expanse-su-estimator
"""
This file defines a class that parses and represents an SBATCH submission
script
"""
class SBATCHScript:
def __init__(self, path):
self.path = path
self.args = {}
def __getitem__(self, key):
if type(key) == list:
return self.mu... | 2.75 | 3 |
bolinette/blnt/commands/__init__.py | bolinette/bolinette | 4 | 12795355 | from bolinette.blnt.commands.argument import Argument
from bolinette.blnt.commands.command import Command
from bolinette.blnt.commands.parser import Parser
| 1.289063 | 1 |
src/doc/overrides/.icons/convert.py | alexanderpann/mps-gotchas | 4 | 12795356 | <filename>src/doc/overrides/.icons/convert.py
import base64
import glob, os
def write_svg_file(svg_path, encoded_str):
with open(svg_path, "w") as text_file:
content = """
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32">
<ima... | 3.09375 | 3 |
docker_host/views.py | DisMosGit/Dodja | 0 | 12795357 | <gh_stars>0
from rest_framework.exceptions import PermissionDenied
from rest_framework.viewsets import ModelViewSet, ReadOnlyModelViewSet
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from rest_framework.decorators import action
from django.db.models import Q
from... | 2 | 2 |
shared/management/__init__.py | Saevon/webdnd | 4 | 12795358 | from django.db.models.signals import post_syncdb
from django.conf import settings
from django.core import management
import os
import re
FIXTURE_RE = re.compile(r'^[^.]*.json$')
def load_data(sender, **kwargs):
"""
Loads fixture data after loading the last installed app
"""
if kwargs['app'].__name__... | 2.09375 | 2 |
windpyutils/args.py | windionleaf/windPyUtils | 0 | 12795359 | <gh_stars>0
# -*- coding: UTF-8 -*-
""""
Created on 30.06.20
Module with wrapper that makes arguments parsers raising exceptions.
:author: <NAME>
"""
from argparse import ArgumentParser
class ArgumentParserError(Exception):
"""
Exceptions for argument parsing.
"""
pass
class ExceptionsArgument... | 2.5625 | 3 |
asyncClient/__main__.py | harveyspec1245/tcpClient | 0 | 12795360 | <reponame>harveyspec1245/tcpClient<gh_stars>0
from asyncClient import Clients
import sys
import getopt
if __name__ == '__main__':
_clients = 2
_data = 'Hello'
try:
opts, args = getopt.getopt(sys.argv[1:], "hd:c:", ["data=", "clients="])
except getopt.GetoptError as e:
print(e)
... | 2.59375 | 3 |
Max/Max_0160_20200409.py | Morek999/OMSCS_Taiwan_Leetcode | 1 | 12795361 | <filename>Max/Max_0160_20200409.py
"""
160. Intersection of Two Linked Lists
https://leetcode.com/problems/intersection-of-two-linked-lists/
Time complexity: O()
Space complexity: O()
"""
from typing import List
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# ... | 3.515625 | 4 |
django/reviewApp/admin.py | Akasiek/scorethatlp | 5 | 12795362 | from django.contrib import admin
from . import models
@admin.register(models.Reviewer)
class ReviewerAdmin(admin.ModelAdmin):
autocomplete_fields = ["user"]
list_display = ["username", "email"]
search_fields = ["username__istartswith"]
@admin.register(models.Album)
class AlbumAdmin(admin.ModelAdmin):
... | 2.046875 | 2 |
data_shift.py | zackchase/label_shift | 14 | 12795363 | import mxnet as mx
from mxnet import nd, autograd
import numpy as np
##################################3
# X, y - training data
# n - number of data points in dataset
# Py - desired label distribution
###################################
def tweak_dist(X, y, num_labels, n, Py):
shape = (n, *X.shape[1:])
Xsh... | 3.015625 | 3 |
v1.0.0.test/toontown/hood/AnimatedProp.py | TTOFFLINE-LEAK/ttoffline | 4 | 12795364 | <filename>v1.0.0.test/toontown/hood/AnimatedProp.py
from direct.showbase import DirectObject
from direct.directnotify import DirectNotifyGlobal
class AnimatedProp(DirectObject.DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('AnimatedProp')
def __init__(self, node):
self.node = node... | 2.0625 | 2 |
tests/test_microsoft_trans.py | nidhaloff/deep_translator | 118 | 12795365 | <filename>tests/test_microsoft_trans.py
#!/usr/bin/env python
"""Tests for `deep_translator` package."""
from unittest.mock import patch
import pytest
import requests
from deep_translator import MicrosoftTranslator, exceptions
# mocked request.post
@patch.object(requests, "post")
def test_microsoft_successful_pos... | 2.546875 | 3 |
build_newlib.py | codyd51/axle | 453 | 12795366 | <reponame>codyd51/axle<filename>build_newlib.py
#!/usr/bin/python3
import os
import tempfile
from pathlib import Path
from typing import Tuple
from build_utils import download_and_unpack_archive, run_and_check
def clone_tool_and_prepare_build_dir(build_dir: Path, url: str) -> Tuple[Path, Path]:
tool_src_dir = do... | 2.171875 | 2 |
bread/protocols/__init__.py | systocrat/bread | 11 | 12795367 | __all__ = [
'flash',
'http',
'irc',
'ssh2'
] | 1.078125 | 1 |
sdk/python/pulumiverse_unifi/get_network.py | pulumiverse/pulumi-unifi | 1 | 12795368 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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, overload
from . import ... | 1.921875 | 2 |
radinput/create_npy_files.py | ropewe56/simpleco2 | 0 | 12795369 | <filename>radinput/create_npy_files.py
import os
import numpy as np
import os, sys
from timeit import default_timer as timer
import platform
script_root = os.path.abspath(os.path.dirname(__file__))
def interpolate(x0, y0, n):
"""Interpolate data onto a equidistant grid with n grid points
Arguments:
... | 2.625 | 3 |
debug-app-qt/gen_linalgd.py | blaind/ttf2mesh | 63 | 12795370 | #!/usr/bin/env python
import sys
import os
#----------------------------------------------
file = open("linalgf.h", "r")
s = file.read()
file.close()
s = s.replace("LINALGF_H", "LINALGD_H");
s = s.replace("float", "double");
s = s.replace("mat2f", "mat2d");
s = s.replace("mat3f", "mat3d");
s = s.replace("mat4f", ... | 2.640625 | 3 |
aoc2020/day3.py | rfrazier716/aoc_2020 | 0 | 12795371 | <reponame>rfrazier716/aoc_2020
from pathlib import Path
import numpy as np
def tree_in_path(map_line,map_x_coord):
"""
Checks if a tree is in the x-cord of the map line, looping if x is > len(map_line)
returns: True if a tree is in the path, False otherwise
rtype: Bool
"""
offset = map_x_coor... | 3.953125 | 4 |
test_scrapy/test_scrapy/test.py | lijie28/python_demo | 0 | 12795372 | #coding=utf-8
import requests
from lxml import etree
url = 'http://weibo.cn/fishli28' #此处请修改为微博地址
url_login = 'https://login.weibo.cn/login/'
html = requests.get(url_login).content
selector = etree.HTML(html)
password = selector.xpath('//input[@type="password"]/@name')[0]
vk = selector.xpath('//input[@name="vk"]/@v... | 2.75 | 3 |
gradeit/visualization.py | NREL/gradeit | 0 | 12795373 | <reponame>NREL/gradeit<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
def plot_data(df, general_filter, plot_param):
if plot_param[0]:
# visualization of elevation data
if general_filter:
plt.plot(df['cumulative_uniform_distance_ft'], df['elevation_ft_filtered'],
... | 2.921875 | 3 |
src/main.py | UAws/dear-gitlab-workhorse-ee | 0 | 12795374 | from selenium_controller.github import Github
from selenium_controller.gitlab import Gitlab
from utils.shell_executor.executor import execute_now
def main():
github = Github()
gitlab = Gitlab()
new_tags = list()
execute_now('git fetch --all')
gitlab_versions = gitlab.fetch_gitlab_map_versions()... | 2.765625 | 3 |
examples/ecs/v1/tag.py | wangrui1121/huaweicloud-sdk-python | 43 | 12795375 | # -*-coding:utf-8 -*-
from openstack import connection
# create connection
username = "xxxxxx"
password = "<PASSWORD>"
projectId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" # tenant ID
userDomainId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" # user account ID
auth_url = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" # endpoint url
conn = connecti... | 2.34375 | 2 |
.github/workflows/set_env.py | kaleido-public/django-client-framework-typescript | 0 | 12795376 | #!/usr/bin/env python3
import os
from subprocess import CalledProcessError, run
from typing import Dict, List, Union
import json
from pathlib import Path
import click
__dir__ = Path(__file__).parent.absolute()
def github_repo_name() -> str:
if repo_full := os.environ.get("GITHUB_REPOSITORY"):
return re... | 2.21875 | 2 |
tests.py | MoritzS/licht | 2 | 12795377 | <reponame>MoritzS/licht<gh_stars>1-10
#!/usr/bin/env python
import struct
import unittest
from licht.base import LightColor
from licht.utils import RESERVED, Bitfield, Field, FieldType
class BitFieldTest(unittest.TestCase):
def assertFieldsEqual(self, field, field_dict):
for key, val in field_dict.items... | 2.6875 | 3 |
example.py | ebs-universe/cefkivy | 0 | 12795378 | <reponame>ebs-universe/cefkivy<gh_stars>0
from kivy.config import Config
Config.set('kivy', 'log_level', 'debug')
Config.set('kivy', 'keyboard_mode', 'systemandmulti')
from kivy_garden.ebs.cefkivy.browser import CefBrowser, cefpython
from kivy.app import App
class CefBrowserApp(App):
def build(self):
r... | 1.882813 | 2 |
twitter_scraper/models.py | debianitram/simple-twitter-scraper | 0 | 12795379 | from django.db import models
from django.db.models.signals import post_save
from . import tasks
### Define Querysets
class TwitterProfileQuerySet(models.QuerySet):
def search(self, query):
return self.filter(name__icontains=query)
class TaskQuerySet(models.QuerySet):
def search(self, query):
... | 2.15625 | 2 |
7th.py | writtik/Hactober-Fest-2020 | 0 | 12795380 | largest = -1
smallest = None
while True:
num = input("Enter a number: ")
if num == "done" :
break
try:
inum=int(num)
except:
print("Invalid Number")
if inum > largest:
largest=inum
if smallest is None:
smallest=inum
elif i... | 4.09375 | 4 |
CondCore/ESSources/test/python/load_from_globaltag_cfg.py | PKUfudawei/cmssw | 1 | 12795381 | from __future__ import print_function
import FWCore.ParameterSet.Config as cms
from Configuration.AlCa.autoCond import autoCond
process = cms.Process("TEST")
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(100) )
process.source = cms.Source("EmptyIOVSource",
lastV... | 1.710938 | 2 |
test/test_dataToCode/test_to_python/test_system/test_system.py | CoffeeOverflow/drawtocode | 9 | 12795382 | <filename>test/test_dataToCode/test_to_python/test_system/test_system.py
import pytest
import os
import filecmp
import subprocess
from src.dataToCode.dataClasses.attribute import Attribute
from src.dataToCode.dataClasses.classData import ClassData
from src.dataToCode.dataClasses.interface import Interface
from src.dat... | 2.390625 | 2 |
__init__.py | Sleemanmunk/approximate-randomization | 5 | 12795383 | from .approximate_randomization import meandiff, meanlt, meangt, chanceByChance | 0.921875 | 1 |
BurstCube/NoahSim/GRBgenerator.py | BurstCube/Simulation | 0 | 12795384 | <gh_stars>0
from healpy import nside2npix, pix2ang
class Sky():
"""
Generates an array of GRB's given
certains strength at different sky positions.
Output should be an array.
"""
def __init__(self, NSIDE, strength):
# depending on NSIDE, there will be anywhere
# from... | 2.71875 | 3 |
chapter_6/catnapping.py | aaronmccollum/automate-the-boring-stuff-with-python | 0 | 12795385 | # Using triple-quote marks to create a multiline string in Python
print('''Dear Alice,
Eve's cat has been arrested for catnapping, cat burglary, and extortion.
Sincerely,
Bob''')
| 3.671875 | 4 |
app/staff/views.py | swelanauguste/treasury_seo_system_1 | 0 | 12795386 | from django.contrib.messages.views import SuccessMessageMixin
from django.db.models import Q
from django.shortcuts import render
from django.views.generic import DetailView, ListView, UpdateView
from .forms import StaffUpdateForm
from .models import Staff
class SearchSearchView(ListView):
model = Staff
pagin... | 1.882813 | 2 |
core/pythonAction/pythonaction.py | samuelteixeiras/openwhisk | 0 | 12795387 | #
# Copyright 2015-2016 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 2.109375 | 2 |
datasets/ttf_utils.py | derwind/mxfont | 0 | 12795388 | <filename>datasets/ttf_utils.py<gh_stars>0
"""
MX-Font
Copyright (c) 2021-present NAVER Corp.
MIT license
"""
from fontTools.ttLib import TTFont
from fontTools.pens.basePen import BasePen
from PIL import Image, ImageFont, ImageDraw
import numpy as np
class StopDraw(Exception):
pass
class SpaceOrNotPen(BasePen):... | 2.265625 | 2 |
codes/edsr/model/srresnet.py | dnap512/SROD | 5 | 12795389 | # +
from model import common
import torch.nn as nn
import torch
from torch.autograd import Variable
import numpy.random as npr
import numpy as np
import torch.nn.functional as F
import random
import math
def make_model(args, parent=False):
return SRResNet(args)
class SRResNet(nn.Module):
def __init__(self, a... | 2.328125 | 2 |
kopen_of_huren.py | basnijholt/kopen-of-huren | 4 | 12795390 | <gh_stars>1-10
from collections import defaultdict
from functools import partial
from itertools import product
from numbers import Number
from typing import Any, Dict, Literal, Union
import matplotlib
import matplotlib.colors
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.optimize
... | 2.75 | 3 |
P5-Intro Machine Learning/exercises/text_learning/vectorize_text.py | lucasosouza/udacity-data-analysis | 0 | 12795391 | <reponame>lucasosouza/udacity-data-analysis
#!/usr/bin/python
import os
import pickle
import re
import sys
sys.path.append( "../tools/" )
from parse_out_email_text import parseOutText
"""
Starter code to process the emails from Sara and Chris to extract
the features and get the documents ready for classifica... | 2.796875 | 3 |
authentication/decorators.py | felix781/market-access-python-frontend | 1 | 12795392 | <reponame>felix781/market-access-python-frontend
def public_view(func):
"""
Decorator for public views that do not require authentication
"""
orig_func = func
orig_func._public_view = True
return func
| 1.96875 | 2 |
berts_of_a_feather/files_for_replication/process_test_results.py | tommccoy1/hans | 109 | 12795393 | import sys
prefix = sys.argv[1]
fi = open(prefix + "/" + "test_results.tsv", "r")
fo = open(prefix + "/" + "preds.txt", "w")
fo.write("pairID,gold_label\n")
counter = 0
labels = ["contradiction", "entailment", "neutral"]
for line in fi:
parts = [float(x) for x in line.strip().split("\t")]
max_ind = 0
max_val = ... | 2.546875 | 3 |
rosters/tests/test_views.py | Drazerr/roster-wizard | 0 | 12795394 | from django.http import HttpRequest
from django.test import SimpleTestCase
from django.urls import reverse
from .. import views
class HomePageTests(SimpleTestCase):
def test_home_page_status_code(self):
response = self.client.get("/")
self.assertEqual(response.status_code, 200)
def test_view... | 2.53125 | 3 |
SROMPy/target/UniformRandomVariable.py | datree-demo/SROMPy | 0 | 12795395 | <gh_stars>0
# Copyright 2018 United States Government as represented by the Administrator of
# the National Aeronautics and Space Administration. No copyright is claimed in
# the United States under Title 17, U.S. Code. All Other Rights Reserved.
# The Stochastic Reduced Order Models with Python (SROMPy) platform is l... | 2.28125 | 2 |
statsmodels/genmod/tests/test_gee.py | saedsaleh/statsmodels | 0 | 12795396 | """
Test functions for GEE
External comparisons are to R. The statmodels GEE implementation
should generally agree with the R GEE implementation for the
independence and exchangeable correlation structures. For other
correlation structures, the details of the correlation estimation
differ among implementations and t... | 2.46875 | 2 |
tools/write_clinrecconv.py | s-mackay/combinato | 34 | 12795397 | <reponame>s-mackay/combinato
# -*- coding: utf-8 -*-
# JN 2014-10-21
# script creates a clinRecConv.py from ncs files
import os
import numpy as np
from combinato import NcsFile
from matplotlib.dates import date2num
if __name__ == "__main__":
if os.path.exists('clinRecConv.py'):
print('File exists, doing n... | 2.5625 | 3 |
company/migrations/0020_auto_20210729_1526.py | uktrade/dnb-service | 4 | 12795398 | # Generated by Django 2.2.20 on 2021-07-29 15:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0019_auto_20210512_1114'),
]
operations = [
migrations.AlterField(
model_name='company',
name='address_a... | 1.554688 | 2 |
comparison_with_benchmark.py | KGkiotsalitis/bus-holding-model-under-capacity-limitations | 3 | 12795399 | <reponame>KGkiotsalitis/bus-holding-model-under-capacity-limitations<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import random
zeta=300
M_2=100000000000
M_1=100000000000000
a_n_plus_1s=2500
ta=1.5
tb=4
l_n_1=50
beta_n_1=10
c_n_plus_1=60
c_n=60
lambda_s=0.02
Hs=600
phi_n=62
t=1500
... | 2.09375 | 2 |
HarvardX/CS50W/flask/variables0/application.py | mohammedelzanaty/myRoad2BeFullStack | 2 | 12795400 | from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def index():
headline = "Hello World"
return render_template("index.html", headline=headline)
@app.route("/<string:name>")
def say_name(name):
return render_template("index.html", name=name)
if __name__ == "__main__":
... | 2.8125 | 3 |
src/reddit_bot.py | ooknosi/finite_dino_bot | 0 | 12795401 | #!/usr/bin/env python3
"""Reddit Bot Common Routines
Contains common Reddit bot functions such as keyword comment retrieval,
processed comment caching, and comment posting.
Allows bot authors to concentrate on writing their custom bot functions.
"""
from collections import deque
from os import mkdir
import re
impor... | 2.8125 | 3 |
autotweet/logger_factory.py | Kjwon15/autotweet | 5 | 12795402 | from __future__ import unicode_literals
import logging
root_logger = logging.getLogger('autotweet')
logging.basicConfig(
format='%(asctime)s {%(module)s:%(levelname)s}: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
def set_level(level):
root_logger.setLevel(level)
get_logger = root_logger.getChild
| 2.234375 | 2 |
temp-snn/snn/var_th.py | Tab-ct/Spiking-Neural-Network | 1 | 12795403 | ############################################## README #################################################
# This calculates threshold for an image depending upon its spiking activity.
########################################################################################################
import numpy as np
from snn.n... | 3.03125 | 3 |
configs/_base_/models/attnet_swin.py | 404479768/Swin-ATT | 1 | 12795404 | <reponame>404479768/Swin-ATT
norm_cfg = dict(type='SyncBN', requires_grad=True)
backbone_norm_cfg = dict(type='LN', requires_grad=True)
model = dict(
type='EncoderDecoder',
pretrained=None,
backbone=dict(
type='SwinTransformer',
pretrain_img_size=384,
embed_dims=128,
patch_si... | 1.414063 | 1 |
accounts/migrations/0002_auto_20201110_0811.py | Landgate/Staff-Calibration | 1 | 12795405 | # Generated by Django 3.1 on 2020-11-10 00:11
from __future__ import unicode_literals
from django.db import migrations, models
import csv
from datetime import datetime
def load_initial_data(apps, schema_editor):
Authority = apps.get_model("accounts", "Authority")
with open("assets/authority/authority_names.csv", ... | 2.203125 | 2 |
main_onnx.py | qzc438/pythonProject | 1 | 12795406 | # all the data from train data set, k-fold validation
import numpy as np
import onnxruntime
import torch
from pandas import read_csv
from tensorflow.python.keras.utils.np_utils import to_categorical
from sklearn.metrics import f1_score, recall_score, precision_score, accuracy_score
# load a single file as a numpy ar... | 2.671875 | 3 |
ProjectApplication/project_core/forms/person.py | code-review-doctor/project-application | 5 | 12795407 | from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div
from django import forms
from django.core.exceptions import ObjectDoesNotExist
from django.core.validators import RegexValidator, ValidationError
from django.forms import Form
from phonenumber_field.formfields import PhoneNumberField... | 2.265625 | 2 |
whole_cell_patch/paramWidget.py | 11uc/whole_cell_patch | 2 | 12795408 | # class derived from a GridLayout with a bunch of widgets
from PyQt5.QtWidgets import QLabel, QGridLayout, QLineEdit, \
QVBoxLayout, QHBoxLayout, QComboBox, QPushButton, QCheckBox
import numpy as np
import pandas as pd
class ParamWidget(QGridLayout):
'''
Collecting all the input boxes and labels to assign data.
... | 2.625 | 3 |
bioprocs/scripts/imtherapy/pTopiary.py | pwwang/biopipen | 2 | 12795409 | <reponame>pwwang/biopipen<gh_stars>1-10
"""
./topiary \
--vcf somatic.vcf \
--mhc-predictor netmhcpan \
--mhc-alleles HLA-A*02:01,HLA-B*07:02 \
--ic50-cutoff 500 \
--percentile-cutoff 2.0 \
--mhc-epitope-lengths 8-11 \
--rna-gene-fpkm-tracking-file genes.fpkm_tracking \
--rna-min-gene-expression 4.0 \
... | 1.53125 | 2 |
auth_api/auth_api/urls.py | rwreynolds/auth-api | 0 | 12795410 | from django.conf.urls import url, include
from django.contrib import admin
from rest_framework.documentation import include_docs_urls
from auth_api import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^docs/', include_docs_urls(title='Todo API', description='RESTful API for Todo')),
url(r... | 1.78125 | 2 |
hot_crawler/utils.py | wf1314/hot-crawler | 1 | 12795411 | <filename>hot_crawler/utils.py
import redis
from werkzeug.routing import BaseConverter
class RegexConverter(BaseConverter):
"""
正则匹配路由
"""
def __init__(self, url_map, *args):
super().__init__(url_map)
self.regex = args[0]
def get_redis(host='localhost', port=6379):
"""
获取redi... | 2.59375 | 3 |
app/tests/intergrations/test_opsgenie.py | cds-snc/sre-bot | 0 | 12795412 | <filename>app/tests/intergrations/test_opsgenie.py<gh_stars>0
from integrations import opsgenie
from unittest.mock import patch
@patch("integrations.opsgenie.api_get_request")
@patch("integrations.opsgenie.OPSGENIE_KEY", "OPSGENIE_KEY")
def test_get_on_call_users(api_get_request_mock):
api_get_request_mock.retur... | 2.25 | 2 |
japanese2phoneme/exceptions.py | iory/japanese2phoneme | 0 | 12795413 | <reponame>iory/japanese2phoneme<filename>japanese2phoneme/exceptions.py<gh_stars>0
class UnidentifiedJapaneseText(Exception):
def __init__(self, sentence, word):
super(UnidentifiedJapaneseText, self).__init__()
self.sentence = sentence
self.word = word
def __str__(self):
return... | 3.03125 | 3 |
N10189/main.py | carmocca/UVA | 3 | 12795414 | <gh_stars>1-10
import sys
def get_neighbours(row, col, rows, cols):
neighbours = []
for i in range(-1, 2):
for j in range(-1, 2):
if i == 0 and j == 0:
continue
elif -1 < row + i < rows and -1 < col + j < cols:
neighbours.append((row + i, col + j... | 3.21875 | 3 |
src/python/track_ic/corner_detection.py | SJungert/computer_gaze_tracking | 0 | 12795415 | <reponame>SJungert/computer_gaze_tracking
import cv2
import numpy as np
#filename = 'chessboard2.jpg'
#img = cv2.imread(filename)
#gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
def corner_detect(gray_input, img_input, row, col):
height, width = gray_input.shape
#print(height, width)
gray = gray_input
im... | 2.984375 | 3 |
code.py | kaushik0033/manipulating-data-with-numpy-code-along-practice | 0 | 12795416 | <filename>code.py
# --------------
import numpy as np
# Not every data format will be in csv there are other file formats also.
# This exercise will help you deal with other file formats and how toa read it.
from numpy import genfromtxt
my_data = genfromtxt(path, delimiter=',',skip_header=1)
# Number of unique matches ... | 3.8125 | 4 |
sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/_azure_machine_learning_workspaces.py | dubiety/azure-sdk-for-python | 1 | 12795417 | # 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 ... | 1.609375 | 2 |
test.py | olivetree123/Winney | 0 | 12795418 | <filename>test.py
from winney.winney import Address
from winney import Winney, retry
from winney.mock import Mock
class UserMock(Mock):
data = {"name": "olivetree"}
class UserCenter(object):
def __init__(self):
addr = Address(host="localhost", port=5000)
self.winney = Winney(host="localhost"... | 2.84375 | 3 |
AWSteria/src_Testbench_AWS/Top/Gen_Bytevec/Gen_Bytevec_Mux.py | zwadood/BESSPIN-CloudGFE | 0 | 12795419 | #!/usr/bin/python3 -B
# Copyright (c) 2020 <NAME>
# See README for details
# ================================================================
import sys
import os
import stat
import importlib
import pprint
from Gen_Bytevec_Mux_BSV import *
from Gen_Bytevec_Mux_C import *
pp = pprint.PrettyPrinter()
# =========... | 2.234375 | 2 |
worker/statistics/StatisticsPrinter.py | Larcius/gta5-modder-utils | 3 | 12795420 | <reponame>Larcius/gta5-modder-utils
import os
import re
from natsort import natsorted
from common.ymap.LodLevel import LodLevel
from common.ytyp.YtypItem import YtypItem
from common.ytyp.YtypParser import YtypParser
class StatisticsPrinter:
countProps: dict[str, dict[str, int]]
inputDir: str
ytypItems: ... | 2.171875 | 2 |
data.py | ilyakava/tfST | 0 | 12795421 | <gh_stars>0
import os
import numpy as np
import scipy.io as sio
def get_dataset(opt):
if opt.dataset == 'IP':
mat_contents = sio.loadmat(os.path.join(opt.data_root, 'Indian_pines_corrected.mat'))
data = mat_contents['indian_pines_corrected'].astype(np.float32)
data /= np.max(np.abs(data))
... | 2.5 | 2 |
callflow/modules/histogram_rank.py | jarusified/CallFlow | 2 | 12795422 | # Copyright 2017-2020 Lawrence Livermore National Security, LLC and other
# CallFlow Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: MIT
import pandas as pd
class RankHistogram:
def __init__(self, state, name):
self.graph = state.new_gf.graph
self.df =... | 2.40625 | 2 |
test_loader.py | hasancaslan/CountingBeautifulStrings | 0 | 12795423 | import os
def read_test_case(file_path):
"""
reads one test case from file.
returns contents of test case
Parameters
----------
file_path : str
the path of the test case file to read.
Returns
-------
list
a list of contents of the test case.
"""
file = op... | 3.65625 | 4 |
Q/questionnaire/views/views_errors.py | trubliphone/esdoc-test | 0 | 12795424 | <filename>Q/questionnaire/views/views_errors.py
####################
# ES-DOC CIM Questionnaire
# Copyright (c) 2017 ES-DOC. All rights reserved.
#
# University of Colorado, Boulder
# http://cires.colorado.edu/
#
# This project is distributed according to the terms of the MIT license [http://www.opensource.or... | 2.03125 | 2 |
python/lusol.py | Rioghasarig/sr-cur | 0 | 12795425 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 8 12:18:32 2022
@author: oekenta
"""
from ctypes import c_ulonglong, c_double, cdll, byref
import numpy as np
class lusol:
liblusol = 0
@classmethod
def loadlibrary(cls):
cls.liblusol = cdll.LoadLibrary('/home/grad/oekenta/sr-c... | 2.1875 | 2 |
reboot_required/tests/test_reboot_required.py | divyamamgai/integrations-extras | 158 | 12795426 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from os.path import isfile
def test_ok(aggregator, check, instance_ok):
assert isfile(instance_ok['created_at_file'])
check.check(instance_ok)
aggregator.assert_service_check('system.reboot_required', st... | 2.0625 | 2 |
src/network/assemble.py | BeholdersEye/PyBitmessage | 1,583 | 12795427 | <gh_stars>1000+
"""
Create bitmessage protocol command packets
"""
import struct
import addresses
from network.constants import MAX_ADDR_COUNT
from network.node import Peer
from protocol import CreatePacket, encodeHost
def assemble_addr(peerList):
"""Create address command"""
if isinstance(peerList, Peer):
... | 2.53125 | 3 |
Swin-Transformer/Model.py | HzcIrving/DLRL_PlayGround | 27 | 12795428 | #! /usr/bin/enc python
# -*- coding: utf-8 -*-
# author: <NAME>
# email: <EMAIL>
"""
Swin Transformer
1. 类似CNN的层次化构建方法(Hierarchical Feature Maps),特征图尺寸中有对图像下采样4倍、8倍、以及16倍;
这样的Backbone有助于再此基础上构建目标检测、实例分割等任务。
2. 使用Windows Multi-Head Self-Attention (W-MSA)概念。减少计算量。计算复杂度从指数级降到线性级,Multi-head
Self-Attention只在每个Window... | 2.328125 | 2 |
day04/test12.py | jaywoong/python | 0 | 12795429 | <reponame>jaywoong/python
st1 = '<EMAIL>'
print(len(st1))
print(st1.find('.'))
print(st1.rfind('.'))
print(st1.count('.'))
id = st1[:st1.find('@')]
print(id)
domain = st1[st1.find('@')+1:st1.find('.')]
print(domain) | 3.234375 | 3 |
src/python/reeborg_en.py | aroberge/reeborg-docs | 2 | 12795430 | """This module contains functions, classes and exceptions that can be
included in a Python program for Reeborg's World.
"""
# When generating documentation using sphinx, these modules are both
# unavailable and not needed
try:
from browser import window
RUR = window.RUR
except:
print("\n --> Skipping impor... | 3.078125 | 3 |
beluga/continuation/ContinuationSolution.py | Rapid-Design-of-Systems-Laboratory/beluga-legacy | 1 | 12795431 | class ContinuationSolution(list):
pass
| 0.960938 | 1 |
Dataset/Leetcode/valid/110/1057.py | kkcookies99/UAST | 0 | 12795432 | class Solution:
def XXX(self, root: 'TreeNode') -> 'bool':
if not root:
return True
if abs(self.maxDepth(root.left)-self.maxDepth(root.right))<=1:
# 这一点原本想错了
return self.XXX(root.left) and self.XXX(root.right)
return False
def maxDept... | 3.203125 | 3 |
src/data_structure/queue/queue.py | sujeek/python_base | 0 | 12795433 | <reponame>sujeek/python_base
class Queue:
def __init__(self):
self.queue = []
def insert(self, data):
if data is not None:
self.queue.insert(0,data)
return True
return False
def size(self):
return len(self.queue)
def pop(self):
if len(s... | 3.59375 | 4 |
tests/test_pp_inbox.py | KonnexionsGmbH/dcr | 2 | 12795434 | <reponame>KonnexionsGmbH/dcr<gh_stars>1-10
# pylint: disable=unused-argument
"""Testing Module pp.inbox."""
import os.path
import pathlib
import shutil
import cfg.cls_setup
import cfg.glob
import db.cls_db_core
import db.cls_run
import pytest
import utils
import dcr
# ------------------------------------------------... | 1.5625 | 2 |
smarkets/tests/streaming_api/utils.py | smarkets/smk_python_sdk | 20 | 12795435 | <reponame>smarkets/smk_python_sdk
from __future__ import absolute_import, division, print_function, unicode_literals
from nose.tools import eq_
from smarkets.streaming_api.seto import OrderCreate, Payload, PAYLOAD_ORDER_CREATE
from smarkets.streaming_api.utils import set_payload_message
def test_set_payload_message... | 2.0625 | 2 |
financial/calc_engines/factor_per_share_indicators_cal.py | wangjiehui11235/panther | 0 | 12795436 | # -*- coding: utf-8 -*-
import pdb, importlib, inspect, time, datetime, json
# from PyFin.api import advanceDateByCalendar
# from data.polymerize import DBPolymerize
from data.storage_engine import StorageEngine
import time
import pandas as pd
import numpy as np
from datetime import timedelta, datetime
from financial ... | 2.25 | 2 |
wack/scenes.py | tjusticelee/textytextgame | 0 | 12795437 | <gh_stars>0
from flask import (
Blueprint, flash, g, redirect, render_template, request, session, url_for
)
from werkzeug.exceptions import abort
bp = Blueprint('scenes', __name__)
@bp.route('/')
def index():
return render_template('scenes/index.html')
@bp.route('/home', methods=('GET', 'POST'))
def home():... | 2.53125 | 3 |
app/mysqltojson.py | imosudi/graphql | 1 | 12795438 | <filename>app/mysqltojson.py
from sqlalchemy import create_engine, inspect
import os, json
#import requests
import decimal, datetime
from .dbconnect import engine, alchemyencoder
#from .dbconnect import engine, alchemyencoder
pwd = os.path.dirname(os.path.abspath(__file__))
class flatToCascadedJson(object):
def ... | 2.515625 | 3 |
bfs/0261_graph_valid_tree.py | adwardlee/leetcode_solutions | 0 | 12795439 | '''
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.
样例
Example 1:
Input: n = 5 edges = [[0, 1], [0, 2], [0, 3], [1, 4]]
Output: true.
Example 2:
Input: n = 5 edges = [[0, 1], [1, 2], [2, 3], [1, 3... | 4.15625 | 4 |
flask_mailing/__init__.py | jfkinslow/flask-mailing | 0 | 12795440 | <reponame>jfkinslow/flask-mailing
from .mail import Mail
from .config import ConnectionConfig
from .schemas import (
Message as Message,
MultipartSubtypeEnum as MultipartSubtypeEnum
)
from . import utils
version_info = (0, 0, 6)
__version__ = ".".join([str(v) for v in version_info])
__author__ = "<EM... | 1.96875 | 2 |
books/books.py | rossgk2/cs257 | 0 | 12795441 | '''
books.py
Written by <NAME> and <NAME> for cs257
Revised by <NAME>
A command line interface for searching the 'books.csv' file.
'''
import csv
import argparse
def get_parsed_arguments():
# Set up command line arguments.
with open("prolog.txt", "r") as prolog, open("epilog.txt", "r") as epilog:
pars... | 3.28125 | 3 |
crosspm/contracts/contract.py | devopshq/crosspm2 | 3 | 12795442 | <reponame>devopshq/crosspm2
class Contract:
def __init__(self, name, values):
self.name = name
self.values = values
def __hash__(self):
return hash((self.name, self.values))
def __str__(self):
return "{}{}".format(self.name, self.values)
def __repr__(self):
ret... | 2.859375 | 3 |
grid_utils/gridder.py | claydodo/grid_utils | 0 | 12795443 | # -*- coding:utf-8 -*-
import six
import numpy as np
from pyproj import Proj
import operator
from .exceptions import *
class NullProj(object):
"""
Similar to pyproj.Proj, but NullProj does not do actual conversion.
"""
@property
def srs(self):
return ''
def __call__(self, x, y, **kw... | 2.484375 | 2 |
unitvelo/__init__.py | StatBiomed/UniTVelo | 0 | 12795444 | <filename>unitvelo/__init__.py
#%%
import os
from time import gmtime, strftime
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
try:
from setuptools_scm import get_version
__version__ = get_version(root="..", relative_to=__file__)
del get_version
except (LookupError, ImportError):
try:
from import... | 1.84375 | 2 |
mfgp/task1_new/utils/has_duplicates.py | kunalghosh/Multi_Fidelity_Prediction_GP | 0 | 12795445 | <reponame>kunalghosh/Multi_Fidelity_Prediction_GP<gh_stars>0
def has_duplicates(seq):
return len(seq) != len(set(seq))
| 1.789063 | 2 |
scan_service/tests/hardware_config_tests.py | kkkkv/tgnms | 12 | 12795446 | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import json
import unittest
from typing import List
from bidict import bidict
from scan_service.utils.hardware_config import HardwareConfig
class HardwareConfigTests(unittest.TestCase):
def setUp(self) -> None:
with open("tes... | 2.609375 | 3 |
task-library/efficientip/EipGetSubnetName.py | mlavi/blueprints | 60 | 12795447 | <reponame>mlavi/blueprints
#region headers
# * authors: <EMAIL>
# * date: 30/03/2020
# task_name: EipGetSubnets
# description: Get available networks attached to a site on EfficientIP
# input vars: eip_site_name, eip_min_free_ip
# output vars: subnet_lists
#endregion
# this script is used to retreive a... | 2.328125 | 2 |
lib_client/src/d1_client/tests/test_session.py | DataONEorg/d1_python | 15 | 12795448 | <filename>lib_client/src/d1_client/tests/test_session.py<gh_stars>10-100
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyrigh... | 1.875 | 2 |
src/myrl/environments/environment.py | erwanlecarpentier/myrl | 0 | 12795449 | """
Abstract environment class
"""
class Environment(object):
def __init__(self, name, actions, gamma):
self.name = name
self.actions = actions
self.gamma = gamma
def get_state_dimension(self):
return None
def get_state_dtype(self):
return None
def get_state... | 3.171875 | 3 |
backend/common/routes.py | dogzz9445/TAWeb | 0 | 12795450 | <filename>backend/common/routes.py
from common.api.views.base import RestViewSet
from common.api.views.analyzed import AnalyzedRestViewSet
routes = [
{'regex': r'rest', 'viewset': RestViewSet, 'basename': 'Rest'},
{'regex': r'analyzed', 'viewset': AnalyzedRestViewSet, 'basename': 'Analyzed'}
]
| 1.625 | 2 |