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 |
|---|---|---|---|---|---|---|
mapping/sandbox/graphslam/graphslam_pipeline.py | sameeptandon/sail-car-log | 1 | 11900 | <reponame>sameeptandon/sail-car-log
import os
from os.path import join as pjoin
from subprocess import check_call
from ruffus import files, follows, pipeline_run, pipeline_printout, pipeline_printout_graph, jobs_limit
from graphslam_config import GRAPHSLAM_PATH,\
GRAPHSLAM_MATCH_DIR, GRAPHSLAM_OPT_POS_DIR, GRAP... | 2.0625 | 2 |
sandbox/wavelets.py | EtalumaSupport/LumaViewPro | 0 | 11901 | import numpy as np
import matplotlib.pyplot as plt
from astropy.convolution import RickerWavelet2DKernel
ricker_2d_kernel = RickerWavelet2DKernel(5)
plt.imshow(ricker_2d_kernel, interpolation='none', origin='lower')
plt.xlabel('x [pixels]')
plt.ylabel('y [pixels]')
plt.colorbar()
plt.show()
print(ricker_2d_kernel)
| 2.96875 | 3 |
tests/test_errors.py | raymundl/firepit | 0 | 11902 | <filename>tests/test_errors.py
import os
import pytest
from firepit.exceptions import IncompatibleType
from firepit.exceptions import InvalidAttr
from firepit.exceptions import InvalidStixPath
from firepit.exceptions import InvalidViewname
from firepit.exceptions import StixPatternError
from .helpers import tmp_stora... | 2.125 | 2 |
script/run_scribus.py | csneofreak/public-domain-season-songs | 14 | 11903 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import json
import os
import math
import scribus
import simplebin
import inspect
from collections import defaultdict
PWD = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
def pwd(path):
return os.path.join(PWD, path);
DATA_FILE = pwd... | 2.5 | 2 |
12-transformar_metro.py | tainagirotto/exercicios-py | 0 | 11904 | # Ler um número em metros e mostrar seu valor em cm e mm:
m = float(input('Digite o valor em metros: '))
dm = m * 10
cm = m * 100
mm = m * 1000
km = m/1000
hm = m/100
dam = m/10
print('O valor em cm é {}' .format(cm))
print('O valor em milímetros é {}' .format(mm))
print('O valor em dm é {}' .format(dm))
print('O val... | 4.1875 | 4 |
src/urls.py | chunky2808/Hire-Me | 0 | 11905 | <filename>src/urls.py<gh_stars>0
"""src URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$... | 2.5625 | 3 |
re_compare/re_compare.py | gchase/re-compare | 0 | 11906 | #!/usr/bin/env python3
import logging
import argparse
import traceback
import os
import sys
from analysis import Analysis
from collector import Collector
from config import DEBUG, DEFAULT_LOG_FILE_DIR
def is_dir(dirname):
if not os.path.isdir(dirname):
msg = "{0} is not a directory".format(dirname)
... | 2.4375 | 2 |
venv/Lib/site-packages/nipype/conftest.py | richung99/digitizePlots | 585 | 11907 | <gh_stars>100-1000
import os
import shutil
from tempfile import mkdtemp
import pytest
import numpy
import py.path as pp
NIPYPE_DATADIR = os.path.realpath(
os.path.join(os.path.dirname(__file__), "testing/data")
)
temp_folder = mkdtemp()
data_dir = os.path.join(temp_folder, "data")
shutil.copytree(NIPYPE_DATADIR, d... | 1.9375 | 2 |
tests/test_modules/test_ADPandABlocks/test_adpandablocks_blocks.py | aaron-parsons/pymalcolm | 0 | 11908 | <reponame>aaron-parsons/pymalcolm
from mock import Mock
from malcolm.testutil import ChildTestCase
from malcolm.modules.ADPandABlocks.blocks import pandablocks_runnable_block
class TestADPandABlocksBlocks(ChildTestCase):
def test_pandablocks_runnable_block(self):
self.create_child_block(
pand... | 2.421875 | 2 |
pymbolic/mapper/coefficient.py | sv2518/pymbolic | 0 | 11909 | <filename>pymbolic/mapper/coefficient.py
__copyright__ = "Copyright (C) 2013 <NAME>"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limita... | 1.976563 | 2 |
day_06/balancer.py | anglerud/advent_of_code_2017 | 3 | 11910 | #!/usr/bin/env python
# coding: utf-8
""" """
import typing as t
import attr
import click
@attr.s(frozen=True)
class Memory(object):
banks: t.Tuple[int, ...] = attr.ib()
def balance(self) -> 'Memory':
mem = list(self.banks)
num_banks = len(self.banks)
# Find the amount of blocks to ... | 3.625 | 4 |
python-while/exercise4.py | crobert7/Py-Basics | 0 | 11911 | word = input('Type a word: ')
while word != 'chupacabra':
word = input('Type a word: ')
if word == 'chupacabra':
print('You are out of the loop')
break | 4.1875 | 4 |
pw_build/selects.bzl | mspang/pigweed | 0 | 11912 | # Copyright 2021 The Pigweed Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 1.476563 | 1 |
subscriptions/models.py | emil-magnusson/py-on-api | 0 | 11913 | <gh_stars>0
# subscriptions/models.py
import uuid
from django.db import models
from accesses.models import Accesses, Services
class OperationalState(models.Model):
operationalState = models.CharField(primary_key=True, max_length=50)
def __str__(self):
return self.operationalState
class Subscription... | 2.0625 | 2 |
leboncrevard/job.py | mclbn/leboncrevard | 5 | 11914 | <reponame>mclbn/leboncrevard
import smtplib
import time
from email.mime.text import MIMEText
from leboncrevard import scrapper, config
class LbcJob:
def __init__(self, name, url, interval, recipients):
self.name = name
self.url = url
self.scrapper = scrapper.LbcScrapper(url)
self.... | 2.40625 | 2 |
tsl/data/datamodule/splitters.py | TorchSpatiotemporal/tsl | 4 | 11915 | <reponame>TorchSpatiotemporal/tsl<gh_stars>1-10
import functools
from copy import deepcopy
from datetime import datetime
from typing import Mapping, Callable, Union, Tuple, Optional
import numpy as np
from tsl.utils.python_utils import ensure_list
from ..spatiotemporal_dataset import SpatioTemporalDataset
from ..util... | 2.09375 | 2 |
demo.py | bringBackm/SSD | 0 | 11916 | import glob
import os
import torch
from PIL import Image
from tqdm import tqdm
from ssd.config import cfg
from ssd.data.datasets import COCODataset, VOCDataset
from ssd.modeling.predictor import Predictor
from ssd.modeling.vgg_ssd import build_ssd_model
import argparse
import numpy as np
from ssd.utils.viz import dra... | 2.34375 | 2 |
quiz/bot/storage/shelter.py | shubham-king/guess-the-melody | 4 | 11917 | <filename>quiz/bot/storage/shelter.py
from shelve import DbfilenameShelf, open
from typing import Type
from quiz.config import Config
from quiz.types import ContextManager, DictAccess
class Shelter(ContextManager, DictAccess):
"""Interface for bot shelter."""
def __init__(self, config: Type[Config]) -> None:... | 2.734375 | 3 |
src/applications/task310/apps.py | SergeyNazarovSam/SergeyPythonfirst | 2 | 11918 | <gh_stars>1-10
from django.apps import AppConfig
class Task310Config(AppConfig):
label = "task310"
name = f"applications.{label}"
| 1.382813 | 1 |
scripts/data_creation_v3.py | deepchecks/url_classification_dl | 3 | 11919 | <filename>scripts/data_creation_v3.py
import whois
from datetime import datetime, timezone
import math
import pandas as pd
import numpy as np
from pyquery import PyQuery
from requests import get
class UrlFeaturizer(object):
def __init__(self, url):
self.url = url
self.domain = url.split('//')[-1].s... | 2.765625 | 3 |
rgnn_at_scale/models/gat.py | sigeisler/robustness_of_gnns_at_scale | 11 | 11920 | from typing import Any, Dict, Tuple
import torch
from torch_geometric.nn import GATConv
from torch_sparse import SparseTensor, set_diag
from rgnn_at_scale.aggregation import ROBUST_MEANS
from rgnn_at_scale.models.gcn import GCN
class RGATConv(GATConv):
"""Extension of Pytorch Geometric's `GCNConv` to execute a... | 2.015625 | 2 |
code/renderer/randomize/material.py | jonathangranskog/shading-scene-representations | 21 | 11921 | <gh_stars>10-100
import numpy as np
import pyrr
import os
class Material():
def __init__(self, color=np.ones(3, dtype=np.float32), emission=np.zeros(3, dtype=np.float32), roughness=1.0, ior=15.0, id=0, texture=None, texture_frequency=np.array([1.0, 1.0])):
self.color = color
self.emission = emissio... | 2.546875 | 3 |
frappe/core/doctype/sms_settings/sms_settings.py | ektai/erp2Dodock | 0 | 11922 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, throw, msgprint
from frappe.utils import nowdate
from frappe.model.document import Documen... | 2.296875 | 2 |
blog/migrations/0041_auto_20190504_0855.py | akindele214/181hub_2 | 1 | 11923 | # Generated by Django 2.1.5 on 2019-05-04 07:55
import blog.formatChecker
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0040_auto_20190504_0840'),
]
operations = [
migrations.AlterField(
model_name='videos',
... | 1.679688 | 2 |
tardis/model/tests/test_csvy_model.py | Youssef15015/tardis | 0 | 11924 | <filename>tardis/model/tests/test_csvy_model.py
import numpy as np
import numpy.testing as npt
import tardis
import os
from astropy import units as u
from tardis.io.config_reader import Configuration
from tardis.model import Radial1DModel
import pytest
DATA_PATH = os.path.join(tardis.__path__[0],'model','tests','data'... | 2.140625 | 2 |
wepppy/taudem/topaz_emulator.py | hwbeeson/wepppy | 0 | 11925 | <gh_stars>0
from typing import List
import os
import json
from os.path import join as _join
from os.path import exists as _exists
import math
from osgeo import gdal, osr
import numpy as np
from scipy.ndimage import label
from subprocess import Popen, PIPE
from pprint import pprint
from wepppy.all_your_base.geo imp... | 1.984375 | 2 |
PyRSM/utils.py | chdahlqvist/RSMmap | 3 | 11926 | <reponame>chdahlqvist/RSMmap
"""
Set of functions used by the PyRSM class to compute detection maps and optimize the parameters
of the RSM algorithm and PSF-subtraction techniques via the auto-RSM and auto-S/N frameworks
"""
__author__ = '<NAME>'
from scipy.interpolate import Rbf
import pandas as pd
import numpy.linal... | 1.84375 | 2 |
src/custom_dataset.py | devJWSong/transformer-multiturn-dialogue-pytorch | 11 | 11927 | <reponame>devJWSong/transformer-multiturn-dialogue-pytorch
from torch.utils.data import Dataset
from tqdm import tqdm
import torch
import pickle
import json
class CustomDataset(Dataset):
def __init__(self, args, tokenizer, data_type):
assert data_type in ["train", "valid", "test"]
print(... | 2.375 | 2 |
research/codec/codec_example.py | FXTD-ODYSSEY/QBinder | 13 | 11928 | # -*- coding: future_fstrings -*-
import codecs
import pdb
import string
# NOTE https://stackoverflow.com/questions/38777818/how-do-i-properly-create-custom-text-codecs
# prepare map from numbers to letters
_encode_table = {str(number): bytes(letter) for number, letter in enumerate(string.ascii_lowercase)}
# prepar... | 3.421875 | 3 |
benchmark_python_lkml.py | Ladvien/rust_lookml_parser | 0 | 11929 | import lkml
from time import time_ns
from rich import print
FILE_PATH = "/Users/ladvien/rusty_looker/src/resources/test.lkml"
with open(FILE_PATH, "r") as f:
lookml = f.read()
startTime = time_ns() // 1_000_000
result = lkml.load(lookml)
print(result)
executionTime = (time_ns() // 1_000_000) - startTime
print('... | 2.46875 | 2 |
Linear_Regression.py | svdeepak99/TSA-Twitter_Sentiment_Analysis | 0 | 11930 | <filename>Linear_Regression.py
from keras.models import Sequential, load_model
from keras.layers import Dense
import csv
import numpy as np
import os
LOAD_MODEL = False
with open("Linear_Regression/Normalized_Attributes.csv", "r", newline='') as fp:
reader = csv.reader(fp)
headings = next(reader)
... | 2.890625 | 3 |
UserCode/bressler/multibubblescintillationcheck.py | cericdahl/SBCcode | 4 | 11931 | <filename>UserCode/bressler/multibubblescintillationcheck.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 2 19:33:02 2021
@author: bressler
"""
import SBCcode as sbc
import numpy as np
import pulse_integrator as pi
import gc
def check_multibub_scintillation(run, event, at0, PMTgain, PMTwind... | 2.21875 | 2 |
app/core/models.py | echosisdev/openmrs-disa-sync | 0 | 11932 | from django.db import models
from django.db.models.signals import pre_save, post_save
from core.utils.constants import Constants
from core.utils.data_convertion import DataConversion
class ExcelFile(models.Model):
file_name = models.FileField(upload_to='uploads')
date_created = models.DateTimeField(auto_now_... | 2.046875 | 2 |
ceibacli/job_schedulers/slurm.py | cffbots/ceiba-cli | 2 | 11933 | <gh_stars>1-10
"""Interface to the `SLURM job scheduler <https://slurm.schedmd.com/documentation.html>`_
.. autofunction:: create_slurm_script
"""
from pathlib import Path
from typing import Any, Dict, List
from ..utils import Options
def create_slurm_script(opts: Options, jobs: List[Dict[str, Any]], jobs_metadata... | 2.4375 | 2 |
thumbor/url.py | wking/thumbor | 0 | 11934 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com <EMAIL>
import re
from urllib import quote
class Url(object):
unsafe_or_hash = r'(?:(?... | 2.234375 | 2 |
Projects/herdimmunity/Person.py | Tech-at-DU/ACS-1111.1-Object-Oriented-Programming | 0 | 11935 | import random
from Virus import Virus
class Person:
''' The simulation will contain people who will make up a population.'''
def __init__(self, is_vaccinated, infection=None):
''' We start out with is_alive = True
All other values will be set by the simulation through the parameters when
... | 3.84375 | 4 |
Cursos/Alura/Python3_Avancando_na_orientacao_a_objetos/models_playlist3.py | ramonvaleriano/python- | 0 | 11936 | <reponame>ramonvaleriano/python-<filename>Cursos/Alura/Python3_Avancando_na_orientacao_a_objetos/models_playlist3.py
class Programa:
def __init__(self, nome, ano):
self._nome = nome.title()
self.ano = ano
self._likes = 0
@property
def likes(self):
return self._likes
def... | 3.765625 | 4 |
blackjack/game.py | cuiqui/blackjack | 0 | 11937 | import constants as c
from deck import Deck
from player import Human, RandomAI
class Game:
def __init__(self):
self.deck = None
self.players = None
self.scores = None
self.rounds_left = None
self.game_over = False
def new(self):
self.game_over = F... | 3.328125 | 3 |
numba/tests/__init__.py | mawanda-jun/numba | 1 | 11938 | <reponame>mawanda-jun/numba
from numba import unittest_support as unittest
import gc
from os.path import dirname, join
import multiprocessing
import sys
import time
import warnings
from unittest.suite import TestSuite
from numba.testing import load_testsuite
from numba.testing import ddt # for backward compatibility
... | 2.109375 | 2 |
src/clustar/fit.py | clustar/Clustar | 4 | 11939 | """
Clustar module for fitting-related methods.
This module is designed for the 'ClustarData' object. All listed methods take
an input parameter of a 'ClustarData' object and return a 'ClustarData' object
after processing the method. As a result, all changes are localized within the
'ClustarData' object.
Visit <https... | 2.65625 | 3 |
tests/wizard/namedwizardtests/urls.py | felixxm/django-formtools | 0 | 11940 | <filename>tests/wizard/namedwizardtests/urls.py
from django.conf.urls import url
from .forms import (
CookieContactWizard, Page1, Page2, Page3, Page4, SessionContactWizard,
)
def get_named_session_wizard():
return SessionContactWizard.as_view(
[('form1', Page1), ('form2', Page2), ('form3', Page3), ('... | 2.09375 | 2 |
setup.py | ajayp10/derive_event_pm4py | 0 | 11941 | <gh_stars>0
import pathlib
from setuptools import setup
CURRENT_PATH = pathlib.Path(__file__).parent
README = (CURRENT_PATH/"README.md").read_text()
setup(
name="derive_event_pm4py",
version="1.0.1",
description="It derives new events based on rules provided as inputs.",
long_description=README,
... | 1.453125 | 1 |
tests/service/ai/test_not_killing_itself_ai.py | jonashellmann/informaticup21-team-chillow | 3 | 11942 | import unittest
from datetime import datetime, timezone
from typing import List
from chillow.service.ai.not_killing_itself_ai import NotKillingItselfAI
from chillow.model.action import Action
from chillow.model.cell import Cell
from chillow.model.direction import Direction
from chillow.model.game import Game
from chil... | 3 | 3 |
setup.py | meisanggou/ldapuser | 0 | 11943 | <reponame>meisanggou/ldapuser
#! /usr/bin/env python
# coding: utf-8
# __author__ = 'meisanggou'
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sys
if sys.version_info <= (2, 7):
sys.stderr.write("ERROR: ldap-user requires Python Version 2.7 or above.\n")
... | 1.945313 | 2 |
tests/test_infection.py | chinapnr/covid-19-data | 3 | 11944 | import json
import pytest
@pytest.mark.usefixtures('client', 'headers')
class TestInfection:
def test_infection_region_tc01(self, client, headers):
# db has data BETWEEN 2020-03-22 2020-03-24
region = 'China'
payload = {
'region': region,
'start_date': '2020-03-22... | 2.3125 | 2 |
tests/test_util_owsutil.py | TimFranken/pydov | 0 | 11945 | """Module grouping tests for the pydov.util.owsutil module."""
import copy
import re
import pytest
from numpy.compat import unicode
from owslib.etree import etree
from owslib.fes import (
PropertyIsEqualTo,
FilterRequest,
)
from owslib.iso import MD_Metadata
from owslib.util import nspath_eval
from pydov.util... | 2.421875 | 2 |
manage.py | jessekl/twiliochallenge | 0 | 11946 | # -*- coding: utf-8 -*-
"""
manage
~~~~~~
Flask-Script Manager
"""
import os
from flask.ext.script import Manager
from flask.ext.migrate import MigrateCommand
from fbone import create_app
from fbone.extensions import db
from fbone.utils import PROJECT_PATH, MALE
from fbone.modules.user import User, ADMI... | 2.1875 | 2 |
llvmsqlite_util/benchmarking/micro/aggregate.py | KowalskiThomas/LLVMSQLite | 0 | 11947 | <reponame>KowalskiThomas/LLVMSQLite
import os
sql_files = [x for x in os.listdir(".") if x.endswith("sql")]
sql_files = list(sorted(sql_files, key = lambda x : int(x.split('.')[0])))
result = ""
for i, f in enumerate(sql_files):
i = i + 1
i = f.replace(".sql", "")
with open(f) as sql:
result += f"... | 2.46875 | 2 |
demos/crane/main.py | Starli8ht/KivyMD | 0 | 11948 | """
MDCrane demo
=============
.. seealso::
`Material Design spec,
Crane <https://material.io/design/material-studies/crane.html#>`
Crane is a travel app that helps users find and book travel, lodging, and
restaurant options that match their input preferences.
"""
import os
import sys
from pathlib i... | 2.28125 | 2 |
tasks/lgutil/graph_net.py | HimmelStein/lg-flask | 0 | 11949 | <gh_stars>0
# -*- coding: utf-8 -*-
from nltk.parse import DependencyGraph
from collections import defaultdict
import random
import sys
import copy
from json import dumps
from pprint import pprint
try:
from .lg_graph import LgGraph
except:
sys.path.append("/Users/tdong/git/lg-flask/tasks/lgutil")
from .lg_... | 2.09375 | 2 |
utils/transformations/char_level/char_dces_substitute.py | Yzx835/AISafety | 0 | 11950 | # !/usr/bin/env python
# coding=UTF-8
"""
@Author: <NAME>
@LastEditors: <NAME>
@Description:
@Date: 2021-09-24
@LastEditTime: 2022-04-17
源自OpenAttack的DCESSubstitute
"""
import random
from typing import NoReturn, List, Any, Optional
import numpy as np
from utils.transformations.base import CharSubstitute
from utils... | 2.59375 | 3 |
piptools/repositories/base.py | LaudateCorpus1/pip-tools | 2 | 11951 | <filename>piptools/repositories/base.py
import optparse
from abc import ABCMeta, abstractmethod
from contextlib import contextmanager
from typing import Iterator, Optional, Set
from pip._internal.index.package_finder import PackageFinder
from pip._internal.models.index import PyPI
from pip._internal.network.session im... | 2.109375 | 2 |
tfx/orchestration/portable/execution_publish_utils.py | johnPertoft/tfx | 0 | 11952 | # Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 1.695313 | 2 |
src/dctm/datasets.py | spotify-research/dctm | 11 | 11953 | <reponame>spotify-research/dctm<filename>src/dctm/datasets.py<gh_stars>10-100
#
# Copyright 2020 Spotify AB
# 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/license... | 2.5 | 2 |
torchreid/optim/sam.py | opencv/deep-person-reid | 1 | 11954 | # Copyright 2020 Google Research
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
'''
Imported from: https://github.com/google-research/sam
'''
import torch
class SAM(torch.optim.Optimizer):
def __init__(self, params, base_optimizer, rho... | 1.96875 | 2 |
src/konfiger_stream.py | konfiger/konfiger-python | 4 | 11955 | <reponame>konfiger/konfiger-python
"""
The MIT License
Copyright 2020 <NAME> <<EMAIL>>.
"""
import os.path
from .konfiger_util import type_of, is_string, is_char, is_bool, escape_string, un_escape_string
def file_stream(file_path, delimiter = '=', separator = '\n', err_tolerance = False):
return Konfiger... | 2.65625 | 3 |
matematik.py | Drummersbrother/math_for_school | 0 | 11956 | <filename>matematik.py
import math
import numpy as np
import collections
import scipy.stats as sst
import matplotlib.pyplot as plt
def plot(*args, **kwargs):
plt.plot(*args, **kwargs)
plt.show()
def linregshow(x, y, col: str="r"):
linregresult = sst.linregress(list(zip(x, y)))
plot(x, y, col, x, [(val... | 3.734375 | 4 |
docly/ioutils/__init__.py | autosoft-dev/docly | 29 | 11957 | import os
from pathlib import Path
import requests
import shutil
import sys
from distutils.version import LooseVersion
import time
from tqdm import tqdm
from docly.parser import parser as py_parser
from docly.tokenizers import tokenize_code_string
from docly import __version__
# from c2nl.objects import Code
UPDATE_... | 2.359375 | 2 |
java/version.bzl | symonk/selenium | 0 | 11958 | SE_VERSION = "4.2.1"
| 0.96875 | 1 |
scripts/preprocess_for_prediction.py | jmueller95/deepgrind | 0 | 11959 | <filename>scripts/preprocess_for_prediction.py
import pandas as pd
import utils
def check_msms_model_name(converter):
def wrapper(*args, **kwargs):
if kwargs['style'] not in ["pdeep", "prosit"]:
raise Exception("MSMS model must be 'pdeep' or 'prosit'")
converter(*args, **kwargs)
... | 2.578125 | 3 |
GettingStarted/gettingstarted.py | rohitp934/roadtoadatascientist | 0 | 11960 | #importing necessary modules
from sklearn.linear_model import Perceptron
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracy_score
import numpy as np
# Data and labels
Xtrain = [[182, 80, 34], [176, 70, 33], [161, 60, 28], [154, 55, 27], [166, 63, 30], [189, 90, 36], [175, 63, 28], ... | 3.203125 | 3 |
libs/optimizers.py | bxtkezhan/AILabs | 0 | 11961 | <gh_stars>0
import numpy as np
class SGD:
def __init__(self, lr=0.01, momentum=0.0, decay=0.0, nesterov=False,
maximum=None, minimum=None):
self.lr = lr
self.momentum = momentum
self.decay = decay
self.nesterov = nesterov
self.idx = None
self.maximu... | 2.296875 | 2 |
pennylane/transforms/qcut.py | therooler/pennylane | 0 | 11962 | # Copyright 2022 Xanadu Quantum Technologies 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
#
# Unless required by applicable law or a... | 1.914063 | 2 |
tools/SDKTool/src/ui/dialog/progress_bar_dialog.py | Passer-D/GameAISDK | 1,210 | 11963 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright... | 2.015625 | 2 |
9/main.py | misterwilliam/advent-of-code | 0 | 11964 | <gh_stars>0
import itertools
import unittest
data = """Faerun to Norrath = 129
Faerun to Tristram = 58
Faerun to AlphaCentauri = 13
Faerun to Arbre = 24
Faerun to Snowdin = 60
Faerun to Tambi = 71
Faerun to Straylight = 67
Norrath to Tristram = 142
Norrath to AlphaCentauri = 15
Norrath to Arbre = 135
Norrath to Snowdi... | 2.65625 | 3 |
100-Exercicios/ex039.py | thedennerdev/ExerciciosPython-Iniciante | 0 | 11965 | #Exercício Python 39: Faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com a sua idade, se ele ainda vai se alistar ao serviço militar, se é a hora exata de se alistar ou se já passou do tempo do alistamento. Seu programa também deverá mostrar o tempo que falta ou que passou do prazo.
imp... | 4.09375 | 4 |
fish_dashboard/scrapyd/scrapyd_service.py | SylvanasSun/FishFishJump | 60 | 11966 | <reponame>SylvanasSun/FishFishJump<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from fish_core.utils.common_utils import format_dict_to_str, get_current_date, list_to_str, str_to_list
from fish_dashboard.scrapyd.model import ScrapydStatusVO, JobListDO, JobStatus, JobPriority, ProjectListVO, SpiderListV... | 1.992188 | 2 |
apps/shared/storage.py | bensternthal/affiliates | 0 | 11967 | <filename>apps/shared/storage.py
import os
from tempfile import mkstemp
from django.conf import settings
from django.core.files import locks
from django.core.files.move import file_move_safe
from django.core.files.storage import FileSystemStorage
from django.utils.text import get_valid_filename
class OverwritingStora... | 2.375 | 2 |
bin/dupeFinder.py | kebman/dupe-finder-py | 1 | 11968 | <filename>bin/dupeFinder.py
#!/usr/bin/env python2
import os
import hashlib
import datetime
import sqlite3
from sqlite3 import Error
def sha256(fname):
"""Return sha256 hash from input file (fname).
:param fname:
:return: Sha256 hash digest in hexadecimal"""
hash_sha256 = hashlib.sha256()
with open(fname, "rb") a... | 3.328125 | 3 |
Python/factorialIterative.py | Ricardoengithub/Factorial | 0 | 11969 | def factorial(n):
fact = 1
for i in range(2,n+1):
fact*= i
return fact
def main():
n = int(input("Enter a number: "))
if n >= 0:
print(f"Factorial: {factorial(n)}")
else:
print(f"Choose another number")
if __name__ == "__main__":
main()
| 4.1875 | 4 |
code_old/sort.py | benwoo1110/A-List-of-Sorts-v2 | 6 | 11970 | ######################################
# Import and initialize the librarys #
#####################################
from code.pygame_objects import *
from code.algorithm.bubblesort import bubblesort
from code.algorithm.insertionsort import insertionsort
from code.algorithm.bogosort import bogosort
from code.algorithm.m... | 2.65625 | 3 |
catkin_ws/src/tutorials/scripts/number_sub.py | vipulkumbhar/AuE893Spring19_VipulKumbhar | 3 | 11971 | <gh_stars>1-10
#!/usr/bin/env python
import rospy
from std_msgs.msg import Int64
counter = 0
pub = None
def callback_number(msg):
global counter
counter += msg.data
new_msg = Int64()
new_msg.data = counter
pub.publish(new_msg)
rospy.loginfo(counter)
if __name__ == '__main__':
ro... | 2.265625 | 2 |
setup.py | eddo888/perdy | 0 | 11972 | #!/usr/bin/env python
import codecs
from os import path
from setuptools import setup
pwd = path.abspath(path.dirname(__file__))
with codecs.open(path.join(pwd, 'README.md'), 'r', encoding='utf8') as input:
long_description = input.read()
version='1.7'
setup(
name='Perdy',
version=version,
license='MIT',
... | 1.554688 | 2 |
utils/slack_send.py | IntelliGrape/pennypincher | 0 | 11973 | from tabulate import tabulate
from slack.errors import SlackApiError
import sys
import logging
import slack
class Slackalert:
"""To send cost report on slack."""
def __init__(self, channel=None, slack_token=None):
self.channel = channel
self.slack_token = slack_token
logging.basicConfi... | 3.265625 | 3 |
src/importer/importer.py | tiefenauer/ip7-python | 0 | 11974 | import logging
from abc import ABC, abstractmethod
from pony.orm import db_session, commit
log = logging.getLogger(__name__)
class Importer(ABC):
def __init__(self, TargetEntity):
self.TargetEntity = TargetEntity
@db_session
def truncate(self):
log.info('Truncating target tables...')
... | 2.578125 | 3 |
news/pybo/migrations/0006_auto_20211010_0322.py | Smashh712/nrib | 0 | 11975 | # Generated by Django 3.2.7 on 2021-10-09 18:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pybo', '0005_auto_20211010_0320'),
]
operations = [
migrations.AddField(
model_name='issue',
name='agree_representor... | 1.640625 | 2 |
anno_gen/modify_filesprocessed.py | KevinQian97/diva_toolbox | 0 | 11976 | import json
import os
def get_file_index(filesProcessed):
new_dict = {}
for f in filesProcessed:
new_dict[f]={"framerate": 30.0, "selected": {"0": 1, "9000": 0}}
return new_dict
ref = json.load(open("/home/lijun/downloads/kf1_meta/references/kf1_all.json","r"))
files = ref["filesProcessed"]
print... | 2.609375 | 3 |
monotone_bipartition/search.py | mvcisback/monotone-bipartition | 1 | 11977 | from enum import Enum, auto
import funcy as fn
import numpy as np
from monotone_bipartition import rectangles as mdtr
from monotone_bipartition import refine
EPS = 1e-4
class SearchResultType(Enum):
TRIVIALLY_FALSE = auto()
TRIVIALLY_TRUE = auto()
NON_TRIVIAL = auto()
def diagonal_convex_comb(r):
... | 2.671875 | 3 |
api/web/apps/auth/views.py | procool/itstructure | 0 | 11978 | from flask import url_for
from flaskcbv.view import View
from flaskcbv.conf import settings
from misc.mixins import HelperMixin
from misc.views import JSONView
class authView(JSONView):
def helper(self):
return """Authorizaion handler
Use "login" and "passwd" arguments by GET or POST to get ses... | 2.546875 | 3 |
tests/test_heart_forest.py | RainingComputers/pykitml | 34 | 11979 | <reponame>RainingComputers/pykitml
from pykitml.testing import pktest_graph, pktest_nograph
@pktest_graph
def test_heart_forest():
import os.path
import numpy as np
import pykitml as pk
from pykitml.datasets import heartdisease
# Download the dataset
if(not os.path.exists('heartdisease.p... | 2.953125 | 3 |
pdf_audit.py | marctjones/perception | 0 | 11980 | <filename>pdf_audit.py
from globals import Globals
import os
import subprocess
import datetime as dt
from urllib import \
request as request
# urlopen
from io import \
StringIO, BytesIO
import string
import requests
import re
import csv
import threading
import utils as utils
import time
import datetime as date... | 2.515625 | 3 |
morepath/tests/test_method_directive.py | DuncanBetts/morepath | 0 | 11981 | import morepath
from webtest import TestApp as Client
def test_implicit_function():
class app(morepath.App):
@morepath.dispatch_method()
def one(self):
return "Default one"
@morepath.dispatch_method()
def two(self):
return "Default two"
@app.path(path=... | 2.46875 | 2 |
edb/edgeql/tracer.py | hyperdrivetech/edgedb | 0 | 11982 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2015-present MagicStack Inc. and the EdgeDB authors.
#
# 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... | 1.867188 | 2 |
libraries/website/docs/snippets/envs/tree_to_list.py | justindujardin/mathy | 95 | 11983 | <reponame>justindujardin/mathy<gh_stars>10-100
from typing import List
from mathy_core import ExpressionParser, MathExpression
parser = ExpressionParser()
expression: MathExpression = parser.parse("4 + 2x")
nodes: List[MathExpression] = expression.to_list()
# len([4,+,2,*,x])
assert len(nodes) == 5
| 2.75 | 3 |
math/0x04-convolutions_and_pooling/test/2-main.py | cbarros7/holbertonschool-machine_learning | 1 | 11984 | #!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
convolve_grayscale_padding = __import__(
'2-convolve_grayscale_padding').convolve_grayscale_padding
if __name__ == '__main__':
dataset = np.load('../../supervised_learning/data/MNIST.npz')
images = dataset['X_train']
print(ima... | 3.359375 | 3 |
code.py | surojitnath/olympic-hero | 0 | 11985 | # --------------
#Importing header files
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Path of the file
data=pd.read_csv(path)
data.rename(columns={'Total':'Total_Medals'},inplace =True)
data.head(10)
#Code starts here
# --------------
try:
data['Better_Event'] = np.where(... | 3.453125 | 3 |
planes/kissSlope/kissSlopeWing2.py | alexpGH/blenderCadCamTools | 3 | 11986 | <gh_stars>1-10
import bpy
import math
import numpy as np
#=== add scripts dir to path
import sys
import os
#=== define path of scripts dir
libDir=bpy.path.abspath("//../../scripts/") # version1: relative to current file
#libDir="/where/you/placed/blenderCadCam/scripts/" #version 2: usa an absolute path
if not libDir... | 1.914063 | 2 |
saleor/order/migrations/0072_django_price_2.py | elwoodxblues/saleor | 19 | 11987 | # Generated by Django 2.2.4 on 2019-08-14 09:13
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("order", "0071_order_gift_cards")]
operations = [
migrations.RenameField(
model_name="order",
old... | 1.765625 | 2 |
miping/training/features.py | mclgoerg/MiningPersonalityInGerman | 1 | 11988 | <filename>miping/training/features.py
import numpy as np
from sklearn.preprocessing import FunctionTransformer
from sklearn.pipeline import Pipeline
from sklearn.pipeline import FeatureUnion
from sklearn.preprocessing import StandardScaler
from ..models.profile import Profile
from ..interfaces.helper import Helper
fr... | 2.84375 | 3 |
tests/unit/test_serializers.py | launchpadrecruits/placebo | 1 | 11989 | <reponame>launchpadrecruits/placebo
# Copyright (c) 2015 <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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 2.140625 | 2 |
Chapter11/web_03.py | vabyte/Modern-Python-Standard-Library-Cookbook | 84 | 11990 | <filename>Chapter11/web_03.py
import urllib.request
import urllib.parse
import json
def http_request(url, query=None, method=None, headers={}, data=None):
"""Perform an HTTP request and return the associated response."""
parts = vars(urllib.parse.urlparse(url))
if query:
parts['query'] = urllib.pa... | 3.609375 | 4 |
src/oci/dns/models/external_master.py | Manny27nyc/oci-python-sdk | 249 | 11991 | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 2.234375 | 2 |
cinder/tests/unit/backup/fake_service_with_verify.py | puremudassir/cinder | 0 | 11992 | <filename>cinder/tests/unit/backup/fake_service_with_verify.py<gh_stars>0
# Copyright (C) 2014 Deutsche Telekom AG
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License... | 2.125 | 2 |
src/fasttick.py | JevinJ/Bittrex-Notify | 12 | 11993 | <filename>src/fasttick.py
import config
import misc
def heartbeat():
"""
Processes data from Bittrex into a simpler dictionary,
calls the save function on it, deletes the oldest
saved dictionary(if it's out of lookback range), and finally
creates a list of the best coins to be used in tkinter list... | 3.171875 | 3 |
src/mlb_statsapi/model/api/game.py | power-edge/mlb_statsapi_etl | 0 | 11994 | <gh_stars>0
"""
created by nikos at 4/26/21
"""
import datetime
from ..base import MLBStatsAPIEndpointModel
from mlb_statsapi.utils.stats_api_object import configure_api
YMDTHMS = '%Y-%m-%dT%H:%M:%SZ'
YYYYMMDD_HHMMSS = '%Y%m%d_%H%M%S'
MMDDYYYY_HHMMSS = '%m%d%Y_%H%M%S'
class GameModel(MLBStatsAPIEndpointModel):
... | 2.0625 | 2 |
scripts/build_folding_map.py | tsieprawski/md4c | 475 | 11995 | #!/usr/bin/env python3
import os
import sys
import textwrap
self_path = os.path.dirname(os.path.realpath(__file__));
f = open(self_path + "/unicode/CaseFolding.txt", "r")
status_list = [ "C", "F" ]
folding_list = [ dict(), dict(), dict() ]
# Filter the foldings for "full" folding.
for line in f:
comment_off =... | 2.75 | 3 |
app/api/v1/models/user_model.py | munniomer/Send-IT-Api-v1 | 0 | 11996 | <gh_stars>0
users = []
class UserModel(object):
"""Class user models."""
def __init__(self):
self.db = users
def add_user(self, fname, lname, email, phone, password, confirm_password, city):
""" Method for saving user to the dictionary """
payload = {
"userId": len(se... | 3.609375 | 4 |
Codigo/pruebas/Jose_Gonzalez/Solucion_PruebaTipoPiso.py | JoaquinRodriguez2006/RoboCup_Junior_Material | 0 | 11997 | from controller import Robot
from controller import Motor
from controller import PositionSensor
from controller import Robot, DistanceSensor, GPS, Camera, Receiver, Emitter
import cv2
import numpy as np
import math
import time
robot = Robot()
timeStep = 32
tile_size = 0.12
speed = 6.28
media_baldoza = 0.06
estado = 1
... | 3 | 3 |
drip/migrations/0002_querysetrule_rule_type.py | RentFreeMedia/django-drip-campaigns | 46 | 11998 | # Generated by Django 3.0.7 on 2020-11-25 13:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('drip', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='querysetrule',
name='rule_type',
... | 1.71875 | 2 |
venv/lib/python3.6/site-packages/cligj/__init__.py | booklover98/A-_pathfinding | 0 | 11999 | <filename>venv/lib/python3.6/site-packages/cligj/__init__.py
# cligj
# Shared arguments and options.
import click
from .features import normalize_feature_inputs
# Arguments.
# Multiple input files.
files_in_arg = click.argument(
'files',
nargs=-1,
type=click.Path(resolve_path=True),
required=True,
... | 2.640625 | 3 |