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 |
|---|---|---|---|---|---|---|
run_es_repo_mgr.py | wjimenez5271/curator | 0 | 41600 | <reponame>wjimenez5271/curator
#!/usr/bin/env python
"""Wrapper for running es_repo_mgr from source."""
from curator.es_repo_mgr import main
if __name__ == '__main__':
main()
| 0.953125 | 1 |
shapeworld/captioners/comparative_quantifier.py | shgoren/ShapeWorld | 1 | 41601 | <gh_stars>1-10
from random import choice
from shapeworld import util
from shapeworld.captions import ComparativeQuantifier
from shapeworld.captioners import WorldCaptioner
class ComparativeQuantifierCaptioner(WorldCaptioner):
# incorrect modes
# 0: correct
# 1: incorrect restrictor
# 2: incorrect com... | 2.328125 | 2 |
qcloudsdkapigateway/RunApiRequest.py | f3n9/qcloudcli | 0 | 41602 | # -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class RunApiRequest(Request):
def __init__(self):
super(RunApiRequest, self).__init__(
'apigateway', 'qcloudcliV1', 'RunApi', 'apigateway.api.qcloud.com')
def get_apiId(self):
return self.get_params().get('apiId')
... | 2.078125 | 2 |
gitviper/gitconnector.py | BeayemX/GitViper | 41 | 41603 | <filename>gitviper/gitconnector.py
import os
from git import InvalidGitRepositoryError, Repo
from gitviper.colors import *
class Connection:
def __init__(self):
self.repo = None
self.working_directory = None
self.is_git_repo = False
connection = Connection()
def connect():
connection.... | 2.828125 | 3 |
solutions/solved008.py | pedraodeveloper66/Najma | 0 | 41604 | <gh_stars>0
"""
Write a program that reads a value in meters and displays it converted to centimeters and millimeters
"""
m = float(input('Uma distância em metros: '))
"""Kilometre --> Divide the length value by 1000"""
km = m / 1000
"""Hectometre --> Divide the length value by 100"""
hm = m / 100
"""Decametre --> Div... | 4.03125 | 4 |
model-optimizer/mo/front/common/partial_infer/slice.py | mypopydev/dldt | 3 | 41605 | """
Copyright (c) 2018 Intel 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 wri... | 2.21875 | 2 |
HackerServer/core/file_folder_download.py | FrancescoLucarini/BackdoorPy | 3 | 41606 | <filename>HackerServer/core/file_folder_download.py<gh_stars>1-10
import json
CHUNK_SIZE = 1024
DELIMETER = "<END_OF_RESULTS>"
def receive_file_folders(my_socket):
print("[+] Receiving Files/ Folders")
full_list = b''
while True:
chunk = my_socket.client_conn.recv(CHUNK_SIZE)
if chunk.e... | 3.140625 | 3 |
web_flask/10-hbnb_filters.py | devephy/AirBnB_clone_v2 | 0 | 41607 | #!/usr/bin/python3
"""Starts a Flask web application.
The application listens on 0.0.0.0, port 5000.
Routes:
/hbnb_filters: HBnB HTML filters page.
"""
from models import storage
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route("/hbnb_filters", strict_slashes=False)
def ... | 2.921875 | 3 |
setup.py | mudox/pytav | 0 | 41608 | # -*- coding: utf-8 -*-
"""setup.py: setuptools control."""
import re
from setuptools import find_packages, setup
version = re.search(r"^__version__\s*=\s*'(.*)'",
open('src/tav/cmd.py').read(), re.M).group(1)
setup(
name='tav',
version=version,
description='TBD',
long_descriptio... | 1.484375 | 1 |
satchless/contrib/delivery/simplepost/forms.py | cajun-code/satchless | 1 | 41609 | <filename>satchless/contrib/delivery/simplepost/forms.py<gh_stars>1-10
from django import forms
from . import models
class PostShippingVariantForm(forms.ModelForm):
class Meta:
model = models.PostShippingVariant
fields = ('shipping_full_name', 'shipping_company_name',
'shipping_street_... | 1.90625 | 2 |
app/Http/python/DNVGLRPF103/DNVGLRPF103.py | asavadorndeja/sttools | 0 | 41610 | #!/usr/bin/python;
import sys
import ast
import json
import math as m
import numpy as np
# from scipy.interpolate import interp1d
# from scipy.optimize import fsolve
# Version Controller
sTitle = 'DNVGL RP F103 Cathodic protection of submarine pipelines'
sVersion = 'Version 1.0.0'
# Define constants
pi = m.pi
e = m.... | 1.867188 | 2 |
src/iOS/toga_iOS/dialogs.py | samschott/toga | 0 | 41611 | <filename>src/iOS/toga_iOS/dialogs.py<gh_stars>0
import asyncio
from rubicon.objc import Block
from rubicon.objc.runtime import objc_id
from toga_iOS.libs import (
UIAlertAction,
UIAlertActionStyle,
UIAlertController,
UIAlertControllerStyle,
)
class BaseDialog:
def __init__(self):
loop =... | 2.296875 | 2 |
djangae/models.py | bocribbz/djangae | 467 | 41612 | from django.db import models
from djangae import patches # noqa
class DeferIterationMarker(models.Model):
"""
Marker to keep track of sharded defer
iteration tasks
"""
# Set to True when all shards have been deferred
is_ready = models.BooleanField(default=False)
shard_count = m... | 2.1875 | 2 |
setup.py | WillBux/Darwin | 1 | 41613 | from setuptools import setup
from setuptools import find_packages
setup(name='darwin',
version='0.1',
description='Machine Learning with Genetic Algorithms',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/WillBux/darwin',
license='MIT',
install_requires=['tqd... | 1.15625 | 1 |
driver.py | sreedom/rabbit-pipeline | 3 | 41614 | <gh_stars>1-10
### fake driver
from pipeline import Pipeline
from components import C1, C2, C3
# TODO ^^ or should we use a registry ?
#http://en.wikipedia.org/wiki/Newick_format
# representing pipeline of format C1-C2-C4
# |- C3
pipeline = 'C1(C2(C4),C3)'
leadgen_pipeline = Pipelin... | 1.8125 | 2 |
util/box_ops.py | huaxiangwangman/detr_paddle | 0 | 41615 | """
Utilities for bounding box manipulation and GIoU.
"""
from x2paddle import torch2paddle
import paddle
def box_area(boxes):
"""
Computes the area of a set of bounding boxes, which are specified by its
(x1, y1, x2, y2) coordinates.
Arguments:
boxes (Tensor[N, 4]): boxes for which the area w... | 3.1875 | 3 |
cogs/nijiru__.py | disneyresidents/Satsuki | 0 | 41616 | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import typing
import discord
from discord.ext import commands
import libs as lib
class NijiruAlter(commands.Cog, name='煮汁代替定例会予約'):
def __init__(self, bot):
self.bot = bot
self.SB_URL = (
"http://scp-jp-sandbox3.wikidot.com/... | 2.65625 | 3 |
game/tichu/logginginit.py | lukaspestalozzi/Master_Semester_Project | 0 | 41617 | import logging
import os
import errno
def make_sure_path_exists(path):
try:
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
def initialize_logger(output_dir, console_log_level, info_log="info.log", warn_err_log="warn_error.log", all_log="a... | 2.984375 | 3 |
src/yarf/restfullogger.py | akraino-edge-stack/ta-yarf | 0 | 41618 | <gh_stars>0
# Copyright 2019 Nokia
#
# 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 wri... | 1.734375 | 2 |
can2mqtt.py | fablab-ka/labnet-can2mqtt | 2 | 41619 | import sys
import can
import logging
import struct
import re
import paho.mqtt.client as mqtt
from binascii import unhexlify, hexlify
from flask import Flask, render_template, send_from_directory
from werkzeug.serving import run_simple
from logging.handlers import TimedRotatingFileHandler
from config import Config
htt... | 2.25 | 2 |
odoo-13.0/venv/lib/python3.8/site-packages/PngImagePlugin.py | VaibhavBhujade/Blockchain-ERP-interoperability | 3 | 41620 | from PIL.PngImagePlugin import *
| 1.101563 | 1 |
main.py | AnEnigmaticBug/Connect-3 | 0 | 41621 | # <NAME>
# 2017A7PS0112P
from gui import Gui
Gui().loop() | 1.59375 | 2 |
tests/common/test_io.py | astrojuanlu/conda | 1 | 41622 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from conda.common.io import attach_stderr_handler, captured
from logging import DEBUG, NOTSET, WARN, getLogger
def test_attach_stderr_handler():
name = 'abbacadabba'
logr = getLogger(name)
assert le... | 2.171875 | 2 |
src/utils/boxes.py | Penchekrak/Distilling-Object-Detectors | 0 | 41623 | <reponame>Penchekrak/Distilling-Object-Detectors<filename>src/utils/boxes.py
from typing import Optional, Tuple
import torch
from torch import Tensor
def is_valid_box(
bounding_box: Tensor,
image_shape: Optional[Tuple[int, int]] = None
) -> bool:
"""
:param bounding_box: tensor [N, 4] of boun... | 2.4375 | 2 |
components/collector/src/base_collectors/api_source_collector.py | kargaranamir/quality-time | 33 | 41624 | <filename>components/collector/src/base_collectors/api_source_collector.py<gh_stars>10-100
"""API source collector base classes."""
from abc import ABC
from datetime import datetime
from collector_utilities.type import URL, Response
from model import SourceResponses
from .source_collector import SourceCollector, Sou... | 2.3125 | 2 |
examples/hex_grid_imperfect.py | shab-bahmanyar/penkit | 0 | 41625 | <filename>examples/hex_grid_imperfect.py
import numpy as np
from penkit import shapes
from penkit.write import write_plot
from penkit.textures.util import rotate_texture, fit_texture
def hex_grid_imperfect_1(n=10):
grid = (np.array([]), np.array([]))
seg1 = shapes.line((0,0), length=1.0, angle=-np.pi/3)
s... | 2.609375 | 3 |
classify.py | grzegorzludwa/brexit_notes_classifier | 1 | 41626 | #!/usr/bin/env python3
import argparse
import sys
import csv
import pickle
from common import (
read_comments,
read_comments_csv,
cv_score,
text_preprocess,
print_scores,
)
from nltk.corpus import stopwords
from sklearn.svm import LinearSVC
from sklearn.feature_selection import SelectKBest
from s... | 2.828125 | 3 |
Curso_em_Video_py3/ex115.py | Rodrigo98Matos/Projetos_py | 1 | 41627 | <filename>Curso_em_Video_py3/ex115.py
from utilidadesCeV.txt import *
from utilidadesCeV.dado import leiaint
if not arquivoexiste():
criararquivo()
cabeçalho("SISTEMA DE ARQUIVAMENTO v1.0",cor='\033[32m')
while True:
p = menu('ENCERRAR CADASTRAR LISTAR'.split())
if p == 0:
break
elif p == 1:
... | 3.171875 | 3 |
bash/cleanup.py | LaudateCorpus1/Aruba-FlaskwithNetworking | 0 | 41628 | # (C) Copyright 2021 Hewlett Packard Enterprise Development LP.
#!/usr/bin/python3
import schedule
from datetime import date, datetime, time, timedelta
import time
from cleanupclasses import cleanupTrackers as cleanupTrackers
from cleanupclasses import cleanupafcAudit as cleanupafcAudit
from cleanupclasses imp... | 2.1875 | 2 |
aws-blog-campanile/bin/objectcopy.py | securityscorecard/aws-big-data-blog | 305 | 41629 | #!/usr/bin/python2.7
import sys
import os
import fileinput
import argparse
import random
import tempfile
import ConfigParser
# -----------------------------------------------------------------------------
# Support for Hadoop Streaming Sandbox Env
# -------------------------------------------------------------------... | 1.820313 | 2 |
external/AnniesLasso/getting_started.py | dnidever/apogee | 8 | 41630 |
"""
Getting started with The Cannon and APOGEE
"""
import os
import numpy as np
from astropy.table import Table
import AnniesLasso as tc
# Load in the data.
PATH, CATALOG, FILE_FORMAT = ("/Users/arc/research/apogee/", "apogee-rg.fits",
"apogee-rg-custom-normalization-{}.memmap")
labelled_set = Table.read(os.pa... | 2.3125 | 2 |
b2ac/fit/double.py | hbldh/ellipse-fitting | 16 | 41631 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`fit`
==================
.. module:: fit
:synopsis:
.. moduleauthor:: hbldh <<EMAIL>>
Created on 2015-09-24, 07:18:22
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import a... | 2.78125 | 3 |
Contest/ABC068/a/main.py | mpses/AtCoder | 0 | 41632 | #!/usr/bin/env python3
print("ABC"+input()) | 2.3125 | 2 |
katacomb/katacomb/obit_context.py | ska-sa/katsdpcontim | 3 | 41633 | import logging
from contextlib import contextmanager
import AIPS
import AIPSDir
import ObitTalkUtil
import OErr
import OSystem
import katacomb.configuration as kc
log = logging.getLogger('katacomb')
# Single obit context class
__obit_context = None
class ObitContext(object):
"""
Small wrapper class enca... | 2.40625 | 2 |
Exercises/Week4/pexpect_tests.py | netkidd/py-ne | 0 | 41634 |
import pexpect
from getpass import getpass
'''
3. Use Pexpect to retrieve the output of 'show ip int brief' from pynet-rtr2.
4. Use PExpect to change the logging buffer size (logging buffered <size>) on pynet-rtr2. Verify this change by examining the output of 'show run'.
'''
rtr2_ip = '172.16.58.3'
rtr2_username =... | 2.609375 | 3 |
smart_open/tests/test_package.py | sivchand/smart_open | 2,047 | 41635 | <reponame>sivchand/smart_open<filename>smart_open/tests/test_package.py
# -*- coding: utf-8 -*-
import os
import unittest
import pytest
from smart_open import open
skip_tests = "SMART_OPEN_TEST_MISSING_DEPS" not in os.environ
class PackageTests(unittest.TestCase):
@pytest.mark.skipif(skip_tests, reason="requir... | 2.171875 | 2 |
medtrialextractor/formatting/read_annotations.py | juanmoo/MedTrialExtractor | 1 | 41636 | <filename>medtrialextractor/formatting/read_annotations.py
'''
Read Annotations file and save in struct
'''
import pandas as pd
import json
import codecs
import multiprocessing
from contextlib import contextmanager
# Utils
def match_ids_by_filename(ann, struct):
fname_to_id = {}
for doc_id in pd.unique(ann['... | 2.5625 | 3 |
prep/api/open_data.py | vbgupta/DS440-Transfer-Learning-Address-Sustainability-Issues | 0 | 41637 | <gh_stars>0
from path import Path
d = Path(__file__).parent.parent.parent
Path(d).chdir()
import pandas as pd
from sodapy import Socrata
def socrata_client(client_url: str, dataset_api_key: str, filename: str):
"""
client_url = found under developer portal -> str
dataset_api_key = found under developer por... | 2.609375 | 3 |
test/test_blog.py | Jn-mic/blog | 0 | 41638 | from app.models import User,Post, Comment,Clap
from app import db
# def setUp(self):
# self.user_Jack = User(username = 'Jack',password = '<PASSWORD>', email = '<EMAIL>')
def tearDown(self):
Post.query.delete()
User.query.delete()
Comment.query.delete()
Clap.query.delete() | 2.3125 | 2 |
data_generator/main.py | GValiente/gba-niccc | 9 | 41639 | """
Copyright (c) 2020 <NAME> <EMAIL>
zlib License, see LICENSE file.
"""
import json
import pygame
from draw import draw_polygon
from export import generate_shape_groups, write_frames, generate_horizontal_line_sets, generate_shapes, \
generate_horizontal_line_groups, optimize_screen_buffer_colors
... | 2.90625 | 3 |
tests/test_topics.py | Inria-Chile/risotto-backend | 0 | 41640 | def test_get_topics(client):
response = client.get("/topics/")
contents = response.get_json()
assert contents["status"] == "OK"
assert type(contents["payload"]) is dict
assert type(contents["payload"]["topics"]) is list
assert type(contents["payload"]["subtopics"]) is dict
assert response.s... | 2.75 | 3 |
wordvec.py | jackyin68/chinese-relationship-nre | 2 | 41641 | import logging
import multiprocessing
import os
import pickle as pkl
import numpy as np
import tensorflow as tf
from gensim.models import word2vec
from gensim.models.word2vec import PathLineSentences
logger = logging.getLogger('Word2Vec')
logger.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(nam... | 2.390625 | 2 |
spin/tests/__init__.py | otaviocv/spin | 0 | 41642 | """SPIN module test unit."""
| 1.007813 | 1 |
genetic.py | AHDiniz/AI-2020-02-Assignment-2 | 0 | 41643 | #!/usr/bin/python3.8
import time
import copy
import random
import numpy as np
import clustering as clt
class HyperParams:
def __init__(self, population_size : int, crossover_rate : float, mutation_rate : float):
self._population_size = population_size
self._crossover_rate = crossover_rate
... | 2.796875 | 3 |
src/Python/algorithm/leetcode_283_move_zeros.py | onlyonedaniel/algorithm | 0 | 41644 | from typing import List
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
# 知道是0所以可以直接覆盖
nums_len = len(nums)
num_count = 0
for i in range(nums_len):
if nums[i] != 0:
... | 3.515625 | 4 |
src/pytools/viz/util/_matplot.py | BCG-Gamma/pytools | 17 | 41645 | """
Utilities related to matplotlib.
"""
import logging
from matplotlib.ticker import Formatter
from pytools.api import AllTracker
from pytools.meta import SingletonMeta
log = logging.getLogger(__name__)
#
# Exported names
#
__all__ = ["PercentageFormatter"]
#
# Ensure all symbols introduced below are included... | 2.625 | 3 |
DailyCodingProblem/153_Othes_Find_Distance_between_Two_Words_In_a_String.py | RafayAK/CodingPrep | 5 | 41646 | <filename>DailyCodingProblem/153_Othes_Find_Distance_between_Two_Words_In_a_String.py
"""
Find an efficient algorithm to find the smallest distance
(measured in number of words) between any two given words in a string.
For example, given words "hello", and "world" and a text content of
"dog cat hello cat dog dog hello... | 4.28125 | 4 |
precedent/models/bad_query.py | lewisjared/precedent | 0 | 41647 | from django.db import models
class BadQuery(models.Model):
date = models.DateTimeField(auto_now=True)
query = models.TextField() | 2.015625 | 2 |
src/practices/practice/palindromic_paths/script.py | rahul38888/coding_practice | 1 | 41648 | # https://practice.geeksforgeeks.org/problems/number-of-palindromic-paths-in-a-matrix0819/1#
# at each node recursively call itself and at bottom,left cornet determine it its a palindrome
class Solution:
def rec(self, matrix, it, jt, ib, jb, cache):
if it > ib or jt > jb:
cache[(it, jt, ib, j... | 3.515625 | 4 |
sshub_middleware/settings/__init__.py | muhfajar/sshub-middleware | 0 | 41649 | import random
from .base import *
try:
from .private import *
except ImportError:
raise ImportError("""
Please create private.py file
with contain configuration for
====================================
SECRET_KEY = '{}'
DEBUG = False
ALLOWED_HOSTS = []
SSHUB_API = 'api-key'
==... | 2.3125 | 2 |
dvc/remote/gdrive/utils.py | Baranowski/dvc | 0 | 41650 | <reponame>Baranowski/dvc<gh_stars>0
import os
from dvc.progress import Tqdm
FOLDER_MIME_TYPE = "application/vnd.google-apps.folder"
class TrackFileReadProgress(object):
def __init__(self, progress_name, fobj):
self.progress_name = progress_name
self.fobj = fobj
file_size = os.fstat(fobj... | 2.375 | 2 |
SpringSemester2021/01_Jupyter-Python/Ex01_01_Sol.py | KretschiGL/DataScienceLecture | 1 | 41651 | # Numbers 0 to 10
print(list(range(0,11)))
print()
# Even numbers 0 to 10
print(list(range(0,11,2)))
print()
# Odd numbers 0 to 10
print(list(range(1,11,2)))
print()
# Numbers 20 to 10
print(list(range(20,9,-1)))
print()
# Numbers 45 to 75 divisable by 5
print(list(range(45, 76, 5)))
| 3.875 | 4 |
builder.py | onerbs/sublime-v | 15 | 41652 | import sublime, sublime_plugin
from os.path import join as join_path, isdir
from os import mkdir
IS_WINDOWS = sublime.platform() == 'windows'
PATH_SEPARATOR = '\\' if IS_WINDOWS else '/'
EXTENSION = '.exe' if IS_WINDOWS else ''
class VlangBuilderCommand(sublime_plugin.WindowCommand):
def run(self, **kwargs):
... | 2.28125 | 2 |
ex032.py | felipesch92/PythonExercicios | 0 | 41653 | <filename>ex032.py
from datetime import date
print('Coloque 0 para analisar o ano atual')
ano = int(input('Digite um ano para saber se é bissexto: '))
if ano == 0:
ano = date.today().year
if ano % 4 == 0:
if ano % 100 == 0:
if ano % 400 == 0:
b = True
else:
b = False
... | 3.828125 | 4 |
835.Image-Overlap.py | mickey0524/leetcode | 18 | 41654 | <filename>835.Image-Overlap.py
# https://leetcode.com/problems/monotonic-array/description/
#
# algorithms
# Medium (42.6%)
# Total Accepted: 4.8k
# Total Submissions: 11.2k
# beats 77.52% of python submissions
class Solution(object):
def largestOverlap(self, A, B):
"""
:type A: List[List[int]]... | 3.078125 | 3 |
logs_manager/migrations/0006_auto_20200724_0722.py | adwait-thattey/raygun_api | 0 | 41655 | # Generated by Django 2.1.5 on 2020-07-24 07:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('logs_manager', '0005_auto_20200724_0647'),
]
operations = [
migrations.RemoveField(
model_name='analyticlog',
name='logobjec... | 1.507813 | 2 |
stupydcache.py | garabik/stupydcache | 1 | 41656 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os, zlib, pickle, base64, string, hashlib, random, functools
# for 2/3 compatibility
try:
unicode
except NameError:
# this happens in python3
unicode = ()
def smart_str(obj):
"smart version of str(), works in both python2/3, regardless of whether obj... | 2.953125 | 3 |
django_dicom/models/utils/__init__.py | ZviBaratz/django-dicom | 8 | 41657 | <reponame>ZviBaratz/django-dicom
"""
Utilities for the :mod:`~django_dicom.models` module.
"""
from django_dicom.models.utils.utils import (
get_dicom_root,
snake_case_to_camel_case,
)
# flake8: noqa: F401
| 1.257813 | 1 |
csvwlib/utils/rdf/CSVW.py | Aleksander-Drozd/pycsvw | 3 | 41658 | <reponame>Aleksander-Drozd/pycsvw
term_mappings = {
'Cell': 'csvw:Cell',
'Column': 'csvw:Column',
'Datatype': 'csvw:Datatype',
'Dialect': 'csvw:Dialect',
'Direction': 'csvw:Direction',
'ForeignKey': 'csvw:ForeignKey',
'JSON': 'csvw:JSON',
'NCName': 'xsd:NCName',
'NMTOKEN': 'xsd:NMTOK... | 1.71875 | 2 |
src/visualization/visualize.py | zeou1/maggot_models | 0 | 41659 | <reponame>zeou1/maggot_models<gh_stars>0
import math
from collections import defaultdict
from operator import itemgetter
import colorcet as cc
import matplotlib
import matplotlib.colors as mplc
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import seaborn as sns
from matpl... | 2.0625 | 2 |
test/test_json.py | Zhu-Jianwei/LaTeX-helper | 4 | 41660 | <reponame>Zhu-Jianwei/LaTeX-helper
import json
json_data =r'''
{
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
},
"hello": {
"prefix": "hello",
"body": [
... | 2.828125 | 3 |
src/commands/jsdoc/generate_jsdoc.py | PranjalPansuriya/JavaScriptEnhancements | 690 | 41661 | import sublime, sublime_plugin
import os
from ...libs import util
from ...libs import JavascriptEnhancementsExecuteOnTerminalCommand
class JavascriptEnhancementsGenerateJsdocCommand(JavascriptEnhancementsExecuteOnTerminalCommand, sublime_plugin.WindowCommand):
is_node = True
is_bin_path = True
def prepare_comm... | 1.96875 | 2 |
scripts/airflow/dags/crash_geocoding.py | CityofToronto/bdit_move_etl | 0 | 41662 | """
crash_geocoding
Normalizes CRASH data into collision _events_ and collision _involved persons_, then matches
collision events to the centreline conflation target that was created by
`centreline_conflation_target`.
Our legacy schema in Oracle stores both event-related and involved-person-related information
in a s... | 2.09375 | 2 |
ir_axioms/axiom/__init__.py | webis-de/ir_axioms | 11 | 41663 | <gh_stars>10-100
from ir_axioms.axiom import (
argumentative, arithmetic, base, cache, conversion, length_norm,
lower_bound, proximity, query_aspects, retrieval_score, term_frequency,
term_similarity, simple, trec, estimator, preconditions
)
# Re-export from child modules.
ArgumentativeUnitsCountAxiom = ar... | 1.546875 | 2 |
Problem 10/advent10b.py | mankybansal/advent-of-code-2020 | 0 | 41664 | from collections import Counter
adapters = []
for line in open('input.txt', 'r').readlines():
adapters.append(int(line.strip()))
adapters = sorted(adapters)
device_joltage = adapters[-1] + 3
adapters.append(device_joltage)
dp = Counter()
dp[0] = 1
for adapter in adapters:
dp[adapter] = dp[adapter - 3] + dp[adapte... | 3.15625 | 3 |
src/architectures/transformer_encoder.py | francismontalbo/attention-is-all-you-need-paper | 167 | 41665 | import torch.nn as nn
from architectures.position_wise_feed_forward_net import PositionWiseFeedForwardNet
from architectures.multi_head_attention import MultiHeadAttention
from architectures.add_and_norm import AddAndNorm
class TransformerEncoderBlock(nn.Module):
def __init__(self, d_model, n_heads, d_ff, dropout... | 2.484375 | 2 |
pytools/terrainUtils.py | arwassa/bztools | 1 | 41666 | import struct
import numpy
from math import floor
class HeightMap:
def __init__(self, width, length, heightData=None, max_val=0):
self.heightData = (
heightData if heightData != None else [0 for n in range(width * length)]
)
self.width = width
self.length = length
... | 2.875 | 3 |
hg/res/loaders/image_loader.py | V0idExp/mercury | 0 | 41667 | <gh_stars>0
import os
import sdl2
from hg.gfx.sprite_renderer.sprite import Image
from .loader import Loader
class ImageLoader(Loader):
def __init__(self, sdl_renderer: sdl2.SDL_Renderer):
self.__renderer = sdl_renderer
def load(self, path):
surface = sdl2.ext.load_image(path)
tex... | 2.390625 | 2 |
Payloads/Zip-Traversal/make.py | 5tr1x/SecLists | 39,901 | 41668 | #!/usr/bin/env python3
import zipfile
# The file to USE inside the zip, before compression
filein = "index.php"
print("[i] FileIn: %s\n" % filein)
# How deep are we going?
depth = ""
# Loop 11 times (00-10)
for i in range(11):
# The .zip file to use
zipname = "depth-%02d.zip" % i
print("[i] ZipName: %s" % zip... | 3.890625 | 4 |
uwsgiconf/options/subscriptions.py | graceshaw/uwsgiconf | 0 | 41669 | from ..base import OptionsGroup
from ..exceptions import ConfigurationError
from ..utils import KeyValue, filter_locals
from .subscriptions_algos import *
class Subscriptions(OptionsGroup):
"""
This allows some uWSGI instances to announce their presence to subscriptions managing server,
which in its turn ... | 2.40625 | 2 |
python/kmeans.py | exTerEX/kmeans | 0 | 41670 | from ctypes import *
from typing import *
from pathlib import Path
from numpy import array, cos, ndarray, pi, random, sin, zeros, tan
try:
lib = cdll.LoadLibrary(str(Path(__file__).with_name("libkmeans.so")))
except Exception as E:
print(f"Cannot load DLL")
print(E)
class observation_2d(Structure):
... | 2.453125 | 2 |
tests/test_004.py | chingc/euler-python | 0 | 41671 | """https://projecteuler.net/problem=4"""
from euler.main import largest_palindrome
def test_004() -> None:
"""Expected: 906609"""
assert largest_palindrome(3) == 906609
| 2.484375 | 2 |
source/src/trand/plot_events.py | McIntyre-Lab/TranD | 0 | 41672 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""
Visualize fragments and events in a terminal
"""
def print_region(data):
"""
Print a scaled region to screen with labels and dashes for visualization.
... | 3.46875 | 3 |
utils/test/expected_values.py | DanielSola/bitcoin-analysis | 0 | 41673 | <reponame>DanielSola/bitcoin-analysis<filename>utils/test/expected_values.py
expected_number_of_transactions = [
2650, 2543, 1395, 2751, 2398, 2827, 2737, 3084, 1998, 2997, 976,
1929, 3268, 1904, 1772, 776, 2553, 2547, 2581, 2226, 2307, 2812,
2618, 177, 1538, 1990, 2323, 2613, 2503, 2140, 2542, 2291, 2782,
1... | 1.578125 | 2 |
cpnet/utils.py | skojaku/core-periphery-detection | 27 | 41674 | from collections import Counter, defaultdict
import matplotlib as mpl
import networkx as nx
import numba
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import seaborn as sns
from fa2 import ForceAtlas2
from scipy import sparse
def to_adjacency_matrix(net):
if sparse.issparse(net):
... | 2.640625 | 3 |
third_party/p7zip/Utils/file_P7ZIP.py | VirtualLib/juice | 0 | 41675 | <gh_stars>0
files_c=[
'C/Threads.c',
]
files_cpp=[
'CPP/7zip/UI/P7ZIP/wxP7ZIP.cpp',
'CPP/Common/IntToString.cpp',
'CPP/Common/MyString.cpp',
'CPP/Common/MyVector.cpp',
'CPP/Common/StringConvert.cpp',
'CPP/Windows/FileDir.cpp',
'CPP/Windows/FileFind.cpp',
'CPP/Windows/FileIO.cpp',
'CPP/Windows/FileName.cpp',... | 1.617188 | 2 |
explorations/webDeploy/gunicornTinyDemo/demo.py | paul-shannon/slexil | 0 | 41676 | from time import gmtime, strftime
def app(environ, start_response):
data = strftime("minimal gunicorn demo: %Y-%m-%d %H:%M:%S", gmtime()).encode('UTF-8')
start_response("200 OK", [
("Content-Type", "text/plain"),
("Content-Length", str(len(data)))
])
return iter([data])
| 2.34375 | 2 |
Arrays/54. Spiral matrix.py | Rage-ops/Leetcode-Solutions | 1 | 41677 | # Medium
# https://leetcode.com/problems/spiral-matrix/
# Time Complexity: O(N)
# Space Complexity: 0(1)
class Solution:
def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
return Solution.spiralsol(matrix, [])
@staticmethod
def spiralsol(matrix, res):
m = len(matrix)
i... | 3.703125 | 4 |
core/events/connection.py | w7cep/Pemgu-Bot | 1 | 41678 | <filename>core/events/connection.py
import discord
from discord.ext import commands
class OnConnect(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_connect(self):
self.bot.uptime = discord.utils.utcnow()
print(F"Logged in as: {self.b... | 2.765625 | 3 |
addons/Sprytile-6b68d00/rx/linq/observable/transduce.py | trisadmeslek/V-Sekai-Blender-tools | 733 | 41679 | """Transducers for RxPY.
There are several different implementations of transducers in Python.
This implementation is currently targeted for:
- http://code.sixty-north.com/python-transducers
You should also read the excellent article series "Understanding
Transducers through Python" at:
- http://sixty-north.com/bl... | 3.09375 | 3 |
flask_api_server/conf.py | SaraHan774/NaverDevfestAndroid | 0 | 41680 | <gh_stars>0
import json
with open('config.json', 'r') as f:
config = json.load(f)
n_thread = config["DEFAULT"]["THREAD_NUM"]
base_dir = config["DEFAULT"]["BASE_DIR"]
ip = config["DEFAULT"]["SERVER_IP"]
port = config["DEFAULT"]["SERVER_PORT"]
log_path = config["DEFAULT"]["LOGGING_PATH"]
| 1.960938 | 2 |
atari/atari.py | neevparikh/lwm | 17 | 41681 | <filename>atari/atari.py<gh_stars>10-100
import torch
from gym.spaces.box import Box
from baselines import bench
from baselines.common.vec_env.shmem_vec_env import ShmemVecEnv
from baselines.common.atari_wrappers import wrap_deepmind, make_atari
from baselines.common.vec_env import VecEnvWrapper
def make_vec_envs(nam... | 2.015625 | 2 |
05/scrum/board/views.py | mezklador/lightweight-django | 0 | 41682 | from django.contrib.auth import get_user_model
from rest_framework import authentication, permissions, viewsets, filters
from .forms import TaskFilter, SprintFilter
from .models import Sprint, Task
from .serializers import SprintSerializer, TaskSerializer, UserSerializer
#from django.shortcuts import render
User = ge... | 2.140625 | 2 |
server/scripts/tracking_markers_class2.py | stoddabr/chairbot_ui_rework | 0 | 41683 | <reponame>stoddabr/chairbot_ui_rework
'''
tracking_markers_class
version: 2
changed from version 1/0 to allow for an arbitrary
number of chairs. Instead of verbosely declaring every
chair as a variable in the class, now there is an array
of filenames saved in the self.filenames variable
TODO write a full description ... | 2.734375 | 3 |
tests/functional/rest/test_client.py | terrorizer1980/copra | 48 | 41684 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Functional tests for `copra.rest.Client` class.
Without any additional user input, this module will test all of the
unauthenticated methods of the copra.rest.Client.
An API key for the Coinbase Pro sandbox is required to test the authenticated
methods. The key informa... | 2.515625 | 3 |
img_proc/multiThread.py | carbo-T/TF | 1 | 41685 | <reponame>carbo-T/TF<filename>img_proc/multiThread.py
import tensorflow as tf
import numpy as np
import threading
import time
import os
import preprocessing
import mnist_inference
import matplotlib.pyplot as plt
# ********** queue operation ***********
def queue_op():
# FIFOQueue & RandomShuffleQueue
# maximu... | 2.53125 | 3 |
course_code/section2/1_variables_methods.py | KhrulSergey/AutomatedTesting_233 | 2 | 41686 | a = 5
b = 10
my_variable = 56
any_variable_name = 100
string_variable = "hello"
single_quotes = 'strings can have single quotes'
print(string_variable)
print(my_variable)
# print is a method with one parameter—what we want to print
def my_print_method(my_parameter):
print(my_parameter)
my_print_method(string_v... | 3.90625 | 4 |
V1_0_0_0/MCP79410_SetAndReadRegisters.py | MatteoDestro/RaspberryPi_MCP79410_RTCC | 0 | 41687 | <reponame>MatteoDestro/RaspberryPi_MCP79410_RTCC
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 root <<EMAIL>@R<PASSWORD>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundat... | 1.609375 | 2 |
app/urls.py | Pcyuzuzo/Hood | 0 | 41688 | <filename>app/urls.py
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.homepage, name='homepage'),
url(r'^add/hood$', views.add_hood, name='add_hood'),
url(r'^join_hood/(\d+)', views.join_hood... | 1.875 | 2 |
braviaproapi/bravia/appcontrol.py | BrandonDusseau/braviaproapi | 2 | 41689 | import html
from enum import Enum
from .errors import HttpError, ApiError, InternalError, AppLaunchError, NoFocusedTextFieldError, \
ErrorCode, get_error_message, EncryptionError
from .util import coalesce_none_or_empty
class AppFeature(Enum):
'''
Describes which features are supported by the current app.... | 2.90625 | 3 |
src/data/subreddits.py | ConorSheehan1/YouTubeTimestampRedditBot | 1 | 41690 | # https://www.reddit.com/wiki/bottiquette omit /r/suicidewatch and /r/depression
# note: lowercase for case insensitive match
blacklist = [
# https://www.reddit.com/r/Bottiquette/wiki/robots_txt_json
"anime",
"asianamerican",
"askhistorians",
"askscience",
"askreddit",
"aww",
"chicagosu... | 1.695313 | 2 |
management_utils/management_utils.py | singparvi/Photo-Transform-Application | 0 | 41691 | <filename>management_utils/management_utils.py
"""
cpu_data_loader.py - Loads all data in the ../../data/transcribed_stories directory
"""
import pathlib
import os.path as path
class CPUDataLoader():
def __init__(self):
self.data_path = path.join(path.dirname(__file__), "..", "..", "data", "transcribed_st... | 2.203125 | 2 |
accentify.py | Delfad0r/accentify | 0 | 41692 | <gh_stars>0
#! /usr/bin/env python3
import argparse
from pynput import keyboard
import pyperclip
import sys
ACUTE_ACCENTS = 'áéíóú'
GRAVE_ACCENTS = 'àèìòù'
class MultipleHotKeys(keyboard.Listener):
def __init__(self, hotkeys, *args, **kwargs):
self._hotkeys = [(set(keyboard.HotKey.parse(s)), f) for s, f... | 3.109375 | 3 |
web2py/applications/rip/modules/parseLogic.py | 2spmohanty/vcenter-automation | 1 | 41693 | import re
analysis_array = {'hvc': '151: 0x10b8 (4,280) ',
'applmgmt': '76: 0x7a0 (1,952) ', 'statsmonitor': '0: 0x0 (0) ', 'analytics': '643: 0x5cb8 (23,736) ',
'rhttpproxy': '0: 0x0 (0) ', 'vapi-endpoint': '912: 0x6d60 (28,000) ', 'vsm': '202: 0x1d90 (7,568) ',
'vmonapi': '71: 0x6a8 (1,7... | 2.171875 | 2 |
controller.py | SubmergedTree/SmartMirror | 0 | 41694 | <reponame>SubmergedTree/SmartMirror
from api.rest import RestApi
from api.rest_impl import RestBroker, RestImplSignal
from database.dao import UserDao, PictureDao, WidgetDao, WidgetUserDao, DBException
from recognition.camera import Camera, WhichCamera
from recognition.recognition import Scheduler
from recognition.lear... | 2.015625 | 2 |
natpn/model/lightning_module.py | borchero/natural-posterior-network | 22 | 41695 | <filename>natpn/model/lightning_module.py
# pylint: disable=abstract-method
from typing import Any, cast, Dict, List, Tuple, Union
import pytorch_lightning as pl
import torch
from pytorch_lightning.callbacks import EarlyStopping
from torch import optim
from torchmetrics import Accuracy, MeanSquaredError
import natpn.di... | 2.203125 | 2 |
tests/test_cdigraphlayout.py | idekerlab/cdigraphlayout | 0 | 41696 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_cdigraphlayout
----------------------------------
Tests for `cdigraphlayout` module.
"""
import os
import sys
import unittest
import io
import tempfile
import shutil
import json
import ndex2
from cdigraphlayout import cdigraphlayoutcmd
class TestCdIgraphLayout... | 2.59375 | 3 |
uninas/utils/generate/networks/manually/resnet.py | cogsys-tuebingen/uninas | 18 | 41697 | """
Deep Residual Learning for Image Recognition
https://arxiv.org/abs/1512.03385
"""
from typing import Type
import torch.nn as nn
from uninas.modules.networks.stackedcells import StackedCellsNetworkBody
from uninas.modules.stems.cnn import ConvStem
from uninas.modules.layers.cnn import PoolingLayer
from uninas.modul... | 2.609375 | 3 |
paymentpoller/balanceupdater.py | tahv0/etherneumpaymentbot | 2 | 41698 | #!/usr/bin/env python
import requests
from datetime import datetime
from config_parser.config_parser import get_config_value
from db.models import AccountBalance, Account, Session
from sqlalchemy.orm import eagerload
def update_accounts_balances(tgbot):
config_json_rpc_api_url = get_config_value('BLOCKCHAINPOLLER'... | 2.265625 | 2 |
pytorch/main.py | cch1999/DMCNN | 0 | 41699 | <gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import pandas as pd
import numpy as np
import os
# Device configuration
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print(device)
# Hyper parameters... | 2.640625 | 3 |