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 |
|---|---|---|---|---|---|---|
hy-data-analysis-with-python-spring-2020/part03-e07_meeting_planes/src/meeting_planes.py | Melimet/DAP2020 | 0 | 27900 | #!/usr/bin/python3
import numpy as np
def meeting_planes(a1, b1, c1, a2, b2, c2, a3, b3, c3):
return []
def main():
a1=1
b1=4
c1=5
a2=3
b2=2
c2=1
a3=2
b3=4
c3=1
x, y, z = meeting_planes(a1, b1, c1, a2, b2, c2, a3, b3, c3)
print(f"Planes meet at x={x}, y={y} and z={z}"... | 3.34375 | 3 |
setup.py | iatlab/datas-utils | 0 | 27901 | <reponame>iatlab/datas-utils
# -*- coding:utf-8 -*-
from setuptools import setup
setup(
name = "datas_utils",
packages = ["datas_utils",
"datas_utils.env",
"datas_utils.log",
"datas_utils.aws",
],
version = "0.0.1",
description = "Tools fo... | 1.109375 | 1 |
Lib/fontTools/ttLib/tables/T_S_I_B_.py | twardoch/fonttools-py27 | 240 | 27902 | <reponame>twardoch/fonttools-py27
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from .T_S_I_V_ import table_T_S_I_V_
class table_T_S_I_B_(table_T_S_I_V_):
pass
| 0.988281 | 1 |
src/paths_to_inodes_paths.py | poponealex/suprenam | 8 | 27903 | from pathlib import Path
from typing import List
from src.user_errors import NoItemToRenameError
from src.user_types import Inode, InodesPaths
def paths_to_inodes_paths(paths: List[Path]) -> InodesPaths:
"""
Given a list of paths, return a mapping from inodes to paths.
Args:
paths: list of Path ... | 3.0625 | 3 |
faro/utils.py | cgiraldo/FARO | 0 | 27904 | import re
import gensim.utils as gensim_utils
def normalize_text_proximity(message):
""" Clean text of dots between words
Keyword arguments:
message -- a plain sentence or paragraph
"""
sent = message.lower()
sent = sent.replace("á", "a")
sent = sent.replace("é", "e")
sent = sen... | 3.046875 | 3 |
assistant/tests/internetcheck.py | SPARC-Auburn/Lab-Assistant | 9 | 27905 | <reponame>SPARC-Auburn/Lab-Assistant
import socket
def is_connected():
REMOTE_SERVER = "www.google.com"
try:
# see if we can resolve the host name -- tells us if there is
# a DNS listening
host = socket.gethostbyname(REMOTE_SERVER)
# connect to the host -- tells us if the host ... | 2.96875 | 3 |
back/color.py | PoCInnovation/AI4UX | 0 | 27906 | <filename>back/color.py
import extcolors
import PIL
def new_image(image, x1, y1, x2, y2):
area = (x1, y1, x2, y2)
tmp = image.crop(area)
return tmp
def nbColor_daltonisme(image, total):
protanopie = [] # Ne voit pas le rouge
deutéranopie = [] # Ne voit pas le vert
tritanopie = [] # Ne voi... | 2.890625 | 3 |
base_pool/mysql_pool/mysql_views.py | zhanzhangwei/kafka-study | 0 | 27907 | <reponame>zhanzhangwei/kafka-study<filename>base_pool/mysql_pool/mysql_views.py
import json
import pymysql
import datetime
from dbutils.pooled_db import PooledDB
import pymysql
from conf.common import *
class MysqlClient(object):
__pool = None
def __init__(self):
"""
:param mincached:连接池中空闲... | 2.609375 | 3 |
script/sklearn_like_toolkit/warpper/wrapperGridSearchCV.py | demetoir/MLtools | 0 | 27908 | <reponame>demetoir/MLtools<gh_stars>0
from sklearn import model_selection
from sklearn.externals.joblib import Parallel
from tqdm import tqdm
from script.sklearn_like_toolkit.warpper.base.MixIn import ClfWrapperMixIn, MetaBaseWrapperClfWithABC
import multiprocessing
CPU_COUNT = multiprocessing.cpu_count()
#... | 2.296875 | 2 |
cliente/templates/forms.py | ricardosmbr/smartcon | 0 | 27909 | <gh_stars>0
from django import forms
from sistema.mail import send_mail_template
from .models import Cliente
from usuario.models import Usuario
from carteira.models import Carteira
from eth_account import Account
class MostrarCarteira(forms.ModelForm):
name = forms.CharField(widget=forms.TextInput(attrs={'readonl... | 2.15625 | 2 |
weibospider/settings.py | czyczyyzc/WeiboSpider | 2 | 27910 | <filename>weibospider/settings.py
# -*- coding: utf-8 -*-
import os
import random
BOT_NAME = 'spider'
SPIDER_MODULES = ['spiders']
NEWSPIDER_MODULE = 'spiders'
ROBOTSTXT_OBEY = False
cookies_file = os.path.join(os.path.split(os.path.realpath(__file__))[0], 'cookies.txt')
with open(cookies_file, 'r', encoding='utf-8... | 2.21875 | 2 |
angr/procedures/libc/tolower.py | mariusmue/angr | 2 | 27911 | import angr
from angr.sim_type import SimTypeInt
import logging
l = logging.getLogger("angr.procedures.libc.tolower")
class tolower(angr.SimProcedure):
def run(self, c):
self.argument_types = {0: SimTypeInt(self.state.arch, True)}
self.return_type = SimTypeInt(self.state.arch, True)
retu... | 2.734375 | 3 |
tests/main/views/test_agreements.py | uk-gov-mirror/alphagov.digitalmarketplace-api | 25 | 27912 | <filename>tests/main/views/test_agreements.py<gh_stars>10-100
import json
from datetime import datetime
from freezegun import freeze_time
from app.models import AuditEvent, db, Framework, FrameworkAgreement, User
from tests.helpers import fixture_params
from tests.bases import BaseApplicationTest
class BaseFrameworkA... | 2.046875 | 2 |
linear_regression_boston_housing.py | coherent17/boston_housing_linear_regression | 0 | 27913 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
from sklearn.metrics imp... | 3.234375 | 3 |
examples/nlp/cosmos_qa/simple.py | SebiSebi/DataMine | 9 | 27914 | import data_mine as dm
from data_mine.nlp.cosmos_qa import CosmosQAType
def main():
df = dm.COSMOS_QA(CosmosQAType.TRAIN)
print(df)
print("\n")
df = df.sample(n=1)
row = next(df.iterrows())[1]
print("Question: ", row.question, "\n")
print("Context: ", row.context, "\n")
for i, answer... | 2.640625 | 3 |
egs/wsj/s5/steps/libs/nnet3/train/__init__.py | TiagoPellegrini/Kaldi | 0 | 27915 | <reponame>TiagoPellegrini/Kaldi
# Copyright 2016 <NAME>
# Apache 2.0
""" This library has classes and methods commonly used for training nnet3
neural networks.
It has separate submodules for frame-level objectives and chain objective:
frame_level_objf -- For both recurrent and non-recurrent architectures
chain_objf ... | 1.53125 | 2 |
backend/connect.py | TrustedCapsules/policyBuilder | 0 | 27916 | # used for connecting to the trusted capsule server
import socket
TCP_IP = '127.0.0.1'
TCP_PORT = 4000
BUFFER_SIZE = 1024
MESSAGE = "Hello, World!"
def connect(ip: str, port: int, request: bytes):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, port))
s.send(request)
print("sent"... | 3.015625 | 3 |
src/randonet/pytorch/transformer.py | ahgamut/randonet | 0 | 27917 |
from randonet.generator.param import Param, IntParam, FloatParam, BinaryParam, ChoiceParam, TupleParam
from randonet.generator.unit import Unit, Factory as _Factory
from randonet.generator.conv import ConvFactory, ConvTransposeFactory
from collections import namedtuple
class TransformerEncoder(_Factory):
def __i... | 2.5 | 2 |
ooobuild/lo/rendering/x_sprite.py | Amourspirit/ooo_uno_tmpl | 0 | 27918 | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | 1.773438 | 2 |
my_shelter/dog_shelters/serializers.py | seajhawk/DjangoCRUD | 0 | 27919 | from rest_framework import serializers
from . import models
class ShelterSerializer(serializers.ModelSerializer):
class Meta:
model = models.Shelter
fields = ('name',
'location')
class DogSerializer(serializers.ModelSerializer):
class Meta:
model = models.Dog
... | 2.203125 | 2 |
astropy/utils/tests/test_xml.py | xiaomi1122/astropy | 0 | 27920 | <filename>astropy/utils/tests/test_xml.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ...extern import six
import io
from ..xml import check, unescaper, writer
def test_writer():
... | 2.15625 | 2 |
demo/multimodal/offline/txt2img/index_and_export/src/indexing/milvus/pull.py | meta-soul/MetaSpore | 32 | 27921 | <filename>demo/multimodal/offline/txt2img/index_and_export/src/indexing/milvus/pull.py
#
# Copyright 2022 DMetaSoul
#
# 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... | 2.140625 | 2 |
lab6/lab6_ttt.py | macarl08/esc180_coursework | 0 | 27922 | <filename>lab6/lab6_ttt.py
# ESC180 Lab 6
# lab6_ttt.py
# Oct 15, 2021
# Done in collaboration by:
# Ma, <NAME> (macarl1) and
# <NAME> (xushenxi)
'''
X | O | X
---+---+---
O | O | X
---+---+---
| X |
'''
import random
def print_board_and_legend(board):
for i in range(3):
line1 = " " + board... | 3.3125 | 3 |
sopel/modules/morestuff.py | paulmadore/funkshelper | 0 | 27923 | <reponame>paulmadore/funkshelper<filename>sopel/modules/morestuff.py
#!/usr/bin/python3
# coding=utf-8
"""
Chuck Norris and Other Jokes Module copyright 2015 phm.link
Licensed under Mozilla Public License Version 2.
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import... | 2.15625 | 2 |
scripts/dqn_utils.py | woowonjin/Reinforcement_Leraning_for_Optimal_Sepsis_Treatment | 0 | 27924 | <gh_stars>0
"""
The classes and methods in this file are derived or pulled directly from https://github.com/sfujim/BCQ/tree/master/discrete_BCQ
which is a discrete implementation of BCQ by <NAME>, et al. and featured in the following 2019 DRL NeurIPS workshop paper:
@article{fujimoto2019benchmarking,
title={Benchmark... | 1.984375 | 2 |
src/LedgerCompliance/utils.py | vchain-us/ledger-compliance-py | 3 | 27925 | import struct
_SetSeparator=b"_~|IMMU|~_"
def wrap_zindex_ref(key: bytes, index) -> bytes:
fmt=">{}sQB".format(len(key))
if index!=None and index.index!=None:
ret=struct.pack(fmt,key,index.index,1)
else:
ret=struct.pack(fmt,key,0,0)
return ret
def unwrap_zindex_ref(value:bytes):
l=len(value)
fmt=">{}sQB".f... | 2.546875 | 3 |
expertise_levels.py | erelsgl/voting | 0 | 27926 | <filename>expertise_levels.py
#!python3
"""
Utilities for computing random expertise levels.
"""
import numpy as np
from scipy.stats import truncnorm, beta
def fixed_expertise_levels(mean:float, size:int):
return np.array([mean]*size)
MIN_PROBABILITY=0.501
MAX_PROBABILITY=0.999
def truncnorm_expertise_levels(me... | 3.359375 | 3 |
tests/test_factory.py | mrled/interpersonal | 0 | 27927 | """Testing the Flask application factory"""
import os
import tempfile
import textwrap
from interpersonal import create_app
def test_config():
"""Test the application configuration
Make sure it works in testing mode and in normal mode.
"""
db_fd, db_path = tempfile.mkstemp()
conf_fd, conf_path =... | 2.46875 | 2 |
examples/hand_pose_estimation/processors_keypoints.py | ManuelMeder/paz | 0 | 27928 | <filename>examples/hand_pose_estimation/processors_keypoints.py
import numpy as np
from backend_keypoints import create_score_maps, extract_2D_keypoints
from backend_keypoints import crop_image_from_coordinates, extract_keypoints
from backend_keypoints import crop_image_from_mask, extract_hand_segment
from backend_key... | 2.609375 | 3 |
pyschool/static/libs/importhooks/FileSystemHook.py | niansa/brython-in-the-classroom | 14 | 27929 | <reponame>niansa/brython-in-the-classroom<gh_stars>10-100
import BaseHook
from browser import window
from javascript import JSObject
import sys
sys.path.append("../FileSystem")
import FileObject
#define my custom import hook (just to see if it get called etc).
class FileSystemHook(BaseHook.BaseHook):
def __init__(... | 2.140625 | 2 |
demo_app_new.py | pnazarenko1405/final_project_data_analysis | 0 | 27930 | import sql as sql
import streamlit as st
from streamlit_folium import folium_static
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import json
import sys
import folium
import requests
from bs4 import BeautifulSoup
import csv
from tqdm import tqdm
import webbrowser
import os.path as osp
import... | 2.65625 | 3 |
tuxeatpi_common/initializer.py | TuxEatPi/common | 0 | 27931 | <gh_stars>0
"""Module defining the init process for TuxEatPi component"""
import logging
class Initializer(object):
"""Initializer class to run init action for a component"""
def __init__(self, component, skip_dialogs=False, skip_intents=False, skip_settings=False):
self.component = component
... | 2.421875 | 2 |
devday/sponsoring/__init__.py | jenslauterbach/devday_website | 6 | 27932 | default_app_config = 'sponsoring.apps.SponsoringConfig'
| 1.132813 | 1 |
movie/migrations/0003_auto_20200718_0759.py | edith007/The-Movie-Database | 2 | 27933 | # Generated by Django 2.2.12 on 2020-07-18 07:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('movie', '0002_auto_20200717_1039'),
]
operations = [
migrations.RemoveField(
model_name='show',
name='plot',
... | 1.617188 | 2 |
figures/styles.py | Jakob-Unfried/msc-legacy | 1 | 27934 | <filename>figures/styles.py
colors_per_chi = {2: 'green', 3: 'orange', 4: 'purple', 5: 'pink', 6: 'red'}
style_per_chi = {2: '-', 3: '-.', 4: 'dotted'}
markers_per_reason = {'converged': 'o', 'progress': 'x', 'ressources': 'v'}
linewidth = 5.31596
| 1.453125 | 1 |
index.py | tapanbk/compass-distance-and-bearing | 0 | 27935 | <reponame>tapanbk/compass-distance-and-bearing
def calculate_compass_distance(origin, destination):
import math
origin_latitude, origin_longitude = origin
destination_latitude, destination_longitude = destination
# 3959 = > Miles and 6371 = > KM
# unit in meters
radius = 6371*1000
dlat = mat... | 3.34375 | 3 |
codes/src/util/isotime.py | CorbinFoucart/FEMexperiment | 2 | 27936 | <reponame>CorbinFoucart/FEMexperiment
# -*- coding: utf-8 -*-
"""@package isotime
Creates a string containing the current local time in ISO 8601 basic format
@author: <NAME> (<EMAIL>)
"""
from datetime import datetime
#from matplotlib.dates import SEC_PER_DAY
SEC_PER_DAY = 86400
def isotime():
"""Current local t... | 3.453125 | 3 |
src/cosmic_ray/tools/filters/filter_app.py | XD-DENG/cosmic-ray | 1 | 27937 | <gh_stars>1-10
"""A simple base for creating common types of work-db filters.
"""
import argparse
import logging
import sys
from exit_codes import ExitCode
from cosmic_ray.work_db import use_db
class FilterApp:
"""Base class for simple WorkDB filters.
This provides command-line handling for common filter o... | 2.90625 | 3 |
Crawl/Code/com.vitan.test/mao.py | ivitan/LearnPython | 1 | 27938 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 18-10-28 上午11:51
# @Author : Vitan
# @File : mao.py
import requests
import re
import json
from multiprocessing import Pool
from requests.exceptions import RequestException
def get_one_page(url):
headers = {'user-agent': 'Mozilla/5.0 (X11;... | 2.765625 | 3 |
setup.py | CubexX/shortest-python | 0 | 27939 | from distutils.core import setup
setup(
name='shortest-python',
packages=['shortest'],
version='0.1',
description='Python library for shorte.st url shortener',
long_description="More on github: https://github.com/CubexX/shortest-python",
author='CubexX',
author_email='<EMAIL>',
url='htt... | 1.296875 | 1 |
04_random_forest_exp.py | markysamson/CDSWcreditcardfraud | 0 | 27940 | # # Building and Evaluating Random Forest Model
# ## Setup
# Import useful packages, modules, classes, and functions:
from __future__ import print_function
from pyspark.sql import SparkSession
from pyspark.sql.functions import col
#import numpy as np
#import pandas as pd
import matplotlib.pyplot as plt
#import seabor... | 3.4375 | 3 |
src/vegasflow/vflowplus.py | N3PDF/vegasflow | 20 | 27941 | """
Implementation of vegas+ algorithm:
adaptive importance sampling + adaptive stratified sampling
from https://arxiv.org/abs/2009.05112
The main interface is the `VegasFlowPlus` class.
"""
from itertools import product
import numpy as np
import tensorflow as tf
from vegasflow.configflow import (
... | 2.796875 | 3 |
data_collector/neo-wrapper.py | cardwizard/vulnerable-python-ecosystem | 0 | 27942 | <filename>data_collector/neo-wrapper.py
from neo4j import GraphDatabase
port = 7688
data_uri = 'bolt://localhost:' + str(port)
username = 'neo4j'
password = '<PASSWORD>'
# data_creds = (username, password)
data_creds = None
driver = GraphDatabase.driver(data_uri, auth=data_creds)
def close_db():
driver.close()
... | 2.40625 | 2 |
kopf/storage/progress.py | michaelnarodovitch/kopf | 0 | 27943 | <gh_stars>0
"""
State stores are used to track the handlers' states across handling cycles.
Specifically, they track which handlers are finished, which are not yet,
and how many retries were there, and some other information.
There could be more than one low-level k8s watch-events per one actual
high-level kopf-event... | 1.539063 | 2 |
spotty/config/abstract_instance_config.py | Inculus/spotty | 1 | 27944 | from abc import ABC
class AbstractInstanceConfig(ABC):
def __init__(self, config: dict):
self._name = config['name']
self._provider_name = config['provider']
self._params = config['parameters']
@property
def name(self) -> str:
"""Name of the instance."""
return se... | 3.375 | 3 |
scripts/helper.py | skurscheid/camda2019-workflows | 1 | 27945 | <gh_stars>1-10
def get_failed_ids(txt_file):
id = []
fh = open(txt_file, 'r')
for row in fh:
id.append(row.split('/')[1].split('.')[0])
return(id)
| 2.796875 | 3 |
setup.py | lizhizhou/django_tidb | 0 | 27946 | <gh_stars>0
#!/usr/bin/env python
from distutils.core import setup
long_description = """TiDB backend for Django"""
setup(
name='django_tidb',
version='2.1',
author='<NAME>',
author_email='<EMAIL>',
url='http://github.com/blacktear23/django_tidb',
download_url='http://github.com/blackear23/dj... | 1.046875 | 1 |
common/utils/utils.py | hvsuchitra/tv_tracker | 0 | 27947 | <reponame>hvsuchitra/tv_tracker
import smtplib
def get_binary(src_file):
with open(src_file, 'rb') as f:
return f.read()
def send_mail(to, username, password, message_type='account_creation'):
server = 'smtp.mail.me.com'
port = 587
email = 'mailid'
_password = 'password'
if message_... | 2.515625 | 3 |
venv/lib/python3.8/site-packages/ansible_collections/community/aws/plugins/modules/lambda_alias.py | saeedya/docker-ansible | 7 | 27948 | <reponame>saeedya/docker-ansible<gh_stars>1-10
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: lambda_alias... | 1.796875 | 2 |
tarkov/bots/generator/loot/_base.py | JustEmuTarkov/jet_py | 14 | 27949 | from __future__ import annotations
from typing import TYPE_CHECKING
from dependency_injector.wiring import Provide, inject
from server.container import AppContainer
from ._types import BotInventoryContainers, LootGenerationConfig
if TYPE_CHECKING:
# pylint: disable=cyclic-import
from tarkov.bots.bots import... | 2.0625 | 2 |
calico/datadog_checks/calico/check.py | davidlrosenblum/integrations-extras | 158 | 27950 | <reponame>davidlrosenblum/integrations-extras
from datadog_checks.base import OpenMetricsBaseCheckV2
from .metrics import METRIC_MAP
class CalicoCheck(OpenMetricsBaseCheckV2):
def __init__(self, name, init_config, instances=None):
super(CalicoCheck, self).__init__(
name,
init_con... | 1.960938 | 2 |
python/python_challenge/25/25.py | yunyu2019/blog | 0 | 27951 | <reponame>yunyu2019/blog<filename>python/python_challenge/25/25.py<gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Date : 2016-05-17 16:36:18
# @Author : Yunyu2019 (<EMAIL>)
# @Link : http://www.pythonchallenge.com/pc/hex/lake.html
import os
import wave
import time
import Image
import requests... | 2.953125 | 3 |
scripts/initial_check.py | GenomeImmunobiology/hervk_kmers | 0 | 27952 | #!/usr/bin/env python
'''
Copyright (c) 2020 RIKEN
All Rights Reserved
See file LICENSE for details.
'''
import os,sys,datetime,multiprocessing
from os.path import abspath,dirname,realpath,join
import log,traceback
# http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
def which(program):
... | 2.421875 | 2 |
megalinter/tests/test_megalinter/linters/rust_clippy_test.py | private-forks/mega-linter | 0 | 27953 | <reponame>private-forks/mega-linter
# !/usr/bin/env python3
"""
Unit tests for RUST linter clippy
This class has been automatically generated by .automation/build.py, please do not update it manually
"""
from unittest import TestCase
from megalinter.tests.test_megalinter.LinterTestRoot import LinterTestRoot
class r... | 1.125 | 1 |
tests/test_loader.py | sergeyglazyrindev/asceticcmdrunner | 0 | 27954 | <filename>tests/test_loader.py
import mock
from acmdrunner import Loader
import os
import tests.management.acr_commands
active_dir = os.getcwd()
cur_dir = os.path.dirname(__file__)
def test_load_from_directory():
with mock.patch(
'acmdrunner.loader.load_commands_from_directory',
autospec=... | 2.328125 | 2 |
tests/test_from_avro.py | godatadriven/pydantic-avro | 7 | 27955 | from pydantic_avro.avro_to_pydantic import avsc_to_pydantic
def test_avsc_to_pydantic_empty():
pydantic_code = avsc_to_pydantic({"name": "Test", "type": "record", "fields": []})
assert "class Test(BaseModel):\n pass" in pydantic_code
def test_avsc_to_pydantic_primitive():
pydantic_code = avsc_to_pyda... | 2.5625 | 3 |
dojo/unittests/tools/test_cloudsploit_parser.py | art-tykh/django-DefectDojo | 1,772 | 27956 | from django.test import TestCase
from dojo.models import Test
from dojo.tools.cloudsploit.parser import CloudsploitParser
class TestCloudsploitParser(TestCase):
def test_cloudsploit_parser_with_no_vuln_has_no_findings(self):
testfile = open("dojo/unittests/scans/cloudsploit/cloudsploit_zero_vul.json")
... | 2.484375 | 2 |
mwaa/mwaa-cdk/mwaa_cdk/deploy_files.py | 094459/time-series-and-data-lakes | 9 | 27957 | <gh_stars>1-10
from aws_cdk import core
import aws_cdk.aws_ec2 as ec2
import aws_cdk.aws_s3 as s3
import aws_cdk.aws_s3_deployment as s3deploy
import aws_cdk.aws_iam as iam
class MwaaCdkStackDeployFiles(core.Stack):
def __init__(self, scope: core.Construct, id: str, vpc, mwaa_props, **kwargs) -> None:
s... | 2.03125 | 2 |
caloric_balance/test_main_getUserString.py | ankitsumitg/python-projects | 1 | 27958 | <reponame>ankitsumitg/python-projects
"""
Do Not Edit this file. You may and are encouraged to look at it for reference.
"""
import sys
if sys.version_info.major != 3:
print('You must use Python 3.x version to run this unit test')
sys.exit(1)
import unittest
import main
class TestGetUserString(unittest.Tes... | 3.484375 | 3 |
corehq/ex-submodules/phonelog/management/commands/migrate_device_entry.py | dimagilg/commcare-hq | 471 | 27959 | <reponame>dimagilg/commcare-hq
from datetime import datetime, timedelta
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connection
from phonelog.models import OldDeviceReportEntry, DeviceReportEntry
COLUMNS = (
"xform_id", "i", "msg", "type", "date", "se... | 2.078125 | 2 |
UnB/PI2-SESC/SESCdraw.py | nauam/vuepress-next | 0 | 27960 | <filename>UnB/PI2-SESC/SESCdraw.py<gh_stars>0
import pygame
import math
from pygame.locals import *
from OpenGL.GL import *
########################################################
################## CONFIGURAÇÕES MESA ##################
larCamp = 1160
altCamp = 770
passo = 0.53
apasso = 0.18 #deg
xJ... | 2.359375 | 2 |
linked_list_reversal.py | Nikhilxavier/Linked-List | 0 | 27961 | """
Implementation of Linked List reversal.
"""
# Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
class Node:
"""Node class for Singly Linked List."""
def __init__(self, value):
self.value = value
self.next_node = None
def reverse_linked_list(head):
"""Reverse linked list.
Return... | 3.796875 | 4 |
scripts/stats/cluster/transform_documents_2d.py | foobar999/Wikipedia-Cluster-Analysis | 0 | 27962 | <gh_stars>0
import argparse
from sklearn import decomposition
from sklearn.manifold import TSNE
from scripts.utils.utils import init_logger, save_npz
from scripts.utils.documents import load_document_topics
logger = init_logger()
def main():
parser = argparse.ArgumentParser(description='maps a given high-dimensi... | 2.65625 | 3 |
1701-1800/1711-1720/1711-countGoodMeals/countGoodMeals.py | xuychen/Leetcode | 0 | 27963 | <gh_stars>0
from collections import defaultdict
class Solution(object):
def countPairs(self, deliciousness):
"""
:type deliciousness: List[int]
:rtype: int
"""
max_sum = max(deliciousness) * 2
count = 0
dictionary = defaultdict(int)
for value in del... | 3.09375 | 3 |
gbmk2pinb.py | tebeka/pythonwise | 21 | 27964 | #!/usr/bin/env python
'''
Port Google Bookmarks over to pinboard.in
* Export Google Bookmarks by hitting
http://www.google.com/bookmarks/?output=xml&num=10000
* Get pinboard auth_token from https://pinboard.in/settings/password
Run:
./gbmk2pinb.py bookmarks.xml --auth-token <token>
'''
import requests
from cS... | 2.515625 | 3 |
rover/type-ab/wheels_service.py | GamesCreatorsClub/GCC-Rover | 3 | 27965 | <filename>rover/type-ab/wheels_service.py
#!/usr/bin/env python3
#
# Copyright 2016-2017 Games Creators Club
#
# MIT License
#
import traceback
import time
import re
import copy
import pyroslib
import storagelib
import smbus
#
# wheels service
#
#
# This service is responsible for moving wheels on the rover.
# Curre... | 2.46875 | 2 |
src/hyper_prompt/segments/git.py | artbycrunk/hyper-prompt | 5 | 27966 | import os
import re
import subprocess
from ..segment import BasicSegment
class Repo(object):
symbols = {
"detached": "\u2693",
"ahead": "\u2B06",
"behind": "\u2B07",
"staged": "\u2714",
"changed": "\u270E",
"new": "\uf128",
"conflicted": "\u2... | 2.390625 | 2 |
edg_core/test_simple_const_prop.py | tengisd/PolymorphicBlocks | 0 | 27967 | import unittest
from . import *
from edg_core.ScalaCompilerInterface import ScalaCompiler
class TestConstPropInternal(Block):
def __init__(self) -> None:
super().__init__()
self.float_param = self.Parameter(FloatExpr())
self.range_param = self.Parameter(RangeExpr())
class TestParameterConstProp(Bloc... | 2.578125 | 3 |
get_types.py | AllanMoralesPrado/PokeAPI-project | 0 | 27968 | <reponame>AllanMoralesPrado/PokeAPI-project<filename>get_types.py
#Modulo que devuelve tres valores:
# pkmn_type_en: lista de str cuyos valores son los nombres de los tipos del pokemon (en ingles)
# special_type: lista de str cuyos valores son los nombres de los tipos especiales del pokemon
# pkmn_damage_rel: dicciona... | 2.5 | 2 |
pyPractise/jcp030.py | enyaooshigaolo/MyPython | 0 | 27969 | '''
Created on 2017年1月15日
@author: Think
题目:一个5位数,判断它是不是回文数。即12321是回文数,个位与万位相同,十位与千位相同。
1.程序分析:同29例
2.程序源代码:
'''
from pip._vendor.distlib.compat import raw_input
def jcp030():
x = int(raw_input('input a number:\n'))
x = str(x)
for i in range(len(x)//2):
if x[i] != x[-i - 1]:
print('... | 3.515625 | 4 |
scripts/anisotropy.py | jmsung/APC | 0 | 27970 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Created by <NAME> (<EMAIL>)
Anisotropy data analysis
The equation for the curve as published by Marchand et al. in Nature Cell Biology in 2001 is as follows:
y = a + (b-a) / [(c(x+K)/K*d)+1], where
a is the anisotropy without protein,
b... | 3.15625 | 3 |
tensorflow/standard/reinforcement_learning/rl_on_gcp_demo/trainer/ddpg_agent.py | VanessaDo/cloudml-samples | 1,552 | 27971 | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.109375 | 2 |
setup.py | my-old-projects/syspy | 0 | 27972 | <filename>setup.py
from distutils.core import setup
setup(
name = 'syspy',
version = '0.2',
url = 'https://github.com/aligoren/syspy',
download_url = 'https://github.com/aligoren/syspy/archive/master.zip',
author = '<NAME> <<EMAIL>>',
author_email = '<EMAIL>',
license = 'Apache v2.0 License... | 1.195313 | 1 |
DjangoECom/products/migrations/0003_auto_20210109_2256.py | MostafaSamyFayez/E-Commerce-Sys | 2 | 27973 | # Generated by Django 3.1.4 on 2021-01-09 20:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('products', '0002_auto_20... | 1.648438 | 2 |
setup.py | PiotrRadzinski/envemind | 0 | 27974 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from distutils.core import Extension
import pathlib
here = pathlib.Path(__file__).parent.resolve()
setup(
name='envemind',
version='0.0.1',
description='Prediction of monoisotopic mass in mass spectra',
# long_des... | 1.234375 | 1 |
build.py | niklas2902/py4godot | 2 | 27975 | import argparse
import os
import subprocess
import time
from Cython.Build import cythonize
import generate_bindings
from meson_scripts import copy_tools, download_python, generate_init_files, \
locations, platform_check, generate_godot, \
download_godot
generate_bindings.build()
def cythonize_files():
m... | 2.171875 | 2 |
pacote-download/Python/modulo01/python01/Aula08.py | fabiosabariego/curso-python | 0 | 27976 | <gh_stars>0
# ------------------------------- UTILIZANDO MODULOS - AULA 08 -------------------------------
# BIBLIOTECA MATH
#from math import sqrt
#num = int(input('Digite um Numero: '))
#raiz = sqrt(num)
#print('O Valor da raiz de {} é: {:.2f}'.format(num, raiz))
# BIBLIOTECA RANDOM
#import random
# num = ra... | 3.84375 | 4 |
tests/conftest.py | skarzi/drf-exception-dispatcher | 0 | 27977 | import os
import django
from django.conf import settings
def pytest_configure(config):
"""Configure Django."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
settings.configure()
django.setup()
| 1.640625 | 2 |
Python/p1.py | Nivedya-27/Autumn-of-Automation | 0 | 27978 | d=int(input("enter d"))
n=''
max=''
for i in range(d):
if i==0:
n=n+str(1)
else :
n=n+str(0)
max=max+str(9)
n=int(n)+1 #smallest odd no. with d digits if d>1 or 2 if d==1
max=int(max) #largest no. with d digits
def check_prime(m_odd): #returns truth value of an odd no. or of 2 being prime
if m_odd==2:return T... | 3.59375 | 4 |
cellxgene_schema_cli/scripts/ontology_processing.py | chanzuckerberg/single-cell-curation | 8 | 27979 | import owlready2
import yaml
import urllib.request
import os
import gzip
import json
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../cellxgene_schema"))
import env
from typing import List
import os
def _download_owls(
owl_info_yml: str = env.OWL_INFO_YAML, output_dir: str ... | 2.71875 | 3 |
backoffice/web/companies/serializers.py | uktrade/trade-access-program | 1 | 27980 | <gh_stars>1-10
from rest_framework import serializers
from web.companies.models import Company, DnbGetCompanyResponse
class DnbGetCompanyResponseSerializer(serializers.ModelSerializer):
class Meta:
model = DnbGetCompanyResponse
fields = ['id', 'company', 'dnb_data', 'registration_number', 'compa... | 2.3125 | 2 |
src/4/lr_got.py | marmor97/cds-language-exam | 0 | 27981 | # importing modules and packages
# system tools
import os
import sys
import argparse
sys.path.append(os.path.join("..", ".."))
from contextlib import redirect_stdout
# pandas, numpy, gensim
import pandas as pd
import numpy as np
import gensim.downloader
# import my classifier utility functions - see the Github repo!
... | 3.03125 | 3 |
fight_tracker/arithmetic.py | jm-begon/fight_tracker | 0 | 27982 | <filename>fight_tracker/arithmetic.py
class Boolable:
def __bool__(self):
return False
class DescriptiveTrue(Boolable):
def __init__(self, description):
self.description = description
def __bool__(self):
return True
def __str__(self):
return f"{self.description}"
... | 3.484375 | 3 |
isoprene_pumpjack/helpers/services.py | tommilligan/isoprene-pumpjack | 0 | 27983 | #!/usr/bin/env python
'''
Central execution points for non-python services
'''
import logging
from neo4j.v1 import GraphDatabase, basic_auth
import neo4j.bolt.connection
import elasticsearch.exceptions
from isoprene_pumpjack.constants.environment import environment
from isoprene_pumpjack.utils.neo_to_d3 import neo_... | 2.15625 | 2 |
test/inprogress/test_ee2_api/test_EE2API.py | eapearson/kbase-skd-module-job-browser-bff | 0 | 27984 | <reponame>eapearson/kbase-skd-module-job-browser-bff
# -*- coding: utf-8 -*-
from JobBrowserBFF.TestBase import TestBase
from JobBrowserBFF.model.EE2Api import EE2Api
from JobBrowserBFF.schemas.Schema import Schema
ENV = 'ci'
USER_CLASS = 'user'
UPSTREAM_SERVICE = 'ee2'
JOB_ID_HAPPY = '5e8285adefac56a4b4bc2b14'
JOB_ID... | 1.867188 | 2 |
ldeep/views/activedirectory.py | podjackel/ldeep | 41 | 27985 |
from ldap3 import ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES
from ldap3.protocol.formatters.validators import validate_sid, validate_guid
ALL_ATTRIBUTES = ALL_ATTRIBUTES
ALL_OPERATIONAL_ATTRIBUTES = ALL_OPERATIONAL_ATTRIBUTES
ALL = [ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES]
validate_sid = validate_sid
validate_guid... | 2.484375 | 2 |
sdk/python/pulumi_azure_native/automation/v20200113preview/__init__.py | sebtelko/pulumi-azure-native | 0 | 27986 | <filename>sdk/python/pulumi_azure_native/automation/v20200113preview/__init__.py<gh_stars>0
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from ... import _utilities
import typing
# Export this pack... | 1.273438 | 1 |
project_name/urls.py | rafael-rpa/django-auth-extension-boilerplate | 1 | 27987 | <gh_stars>1-10
from __future__ import unicode_literals
from django.conf.urls import include, url
from django.contrib import admin
from auth_extension import views as auth_views
from django.contrib.auth.views import login, logout, password_reset, password_reset_done, password_reset_confirm, password_reset_complete
from... | 1.796875 | 2 |
test_day01.py | clfs/aoc2019 | 0 | 27988 | <filename>test_day01.py
def fuel_required(weight: int) -> int:
return weight // 3 - 2
def fuel_required_accurate(weight: int) -> int:
fuel = 0
while weight > 0:
weight = max(0, weight // 3 - 2)
fuel += weight
return fuel
def test_fuel_required() -> None:
cases = [(12, 2), (14, 2)... | 3.65625 | 4 |
Easy/After 157/175.Modified Kaprekar Numbers.py | sherryx080/CPTango | 0 | 27989 | <filename>Easy/After 157/175.Modified Kaprekar Numbers.py
import sys
p = int(sys.stdin.readline())
q = int(sys.stdin.readline())
result = []
for i in range(p,q+1):
square = i * i
l_num = 0
temp = list(str(square))
#print(temp[:len(temp)//2])
#print(temp[len(temp)//2:])
if square > 10:
... | 3.171875 | 3 |
catalyst/dl/callbacks/metrics/__init__.py | TeAmP0is0N/catalyst | 1 | 27990 | # flake8: noqa
from catalyst.dl.callbacks.metrics.accuracy import (
AccuracyCallback,
MultiLabelAccuracyCallback,
)
from catalyst.dl.callbacks.metrics.auc import AUCCallback
from catalyst.dl.callbacks.metrics.cmc import CMCScoreCallback
from catalyst.dl.callbacks.metrics.dice import (
DiceCallback,
Mul... | 1.242188 | 1 |
login/migrations/0003_user_token.py | yuxiaoYX/xiaoshuo | 0 | 27991 | # Generated by Django 2.2.1 on 2019-07-28 08:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('login', '0002_auto_20190720_1846'),
]
operations = [
migrations.AddField(
model_name='user',
name='token',
... | 1.640625 | 2 |
usersystem/views.py | sergioruizdavila/asanni-backend | 8 | 27992 | from allauth.account.utils import setup_user_email, send_email_confirmation
from rest_framework.response import Response
from usersystem.serializers import UserSerializer, UserRegisterSerializer
from rest_framework.views import APIView
from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST, HTTP_201_CREATE... | 2.421875 | 2 |
splitgraph/commandline/image_creation.py | Trase/splitgraph | 1 | 27993 | <filename>splitgraph/commandline/image_creation.py<gh_stars>1-10
"""
sgr commands related to creating and checking out images
"""
import sys
from collections import defaultdict
import click
from splitgraph.commandline.common import ImageType, RepositoryType, JsonType, remote_switch_option
from splitgraph.config impor... | 2.28125 | 2 |
tests/libtests/geocoords/data/ConvertDataApp.py | jedbrown/spatialdata | 0 | 27994 | #!/usr/bin/env python
#
# ======================================================================
#
# <NAME>, U.S. Geological Survey
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copyright (c) 2010-2017 University of California, Davis
#
# See COPY... | 2.796875 | 3 |
index.py | FunctionX/validator_queries | 0 | 27995 | import subprocess
import json
import csv
from csv import DictWriter
import datetime
import pandas as pd
import Cmd
import Data
from Report import Report
import File
def main():
Data.val_earnings_w_sum_columns()
dataframe=Data.get_val_token_info()
dataframe.to_csv(File._generate_file_name("fxcored_s... | 2.5625 | 3 |
py/py_0067_maximum_path_sum_ii.py | lcsm29/project-euler | 0 | 27996 | # Solution of;
# Project Euler Problem 67: Maximum path sum II
# https://projecteuler.net/problem=67
#
# By starting at the top of the triangle below and moving to adjacent numbers
# on the row below, the maximum total from top to bottom is 23. 37 42 4 68 5 9
# 3That is, 3 + 7 + 4 + 9 = 23. Find the maximum total fr... | 3.265625 | 3 |
sistemas_lineares.py | lucaspompeun/metodos-matematicos-aplicados-nas-engenharias-via-sistemas-computacionais | 16 | 27997 | <reponame>lucaspompeun/metodos-matematicos-aplicados-nas-engenharias-via-sistemas-computacionais<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 27 18:19:25 2019
INSTITUTO FEDERAL DE EDUCAÇÃO, CIÊNCIA E TECNOLOGIA DO PÁRA - IFPA ANANINDEUA
@author:
Prof. Dr. <NAME>
Di... | 3.5625 | 4 |
observations/r/unemp_dur.py | hajime9652/observations | 199 | 27998 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def unemp_dur(path):
"""Unemployment Duration
Journal of Business Econ... | 2.8125 | 3 |
Exe22.py | flavioUENP/aula1 | 0 | 27999 | <reponame>flavioUENP/aula1<filename>Exe22.py
f=float(input("Digite a temperatura na escala Farenheit: "))
celsius=5/9*(f-32)
print("A temperatura",f,"ºF, Em Célsius é: ",celsius,"ºC") | 3.578125 | 4 |