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 |
|---|---|---|---|---|---|---|
sorts/insertionSort/insertion_sort.py | JesseJMa/data-structure-and-algorithm | 0 | 12793851 | def insertion_sort(arr, l, r):
for i in range(l + 1, r + 1):
temp = arr[i]
index = i
while index > 0 and arr[index - 1] > temp:
arr[index] = arr[index - 1]
index -= 1
arr[index] = temp | 3.875 | 4 |
huaweicloud-sdk-scm/huaweicloudsdkscm/v3/model/show_certificate_response.py | huaweicloud/huaweicloud-sdk-python-v3 | 64 | 12793852 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowCertificateResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... | 2.359375 | 2 |
code/functions/segment/__init__.py | a9w/Fat2_polarizes_WAVE | 0 | 12793853 | <reponame>a9w/Fat2_polarizes_WAVE<filename>code/functions/segment/__init__.py
"""Functions for segmenting images."""
from .interface import (
interface_endpoints_mask,
interface_endpoints_coords,
interface_shape_edge_method,
trim_interface,
refine_junction,
edge_between_neighbors,
)
from .timel... | 1.84375 | 2 |
usecases/get_network.py | HathorNetwork/hathor-explorer-service | 0 | 12793854 | <gh_stars>0
from typing import Optional
from gateways.node_gateway import NodeGateway
class GetNetwork:
def __init__(self, node_gateway: Optional[NodeGateway] = None) -> None:
self.node_gateway = node_gateway or NodeGateway()
def get(self) -> Optional[dict]:
network = self.node_gateway.get_... | 2.796875 | 3 |
src/pytiger/utils/plugins.py | tigercomputing/pytiger | 1 | 12793855 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
A simple plugin loading mechanism
"""
# Copyright © 2015 Tiger Computing Ltd
# This file is part of pytiger and distributed under the terms
# of a BSD-like license
# See the file COPYING for details
# Idea borrowed and adapted from:
# https://copyninja.info/blog/dynamic-modu... | 2.578125 | 3 |
current_playing.py | BishoyAbdelmalik/Clippy-Server | 0 | 12793856 | import asyncio
import os
import json
from winrt.windows.media.control import \
GlobalSystemMediaTransportControlsSessionManager as MediaManager
from winrt.windows.storage.streams import \
DataReader, Buffer, InputStreamOptions
async def get_media_info():
sessions = await MediaManager.request_async()
#... | 2.609375 | 3 |
HLTrigger/Configuration/python/HLT_75e33/paths/L1T_DoubleTkMuon_15_7_cfi.py | PKUfudawei/cmssw | 1 | 12793857 | import FWCore.ParameterSet.Config as cms
#from ..modules.hltL1TkMuons_cfi import *
from ..modules.hltDoubleMuon7DZ1p0_cfi import *
from ..modules.hltL1TkDoubleMuFiltered7_cfi import *
from ..modules.hltL1TkSingleMuFiltered15_cfi import *
from ..sequences.HLTBeginSequence_cfi import *
from ..sequences.HLTEndSequence_cf... | 0.917969 | 1 |
src/autogen/eigs.py | ldXiao/polyfem | 228 | 12793858 | from sympy import *
from sympy.matrices import *
import os
import re
import argparse
# local
import pretty_print
def sqr(a):
return a * a
def trunc_acos(x):
tmp = Piecewise((0.0, x >= 1.0), (pi, x <= -1.0), (acos(x), True))
return tmp.subs(x, x)
def eigs_2d(mat):
a = mat[0, 0] + mat[1, 1]
del... | 2.5625 | 3 |
meridian/channels/gallbladder.py | sinotradition/meridian | 5 | 12793859 | #!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
from meridian.acupoints import tongziliao232
from meridian.acupoints import tinghui14
from meridian.acupoints import shangguan41
from meridian.acupoints import heyan24
from meridian.acupoints import xuanlu22
from meridian.acupoints import xuanli22
fr... | 1.359375 | 1 |
PopStats/model.py | haoruilee/DeepSets | 213 | 12793860 | <filename>PopStats/model.py
import torch
import torch.nn as nn
import torch.nn.functional as F
# from loglinear import LogLinear
class DeepSet(nn.Module):
def __init__(self, in_features, set_features=50):
super(DeepSet, self).__init__()
self.in_features = in_features
self.out_features = se... | 2.5 | 2 |
global_finprint/bruv/models.py | GlobalFinPrint/global_finprint | 0 | 12793861 | <filename>global_finprint/bruv/models.py
from decimal import Decimal
from collections import Counter
from django.contrib.gis.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from django.core.urlresolvers import reverse
from django.contrib.gis.geos import Point
from global_finpr... | 1.648438 | 2 |
connector/fyle_integrations_platform_connector/apis/reimbursements.py | fylein/fyle-integrations-platform-connector | 0 | 12793862 | <filename>connector/fyle_integrations_platform_connector/apis/reimbursements.py
from .base import Base
from apps.fyle.models import Reimbursement
class Reimbursements(Base):
"""Class for Reimbursements APIs."""
def __construct_query_params(self) -> dict:
"""
Constructs the query params for t... | 2.140625 | 2 |
query-csv-pandemic.py | puregome/queries | 0 | 12793863 | <filename>query-csv-pandemic.py<gh_stars>0
#/usr/bin/env python3
# query-csv-distance.py: extract social distancing tweets from csv file at stdin
# usage: gunzip -c file.csv.gz | python3 query-csv-test.py
# 20200525 erikt(at)xs4all.nl
import csv
import re
import sys
TOPICQUERY = "corona|covid|huisarts|mondkapje|rivm|... | 2.421875 | 2 |
test/hummingbot/core/data_type/test_trade_fee.py | pecuniafinance/hummingbot | 542 | 12793864 | from decimal import Decimal
from unittest import TestCase
from hummingbot.core.data_type.common import TradeType, PositionAction
from hummingbot.core.data_type.in_flight_order import TradeUpdate
from hummingbot.core.data_type.trade_fee import (
AddedToCostTradeFee,
DeductedFromReturnsTradeFee,
TokenAmount,... | 2.515625 | 3 |
deepinsight_iqa/diqa/utils/np_imgutils.py | sandyz1000/deepinsight-iqa | 2 | 12793865 | import math
import tensorflow as tf
import cv2
import numpy as np
from scipy import signal
def image_normalization(image: np.ndarray, new_min=0, new_max=255) -> np.ndarray:
"""
Normalize the input image to a given range set by min and max parameter
Args:
image ([type]): [description]
new_m... | 3.28125 | 3 |
Others/Source/02/2.3/hex_test.py | silence0201/Learn-Python | 1 | 12793866 | <reponame>silence0201/Learn-Python
# coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee <EMAIL> #
# ... | 3.34375 | 3 |
repos/system_upgrade/el7toel8/actors/detectgrubconfigerror/actor.py | adka1408/leapp-repository | 0 | 12793867 | <filename>repos/system_upgrade/el7toel8/actors/detectgrubconfigerror/actor.py
from leapp.actors import Actor
from leapp.libraries.actor.scanner import detect_config_error
from leapp.models import GrubConfigError
from leapp.reporting import Report
from leapp.libraries.common.reporting import report_generic
from leapp.ta... | 2.484375 | 2 |
mayan/apps/dynamic_search/links.py | Dave360-crypto/mayan-edms | 3 | 12793868 | from django.utils.translation import ugettext_lazy as _
search = {'text': _(u'search'), 'view': 'search', 'famfam': 'zoom'}
search_advanced = {'text': _(u'advanced search'), 'view': 'search_advanced', 'famfam': 'zoom_in'}
search_again = {'text': _(u'search again'), 'view': 'search_again', 'famfam': 'arrow_undo'}
| 1.882813 | 2 |
Python/Fluent_Python/chapter3/section7/s7_1.py | sunyunxian/test_lib | 1 | 12793869 | def decorator(func):
def inner():
print("Running inner()")
return inner
@decorator
def target():
print("Running target()")
def p_target():
print("Running target()")
if __name__ == "__main__":
target() # decorator(target)()
decorator(p_target) # no ouput
print(target) # <fun... | 3.234375 | 3 |
Tools/Asynchronous_and_Constant_Input_API_call_checker/async_parse_outfile_aws.py | mlapistudy/ICSE2021_421 | 9 | 12793870 | import sys
import re
from utils.utils import print_writeofd
# First argument is whether or not to proceed with manual checking:
if sys.argv[1] == '-m':
MANUAL_CHECKING = True
elif sys.argv[1] == '-a':
MANUAL_CHECKING = False
else:
print("The first argument must be either -m or -a, see README.md for details... | 2.953125 | 3 |
snippets/python/automation/beep.py | c6401/Snippets | 0 | 12793871 | def beep():
print('\007')
| 1.632813 | 2 |
djmodels/contrib/gis/utils/__init__.py | iMerica/dj-models | 5 | 12793872 | """
This module contains useful utilities for GeoDjango.
"""
from djmodels.contrib.gis.utils.ogrinfo import ogrinfo # NOQA
from djmodels.contrib.gis.utils.ogrinspect import mapping, ogrinspect # NOQA
from djmodels.contrib.gis.utils.srs import add_srs_entry # NOQA
from djmodels.core.exceptions import ImproperlyConfi... | 1.507813 | 2 |
module1-introduction-to-sql/rpg_db_example.py | rgiuffre90/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 12793873 | import sqlite3
def connect_to_db(db_name="rpg_db.sqlite3"):
return sqlite3.connect(db_name)
def execute_query(cursor, query):
cursor.execute(query)
return cursor.fetchall()
GET_CHARACTERS = """
SELECT *
FROM charactercreator_character
"""
CHARACTER_COUNT = """
SELECT COUNT(*)
FROM charactercreator_c... | 3.515625 | 4 |
bugprediction/linear_regression_model.py | HaaLeo/bug-prediction | 0 | 12793874 | <filename>bugprediction/linear_regression_model.py
# ------------------------------------------------------------------------------------------------------
# Copyright (c) <NAME>. All rights reserved.
# Licensed under the BSD 3-Clause License. See LICENSE.txt in the project root for license information.
# -----------... | 2.484375 | 2 |
main.py | shashankboosi/FakeNewsML | 1 | 12793875 | <filename>main.py
"""
COMP9417
Assignment: Fake news Challenge
Authors: <NAME>(z5222766), <NAME> (z5058240), <NAME>(z5173917), <NAME> (z5113901)
main.py: Main file for program execution
"""
from src.data_import import FakeNewsData
from src.train_validation_split import DataSplit
from src.preprocess import Preprocess
f... | 2.796875 | 3 |
past_questions/migrations/0004_remove_faculty_department_faculty_department.py | curlyzik/varsity-pq | 2 | 12793876 | <gh_stars>1-10
# Generated by Django 4.0 on 2021-12-18 01:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
(
"past_questions",
"0003_alter_department_level_alter_faculty_department_and_more",
),
]
operations = [
... | 1.59375 | 2 |
guess.py | AnacondaDontWantNone/gotTheBuns | 0 | 12793877 | <reponame>AnacondaDontWantNone/gotTheBuns<gh_stars>0
#This is a Guess the Number game.
import random
guessesTaken = 0
print('Hello! What is your name?')
myName = input()
number = random.randint(1, 20)
print('Well, ' + myName + ', I am thinking of a number between 1 and 20. Can you guess it in six tries? :)'... | 4.15625 | 4 |
codebyte/python/letter_capitalize/letter_capitalize_test.py | lowks/levelup | 0 | 12793878 | import unittest
from letter_capitalize import LetterCapitalize
class TestWordCapitalize(unittest.TestCase):
def test_word_capitalize(self):
self.assertEqual(LetterCapitalize("hello world"), "Hello World")
if __name__ == '__main__':
unittest.main() | 3.703125 | 4 |
tests/test_datetime.py | SeitaBV/isodate | 4 | 12793879 | <gh_stars>1-10
##############################################################################
# Copyright 2009, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sou... | 1.359375 | 1 |
vae/vae.py | szrlee/vae-anomaly-detector | 0 | 12793880 | <filename>vae/vae.py
#!/usr/bin/python3
"""
Pytorch Variational Autoendoder Network Implementation
"""
from itertools import chain
import time
import json
import pickle
import numpy as np
import torch
from torch.autograd import Variable
from torch import nn
from torch import optim
from torch.nn import functional as F
f... | 2.546875 | 3 |
start.py | lizzyTheLizard/medium-security-zap | 2 | 12793881 | #!/usr/bin/env python
# Spider and start listening for passive requests
import sys
from zapv2 import ZAPv2
from zap_common import *
#Configuration
zap_ip = 'localhost'
port = 12345
spiderTimeoutInMin = 2
startupTimeoutInMin=1
target='http://localhost:8080'
def main(argv):
#Initialize Zap API
http_proxy = 'http:/... | 2.90625 | 3 |
tests/test_landing_page.py | Valaraucoo/raven-functional-tests | 0 | 12793882 | <reponame>Valaraucoo/raven-functional-tests
from helpers import *
class TestLandingPageLoading:
def test_get_base_url(self, driver):
driver.get(BASE_URL)
# waiting for animation
time.sleep(2)
button_login = driver.find_element_by_css_selector('button')
assert 'Zaloguj s... | 2.359375 | 2 |
corded/errors.py | an-dyy/Corded | 0 | 12793883 | <reponame>an-dyy/Corded
from aiohttp import ClientResponse
class CordedError(Exception):
pass
# HTTP Errors
class HTTPError(CordedError):
def __init__(self, response: ClientResponse):
self.response = response
class BadRequest(HTTPError):
pass
class Unauthorized(HTTPError):
pass
class... | 2.484375 | 2 |
nlu/components/embeddings/sentence_xlm/sentence_xlm.py | Murat-Karadag/nlu | 0 | 12793884 | from sparknlp.annotator import XlmRoBertaSentenceEmbeddings
class Sentence_XLM:
@staticmethod
def get_default_model():
return XlmRoBertaSentenceEmbeddings.pretrained() \
.setInputCols("sentence", "token") \
.setOutputCol("sentence_xlm_roberta")
@staticmethod
def get_pretrained_... | 2.5 | 2 |
bx_py_utils/humanize/pformat.py | boxine/bx_py_utils | 6 | 12793885 | import json
import pprint
def pformat(value):
"""
Format given object: Try JSON fist and fallback to pformat()
(JSON dumps are nicer than pprint.pformat() ;)
"""
try:
value = json.dumps(value, indent=4, sort_keys=True, ensure_ascii=False)
except TypeError:
# Fallback if values ... | 3.484375 | 3 |
mmdnn/conversion/examples/darknet/extractor.py | kmader/MMdnn | 3,442 | 12793886 | #----------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#------------------------------------------------------------------... | 2.140625 | 2 |
data/transcoder_evaluation_gfg/python/SCHEDULE_JOBS_SERVER_GETS_EQUAL_LOAD.py | mxl1n/CodeGen | 241 | 12793887 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( a , b , n ) :
s = 0
for i in range ( 0 , n ) :
s += a [ i ] + b [ i ]
if n == 1 :
retur... | 3.078125 | 3 |
backend/reservas/admin.py | ES2-UFPI/404-portal | 1 | 12793888 | <filename>backend/reservas/admin.py
from django.contrib import admin
from .models import Reserva
admin.site.register(Reserva)
| 1.210938 | 1 |
data_loader.py | winterest/f-function | 0 | 12793889 | <filename>data_loader.py
from torch.utils import data
import os
import torch
from torchvision import transforms as T
from scipy import interpolate
from PIL import Image
from random import shuffle
import xml.etree.ElementTree as ET
## Config
img_size = 256
## End of config
class LabeledImageFolder(data.Dataset):
... | 2.484375 | 2 |
tests/examples/minlplib/mathopt3.py | ouyang-w-19/decogo | 2 | 12793890 | # NLP written by GAMS Convert at 04/21/18 13:52:29
#
# Equation counts
# Total E G L N X C B
# 8 5 0 3 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... | 1.65625 | 2 |
aiohttp_asgi/__init__.py | PaulWasTaken/aiohttp-asgi | 10 | 12793891 | from .resource import ASGIResource
__all__ = ("ASGIResource",)
| 1.132813 | 1 |
2014/bio-2014-1-1.py | pratheeknagaraj/bio_solutions | 0 | 12793892 | #!/usr/bin/env python
"""
bio-2014-1-1.py: Sample solution for question 1 on
the 2014 British Informatics Olympiad Round One exam
Lucky Numbers
"""
__author__ = "<NAME>"
__date__ = "25 January 2016"
"""
This is simply an implemenation based problem. We first
generate the list of lucky numbers via the algorithm
... | 3.9375 | 4 |
python/analysis/mostImportantMiRNAs.py | mjoppich/miRExplore | 0 | 12793893 | import matplotlib
from collections import defaultdict, OrderedDict
from plots.DotSetPlot import DotSetPlot
processToTitle = {
"targetMirsECA": "EC activation and\n inflammation",
"targetMirsMonocyte": "Monocyte diff. &\nMacrophage act.",
"targetMirsFCF": "Foam cell formation",
"targetMirsAngi... | 2.46875 | 2 |
src/hud.py | anita-hu/simulanes | 1 | 12793894 | <filename>src/hud.py<gh_stars>1-10
# Modified work Copyright (c) 2021 <NAME>, <NAME>.
# Original work Copyright (c) 2018 Intel Labs.
# authors: <NAME> (<EMAIL>)
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
# Original source: https://github.com/... | 2.75 | 3 |
src/cryptos/__init__.py | villoro/airflow_tasks | 0 | 12793895 | from .process import update_cryptos
| 0.988281 | 1 |
oo/pessoa.py | limaon/pythonbirds | 0 | 12793896 | <reponame>limaon/pythonbirds<filename>oo/pessoa.py
class Pessoa:
def __init__(self, nome=None, idade=35):
self.idade = idade
self.nome = nome
def cumprimentar(self):
return f'Ola {id(self)}'
class CirculoPerfeito:
def __init__(self):
self.cor = 'Azul'
self.circufe... | 3.28125 | 3 |
getwordindexfile.py | lqyluck/semi-supervised-lda | 2 | 12793897 | '''
Created on 2011-5-30
@author: cyzhang
'''
import re
import sys,os
def dofeaindex(file,filetype):
feamap = {}
linenum = 0
for line in open(file):
line = line.strip()
content = line.split('\t')
if len(content) != 2:
continue
felist=content[1].s... | 2.734375 | 3 |
connections/conn_napalm.py | no-such-anthony/net-run | 1 | 12793898 | <filename>connections/conn_napalm.py
from napalm import get_network_driver
class conn_napalm():
def __init__(self, device, connection_key):
self.device = device
self.connection_key = connection_key
#check for required kwargs, grab root level key if not in connection_key
#... | 2.6875 | 3 |
house_rocket_analysis/APP/app.py | diogovalentte/data_engineer_portfolio | 8 | 12793899 | # Libraries
from pandas.io.formats.format import DataFrameFormatter
from streamlit_folium import folium_static
import pandas as pd
import numpy as np
import seaborn as sns
import streamlit as st
import sys
#! Add folder "src" as a package path
project_path = "Put/here/the/path/to/the/project's/root/folder/house_rocke... | 3.296875 | 3 |
incident_io_client/models/severities_list_response_body.py | expobrain/python-incidentio-client | 0 | 12793900 | from typing import Any, Dict, List, Type, TypeVar
import attr
from ..models.severity_response_body import SeverityResponseBody
T = TypeVar("T", bound="SeveritiesListResponseBody")
@attr.s(auto_attribs=True)
class SeveritiesListResponseBody:
"""
Example:
{'severities': [{'created_at': '2021-08-17T13... | 2.390625 | 2 |
server.py | vhnguyen0707/CMPUT404-assignment-webserver | 0 | 12793901 | <reponame>vhnguyen0707/CMPUT404-assignment-webserver
# coding: utf-8
import os
import socketserver
# Copyright 2013 <NAME>, <NAME>
#
# 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
#
# ... | 2.828125 | 3 |
stan/tests/test_procparse.py | chappers/Stan | 1 | 12793902 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 18 12:54:30 2014
@author: Chapman
"""
import unittest
from stan.proc import proc_parse
cstr = """proc describe data = df1 out = df2;
by a;
run;"""
cstr1 = """proc describe data = df1 out = df2;
by a;
fin = "/usr/test.text";
qu... | 2.1875 | 2 |
tests/settings.py | jamesturk/django-mergeobject | 0 | 12793903 | <reponame>jamesturk/django-mergeobject<gh_stars>0
SECRET_KEY = 'so-secret'
INSTALLED_APPS = (
'tests',
)
MIDDLEWARE_CLASSES = ()
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
}
}
| 1.453125 | 1 |
halls.parser.py | dwrodri/cumapit | 2 | 12793904 | <gh_stars>1-10
#!/usr/bin/python2
import imageio
import png
import numpy as np
import sys
import math
from collections import namedtuple
if len(sys.argv) != 2:
print("%s <campusMap.png>" % sys.argv[0])
exit()
IMG = imageio.imread(sys.argv[1])
Point = namedtuple("Point",["x","y"])
def update_pixel(row,col,r,g,b,a... | 2.9375 | 3 |
DoraGamePlaying-m5skipping/plotResults.py | AlexDoumas/BrPong_1 | 3 | 12793905 | import numpy as np
from matplotlib import pyplot as plt
def loadFile(filename):
f = open(filename,'r')
text = f.read()
f.close()
rewards = []
steps = []
for line in text.split('\n'):
pieces = line.split(',')
if(len(pieces) == 2):
rewards.append(float(pieces[0]))
steps.append(int(piec... | 2.875 | 3 |
hundun/__version__.py | llbxg/hundun | 4 | 12793906 | MAJOR = 0
MINOR = 1
MICRO = 38
__version__ = f'{MAJOR}.{MINOR}.{MICRO}'
| 1.359375 | 1 |
traffic_lights/training/train.py | aidandunlop/traffic_light_recognition | 5 | 12793907 | <reponame>aidandunlop/traffic_light_recognition<filename>traffic_lights/training/train.py
import torch
import numpy as np
from traffic_lights.data.constants import CLASS_LABEL_MAP
from traffic_lights.lib.engine import train_one_epoch
from .model import get_model, evaluate
# TODO: add eval boolean flag, which reports ... | 2.5 | 2 |
exo/make_heatmap.py | CEGRcode/exo | 0 | 12793908 | <reponame>CEGRcode/exo
#!/usr/bin/python
from __future__ import division
import math
import pprint
import click
import matplotlib
import matplotlib.colors as mcolors
import matplotlib.pyplot as plt
from matplotlib.ticker import (AutoMinorLocator, MultipleLocator)
import numpy as np
matplotlib.use('Agg')
"""
Pro... | 2.609375 | 3 |
voice_rebuilder/rtp_capture.py | Casual-Alchemist/sampleproj | 0 | 12793909 | import pyshark
class Audio_Scraper:
def __init__(self, pcap, filter, outfile):
self.pcap = pcap
self.filter = filter
self.outfile = outfile
def scraper(self):
rtp_list =[]
pcap_file = self.pcap
out_file = self.outfile
print("Scraping: " + pcap_file)
... | 3.078125 | 3 |
hello_new_project.py | Dangl-IT/avacloud-demo-python | 1 | 12793910 | from __future__ import print_function
import time
import avacloud_client_python
from avacloud_client_python.rest import ApiException
import requests
import os
import json
client_id = 'use_your_own_value'
client_secret = '<PASSWORD>_your_own_value'
url = 'https://identity.dangl-it.com/connect/token'
payload = {'grant_... | 2.5 | 2 |
autograd/scipy/stats/beta.py | gautam1858/autograd | 6,119 | 12793911 | <gh_stars>1000+
from __future__ import absolute_import
import autograd.numpy as np
import scipy.stats
from autograd.extend import primitive, defvjp
from autograd.numpy.numpy_vjps import unbroadcast_f
from autograd.scipy.special import beta, psi
cdf = primitive(scipy.stats.beta.cdf)
logpdf = primitive(scipy.stats.beta... | 2.078125 | 2 |
examples/144. Binary Tree Preorder Traversal.py | yehzhang/RapidTest | 0 | 12793912 | from rapidtest import Test, Case, TreeNode
from solutions.binary_tree_preorder_traversal import Solution
with Test(Solution) as test:
Case(TreeNode.from_string('[1,null,2,3]'), result=[1, 2, 3])
Case(TreeNode.from_string('[]'), result=[])
Case(TreeNode.from_string('[1]'), result=[1])
Case(TreeNode.from... | 2.6875 | 3 |
microcosm_pubsub/chain/statements/assign.py | Sinon/microcosm-pubsub | 5 | 12793913 | <gh_stars>1-10
"""
assign("foo.bar").to("baz")
assign_constant(1).to("qux")
"""
from inspect import getfullargspec
from microcosm_pubsub.chain.exceptions import AttributeNotFound
class Reference:
def __init__(self, name):
self.parts = name.split(".")
@property
def key(self):
return sel... | 2.625 | 3 |
alembic/versions/140a25d5f185_create_tokens_table.py | alvierahman90/matrix-registration | 160 | 12793914 | """create tokens table
Revision ID: 1<PASSWORD>
Revises:
Create Date: 2020-12-12 01:44:28.195736
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import Table, Column, Integer, String, Boolean, DateTime, ForeignKey
from sqlalchemy.engine.reflection import Inspector
from flask_sqlalchemy import SQLA... | 1.664063 | 2 |
nozama-cloudsearch-data/nozama/cloudsearch/data/tests/conftest.py | iGamesInc/nozama-cloudsearch | 0 | 12793915 | <filename>nozama-cloudsearch-data/nozama/cloudsearch/data/tests/conftest.py
# -*- coding: utf-8 -*-
"""
"""
import logging
import pytest
@pytest.fixture(scope='session')
def logger(request):
"""Set up a root logger showing all entries in the console.
"""
log = logging.getLogger()
hdlr = logging.Strea... | 2.109375 | 2 |
earth_enterprise/src/scons/packageUtils_test.py | ezeeyahoo/earthenterprise | 2,661 | 12793916 | <reponame>ezeeyahoo/earthenterprise
#-*- Python -*-
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | 2.40625 | 2 |
tests/test_mc_cnn.py | CNES/Pandora_MCCNN | 3 | 12793917 | #!/usr/bin/env python
# coding: utf8
#
# Copyright (c) 2021 Centre National d'Etudes Spatiales (CNES).
#
# This file is part of PANDORA_MCCNN
#
# https://github.com/CNES/Pandora_MCCNN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | 2.0625 | 2 |
studies/upgrade_noise/plotting/make_plots.py | kaareendrup/gnn-reco | 0 | 12793918 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sqlite3
from sklearn.metrics import auc
from sklearn.metrics import roc_curve
def add_truth(data, database):
data = data.sort_values('event_no').reset_index(drop = True)
with sqlite3.connect(database) as con:
query = 'select ... | 2.40625 | 2 |
tools/checkimg.py | mrzhuzhe/YOLOX | 0 | 12793919 | <filename>tools/checkimg.py
import numpy as np
import pandas as pd
import ast
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import cv2
def plot_image_and_bboxes(img, bboxes):
fig, ax = plt.subplots(1, figsize=(10, 8))
ax.axis('off')
ax.imshow(img)... | 2.484375 | 2 |
examples/1_trace.py | tamsri/murt | 4 | 12793920 | <reponame>tamsri/murt
from murt import Tracer
# Scene File Path in obj
OBJ_FILE_PATH = "./assets/poznan.obj"
# Initialize Tracer
my_tracer = Tracer(OBJ_FILE_PATH)
# Set transmiting position
tx_pos = [0, 15, 0]
# Set receiving position
rx_pos = [-30, 1.5, 45]
# Return the traced paths
results = my_tracer.trace(tx_pos... | 2.421875 | 2 |
helpers_fritz.py | scarfboy/fritzbox-traffic | 0 | 12793921 | <gh_stars>0
import time, urllib, urllib2, hashlib, pprint, re, sys
import urllib, urllib2, socket, httplib
import json
"""
Being lazy with globals because you probably don't have more than one in your LAN
Note that login takes a little time. The _fritz_sid keeps the login token so if you can
keep the inte... | 2.671875 | 3 |
unidump/cli.py | Codepoints/unidump | 33 | 12793922 | """
handle the CLI logic for a unidump call
"""
import argparse
import codecs
import gettext
from os.path import dirname
from shutil import get_terminal_size
import sys
from textwrap import TextWrapper
# pylint: disable=unused-import
from typing import List, IO, Any
# pylint: enable=unused-import
from unicodedata imp... | 2.796875 | 3 |
api/serializers.py | lutoma/open-grgraz | 2 | 12793923 | from rest_framework import serializers
from api.models import *
class ParliamentaryGroupSerializer(serializers.ModelSerializer):
class Meta:
model = ParliamentaryGroup
fields = ('id', 'name')
class ParliamentarySessionSerializer(serializers.ModelSerializer):
class Meta:
model = Parli... | 2.25 | 2 |
main.py | YanhengWang/Draughts | 0 | 12793924 | <gh_stars>0
from utils import *
from graphics import Graphics
from state import State
from torch.autograd import Variable
import network
import torch
current = State(None, None)
net = network.ResNet()
focusMoves = []
focus = 0
def MCTS(root):
global net
if root.Expand():
data = torch.FloatTensor(StateToImg(root... | 2.078125 | 2 |
setup.py | bashu/django-absoluteuri | 14 | 12793925 | <reponame>bashu/django-absoluteuri
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
__doc__ = "Absolute URI functions and template tags for Django"
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
readme = read('README.rst')
changelog = read('CHANGEL... | 1.460938 | 1 |
scripts/to_sorec_list_form.py | ajbc/spf | 28 | 12793926 | <reponame>ajbc/spf
import sys
from collections import defaultdict
path = sys.argv[1]
undir = (len(sys.argv) == 3)
fin = open(path +'/train.tsv')
finn = open(path +'/network.tsv')
fout_items = open(path +'/items_sorec.dat', 'w+')
fout_users = open(path +'/users_sorec.dat', 'w+')
users = defaultdict(list)
items = set(... | 2.125 | 2 |
CMSLogic/models.py | AbhijithGanesh/Student-Portal-CMS | 0 | 12793927 | from django.db import models
from pytz import country_names as c
from datetime import date
dict_choices = dict(c)
_choices = []
_keys = list(dict_choices.keys())
_value = list(dict_choices.values())
if len(_keys) == len(_value):
for i in range(len(_keys)):
a = [_keys[i], _value[i]]
_ch... | 2.359375 | 2 |
ch13/myproject_virtualenv/src/django-myproject/myproject/apps/likes/views.py | PacktPublishing/Django-3-Web-Development-Cookbook | 159 | 12793928 | <reponame>PacktPublishing/Django-3-Web-Development-Cookbook
import structlog
from django.contrib.contenttypes.models import ContentType
from django.http import JsonResponse
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
from .models import Like
from .templat... | 2.015625 | 2 |
apphv/mainUser/migrations/0029_auto_20190625_1620.py | FerneyMoreno20/Portfolio | 0 | 12793929 | <gh_stars>0
# Generated by Django 2.2.2 on 2019-06-25 16:20
import ckeditor.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('parametros', '0002_empleos'),
('mainUser', '0028_auto_20190624_1815'),
]
... | 1.914063 | 2 |
Code/preprocessing/doc2vec.py | mattaq31/recognition-forge | 0 | 12793930 | from preprocessing.vectorizers import Doc2VecVectorizer
from nnframework.data_builder import DataBuilder
import pandas as pd
import constants as const
import numpy as np
def generate_d2v_vectors(source_file):
df = pd.read_csv(source_file)
messages = df["Message"].values
vectorizer = Doc2VecVectorizer()
... | 3.109375 | 3 |
Prob1.py | ntnshrm87/Python_Quest | 0 | 12793931 | class C:
dangerous = 2
c1 = C()
c2 = C()
print(c1.dangerous)
c1.dangerous = 3
print(c1.dangerous)
print(c2.dangerous)
del c1.dangerous
print(c1.dangerous)
print(c2.dangerous)
# Solution:
# 2
# 3
# 2
# 2
# 2
# Reference:
# object.__del__(self)
# Called when the instance is about to be destroyed. This is also cal... | 3.828125 | 4 |
covidKeralaDHS.py | cibinjoseph/covidKeralaDHS | 0 | 12793932 | <filename>covidKeralaDHS.py
"""
A module to parse the COVID bulletins provided by DHS Kerala
"""
import urllib3
from bs4 import BeautifulSoup
import json
import sys
linkPre = 'http://dhs.kerala.gov.in'
jsonDefaultFile = 'bulletinLinks.json'
bulletinDefaultFile = 'bulletin.pdf'
def __getPDFlink(bulletinPageLink):
... | 3.296875 | 3 |
1-DiveIntoPython/week5/lecturesdemos/AsychnchronousProgramming/generators.py | mamoudmatook/PythonSpecializaionInRussian | 0 | 12793933 | <filename>1-DiveIntoPython/week5/lecturesdemos/AsychnchronousProgramming/generators.py
def myrange_generator(top):
current = 0:
while current < top:
yield current
current += 1 | 3.3125 | 3 |
coordination/environment/traffic.py | CN-UPB/FutureCoord | 1 | 12793934 | <reponame>CN-UPB/FutureCoord
from typing import List, Dict
from functools import cmp_to_key
import numpy as np
import scipy.stats as stats
from numpy.random import default_rng, BitGenerator
from tick.base import TimeFunction
from tick.hawkes import SimuInhomogeneousPoisson
class Request:
def __init__(self, arriv... | 2.125 | 2 |
Sound/micro.py | mencattini/ReMIx | 1 | 12793935 | """Microphone module."""
import alsaaudio
# pylint: disable=R0903, E1101
class Micro():
"""Class to use micro in a `with` bloc."""
def __init__(self, alsaaudio_capture=alsaaudio.PCM_CAPTURE,
alsaaudio_nonblock=alsaaudio.PCM_NONBLOCK):
"""Open the device in nonblocking capture mode.
... | 2.734375 | 3 |
Programiz Projects/4 - Find the Area of a Triangle.py | PythonCodes1/Python-Progression | 0 | 12793936 | <reponame>PythonCodes1/Python-Progression
"""
To find the area of a triangle, you must use this method:
s = (a+b+c)/2
area = √(s(s-a)*(s-b)*(s-c))
"""
a = float(input('Enter first side: '))
b = float(input('Enter second side: '))
c = float(input('Enter third side: '))
s = (a+b+c)/2
area = (s*(s-a)*(s-b)*(s-c)) ** 0.5... | 4.15625 | 4 |
app/payments/migrations/0003_auto_20181219_2332.py | zanielyene/krabacus3 | 2 | 12793937 | <reponame>zanielyene/krabacus3<filename>app/payments/migrations/0003_auto_20181219_2332.py
# Generated by Django 2.1.2 on 2018-12-19 23:32
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('payments', '... | 1.484375 | 1 |
lab1/part1/core/layerFactory.py | Currycurrycurry/FDSS_PRML | 0 | 12793938 | <reponame>Currycurrycurry/FDSS_PRML<filename>lab1/part1/core/layerFactory.py
from lab1.part1.core.layers.dense import DenseLayer
from lab1.part1.core.layers.relu import ReluLayer
from lab1.part1.core.layers.sigmoid import SigmoidLayer
from lab1.part1.core.layers.softmax import SoftmaxLayer
from lab1.part1.core.layers.p... | 2.140625 | 2 |
EixampleEnergy/drawers/drawer_map.py | TugdualSarazin/eixample_energy | 0 | 12793939 | <gh_stars>0
import contextily as cx
import matplotlib.pyplot as plt
from EixampleEnergy.drawers.drawer_elem import DrawerElem
class DrawerMap(DrawerElem):
def __init__(self, full_df,
color_col,
cmap='YlGnBu',
xlim=None, ylim=None, bg_img=None):
# Init at... | 2.296875 | 2 |
notebooks-text-format/cond_bmm_emnist.py | arpitvaghela/probml-notebooks | 166 | 12793940 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# + [markdown] id="M_qo7DmLJKLP"
# #Class-Conditional Bernoulli Mixture Model... | 1.820313 | 2 |
python/tests/test_base.py | JLLeitschuh/DDF | 160 | 12793941 | from __future__ import unicode_literals
import unittest
from ddf import DDFManager, DDF_HOME
class BaseTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.dm_spark = DDFManager('spark')
cls.airlines = cls.loadAirlines(cls.dm_spark)
cls.mtcars = cls.loadMtCars(cls.dm_spark)
... | 2.40625 | 2 |
examples/example_cidnotfound.py | Mirio/psnstoreprice | 1 | 12793942 | <reponame>Mirio/psnstoreprice
from psnstoreprice import PsnStorePrice
url = "https://store.playstation.com/#!/it-it/giochi/arslan-the-warriors-of-legend-con-bonus/"
pricelib = PsnStorePrice()
pricelib.getpage(pricelib.normalizeurl(url)) | 1.9375 | 2 |
backend/liveHeartbeat/apps.py | rajc1729/django-nextjs-realtime | 0 | 12793943 | from django.apps import AppConfig
class LiveheartbeatConfig(AppConfig):
name = 'liveHeartbeat'
| 1.046875 | 1 |
justine/views/grupos.py | VTacius/justine | 0 | 12793944 | <filename>justine/views/grupos.py
# coding: utf-8
from pyramid.view import view_config
from pyramid import httpexceptions as exception
from ..juliette.modelGroup import Grupo
from ..juliette.excepciones import DatosException, ConflictoException
from ..schemas.grupos import EsquemaGrupo
import logging
log = loggin... | 2.328125 | 2 |
pdf_sanitizer/pdf_sanitizer.py | lucasmrdt/pdf-sanitizer | 0 | 12793945 | import difflib
import pathlib
import argparse
from .utils import fail_with_message, progress_with_message, success_with_message
try:
import PyPDF2
except ImportError:
fail_with_message(
'Please install required dependencies before using this package.\n\t> pip3 install -r requirements.txt --user')
de... | 2.859375 | 3 |
utils/files_to_h5_hierarchical.py | lzamparo/SdA_reduce | 0 | 12793946 | #! /usr/bin/env python
"""
Vacuum up all the object.CSV files from the given input directory, and pack them into an hdf5 file that is organized by plate.well
Plates go 1 .. 14. Rows go 1 ... 16, Cols 1 ... 24.
"""
import os
from optparse import OptionParser
import pandas
from tables.file import File, openFile
from... | 3.203125 | 3 |
pyImagingMSpec/smoothing.py | andy-d-palmer/pyIMS | 2 | 12793947 | __author__ = 'palmer'
# every method in smoothing should accept (im,**args)
def median(im, **kwargs):
from scipy import ndimage
im = ndimage.filters.median_filter(im,**kwargs)
return im
def hot_spot_removal(xic, q=99.):
import numpy as np
xic_q = np.percentile(xic, q)
xic[xic > xic_q] = xic_q
... | 2.640625 | 3 |
aldryn_apphooks_config_utils/context_processors.py | TigerND/aldryn-apphook-utils | 0 | 12793948 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from aldryn_apphooks_config.utils import get_app_instance
def apphooks_config(request):
namespace, config = get_app_instance(request)
return {
'namespace': namespace,
'config': config,
}
| 1.484375 | 1 |
tests/multijson/test_multi.py | adeadman/multijson | 1 | 12793949 | <gh_stars>1-10
import json
import uuid
import datetime
import pytest
from decimal import Decimal
from multijson import MultiJSONEncoder
class Custom:
def __init__(self, name, age):
self.name = name
self.age = age
class TestMultiJSONEncoder:
def test_dump_uuid(self):
test_input = {
... | 2.53125 | 3 |
QUANTAXIS_Trade/WindowsCTP/test.py | xiongyixiaoyang/QUANTAXIS | 2 | 12793950 | <filename>QUANTAXIS_Trade/WindowsCTP/test.py<gh_stars>1-10
import datetime
import logging
import math
import multiprocessing as mp
import os
import pickle
import shutil
import numpy as np
import pandas as pd
from ParadoxTrading.Chart import Wizard
from ParadoxTrading.Engine import (MarketEvent, SettlementEvent,
... | 2.03125 | 2 |