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 |
|---|---|---|---|---|---|---|
sims-g2/pos-adv/code/plot-rn.py | ammarhakim/ammar-simjournal | 1 | 37700 | <filename>sims-g2/pos-adv/code/plot-rn.py
from pylab import *
cfl = 0.1
def getAlpha(r):
if r < 2.2:
return (1+r/3.0)*exp(2.0*r/3.0)
else:
return min(1/cfl, 6/(3-r))
def getDgAlpha(r):
return 1+r
def getRn(r):
al = getAlpha(r)
return (r-3*cfl*al+6*cfl)/(1-cfl*al)
r = lin... | 2.703125 | 3 |
datatube/test/coerce_dtypes_test.py | eerkela/archivetube | 0 | 37701 | from datetime import datetime, timedelta, timezone
import random
import unittest
import numpy as np
import pandas as pd
from pandas.testing import assert_frame_equal, assert_series_equal
import pytz
if __name__ == "__main__":
from pathlib import Path
import sys
sys.path.insert(0, str(Path(__file__).resolv... | 2.5625 | 3 |
app/settings/dev.py | Pixsel1/movie-warehouse | 0 | 37702 | <gh_stars>0
import logging
import os
import sentry_sdk # NOQA
from sentry_sdk.integrations.django import DjangoIntegration # NOQA
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.debug("loading settings dev.py")
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE... | 1.992188 | 2 |
hwtLib/examples/arithmetic/privateSignals.py | optical-o/hwtLib | 24 | 37703 | from hwt.synthesizer.unit import Unit
from hwt.interfaces.std import VectSignal
from hwt.hdl.types.struct import HStruct
from hwt.interfaces.utils import addClkRstn
class PrivateSignalsOfStructType(Unit):
def _declr(self):
addClkRstn(self)
self.a = VectSignal(8)
self.b = VectSignal(8)._m(... | 2.15625 | 2 |
reader/common/labels.py | nicolay-r/RuSentRel | 5 | 37704 | <reponame>nicolay-r/RuSentRel
class Label:
@staticmethod
def from_str(value):
for l in Label._get_supported_labels():
if l.to_str() == value:
return l
raise Exception("Label by value '{}' doesn't supported".format(value))
@staticmethod
def from_int(value):... | 3.203125 | 3 |
Examples/mouselight_api.py | maithamn/BrainRender | 0 | 37705 | <gh_stars>0
"""
This tutorial shows how to download and render neurons from the MouseLight project
using the MouseLightAPI class.
You can also download data manually from the neuronbrowser website and render them by
passing the downloaded files to `scene.add_neurons`.
"""
import brainrender
brainrende... | 3.015625 | 3 |
ponnobot/spiders/daraz_spider.py | ahmedshahriar/bd-ponno | 3 | 37706 | import json
import re
from urllib.parse import urljoin
import scrapy
from ponnobot.items import ProductItem
class DarazSpider(scrapy.Spider):
name = "daraz"
allowed_domains = ['daraz.com.bd']
BASE_URL = 'https://www.daraz.com.bd'
# HEADERS = {
# 'authority': 'my.daraz.com.bd',
# 'p... | 2.46875 | 2 |
runtest/__init__.py | thautwarm/gkdtex | 3 | 37707 | from gkdtex.wrap import parse
from gkdtex.interpreter import Interpreter, CBVFunction
from gkdtex.developer_utilities import *
import sys
src = r"""
\newcommand{\GKDCreateId}{\input{|"gkdmgr --op uuid --rt A"}}
\makeatletter
\newcommand*\GKDNewTemp[2]{
\@ifundefined{GKDTemp#1}{
\expandafter\newcommand\csname G... | 2.109375 | 2 |
netmiko/ciena/ciena_saos_ssh.py | mostau1/netmiko | 0 | 37708 | """Ciena SAOS support."""
from __future__ import print_function
from __future__ import unicode_literals
from netmiko.cisco_base_connection import CiscoSSHConnection
class CienaSaosSSH(CiscoSSHConnection):
"""Ciena SAOS support."""
def session_preparation(self):
self._test_channel_read()
self.s... | 1.84375 | 2 |
serve.py | rik/mesconseilscovid | 26 | 37709 | """
Start local development server
"""
import argparse
import logging
import shlex
import subprocess
import webbrowser
from contextlib import suppress
from http.server import HTTPServer, SimpleHTTPRequestHandler
from pathlib import Path
from ssl import wrap_socket
from tempfile import NamedTemporaryFile
from threading ... | 2.015625 | 2 |
scripts/review_weblog.py | akrherz/iemwebfarm | 0 | 37710 | <filename>scripts/review_weblog.py
"""Process what our weblog has.
Run every minute, sigh.
"""
import sys
import subprocess
import psycopg2
THRESHOLD = 30
def logic(counts, family):
"""Should we or should we not, that is the question."""
exe = "iptables" if family == 4 else "ip6tables"
for addr, hits i... | 2.796875 | 3 |
carmcmc/__init__.py | metegenez/WAVEPAL | 39 | 37711 | from _carmcmc import *
from carma_pack import CarmaModel, CarmaSample, Car1Sample, power_spectrum, carma_variance, \
carma_process, get_ar_roots
from samplers import MCMCSample
| 0.9375 | 1 |
events/tracon2022/urls.py | con2/kompassi | 13 | 37712 | from django.conf.urls import url
from .views import tracon2022_afterparty_participants_view, tracon2022_afterparty_summary_view
urlpatterns = [
url(
r'^events/(?P<event_slug>tracon2022)/labour/surveys/kaatoilmo/results.xlsx$',
tracon2022_afterparty_participants_view,
name='tracon2022_afte... | 1.429688 | 1 |
Adult_dataset/asd-screen.py | blessinvarkey/asd_screening | 1 | 37713 | <filename>Adult_dataset/asd-screen.py<gh_stars>1-10
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
import missingno
import seaborn as sns
import unittest
class ASDScreening:
#constructor
def __init__(self):
self.data = []
def read_file(self, dataset):
with op... | 2.859375 | 3 |
util.py | rwberendsen/aprilsnow | 0 | 37714 | from snowflake.connector import DictCursor, ProgrammingError
import logging
def run(conn, sql, params=None):
cur = conn.cursor()
try:
cur.execute(sql, params)
except ProgrammingError:
raise
finally:
cur.close()
def run_and_fetchall(conn, sql, params=None):
cur = conn.curs... | 2.484375 | 2 |
tests/database/test_projects.py | hueyyeng/AssetsBrowser | 7 | 37715 | <filename>tests/database/test_projects.py
from pytest import mark
import peewee as pw
from database.models import (
Asset,
Category,
Project,
)
from database.db import Database
class TestProjects:
def setup(self):
self.test_db = Database()
def test_create_project(self):
project_n... | 2.609375 | 3 |
dungeon_game.py | JoeSamyn/Dungeon_Game_Git | 1 | 37716 | <gh_stars>1-10
import random
import os
CELLS = [(0, 0), (1, 0), (2, 0), (3 , 0), (4, 0),
(0, 1), (1, 1), (2, 1), (3 , 1), (4, 1),
(0, 2), (1, 2), (2, 2), (3 , 2), (4, 2),
(0, 3), (1, 3), (2, 3), (3 , 3), (4, 3),
(0, 4), (1, 4), (2, 4), (3 , 4), (4, 4)
]
def print_map(player):
p... | 3.28125 | 3 |
tests/providers/test_credit_card.py | pablofm/faker | 2 | 37717 | import re
import unittest
from faker import Faker
from faker.providers.bank.ru_RU import Provider as RuBank
class TestCreditCardProvider(unittest.TestCase):
def setUp(self):
self.fake = Faker(locale='en_US')
Faker.seed(0)
self.provider = self.fake.provider('faker.providers.credit_card')
... | 2.671875 | 3 |
tools/benchmark/do_not_run_create_benchmark_data.py | dangervon/ironic | 0 | 37718 | <gh_stars>0
#
# 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, s... | 1.984375 | 2 |
sheet_names_xlrd.py | patkujawa-wf/excel-file-reverse-engineering | 2 | 37719 | <filename>sheet_names_xlrd.py
# coding=utf-8
"""
> time \ls -1 **/*.xlsx | python sheet_names_xlrd.py
> for fname in **/*.xlsx; do time echo $fname | python sheet_names_xlrd.py; done
❯ time echo 'xlsx/SOX Controls Testing Template.xlsx' | python sheet_names_xlrd.py
[u'Interim Testing', u'Year End Testing']
echo 'xlsx... | 2.375 | 2 |
public/logger.py | IcyCC/fly6to4 | 0 | 37720 | <reponame>IcyCC/fly6to4<filename>public/logger.py
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename='monk.log',
f... | 2.390625 | 2 |
GeneratedCode/LISTENER_3_from_1.py | Beaconproj/CrossCloudVNFSimulation | 1 | 37721 | #---- Python VM startup for LISTENERLISTENER_3_from_1 ---
import SSL_listener
incomingIP="localhost"
incomingPort=10031
incomingPrivateKeyFile="server.key"
incomingPublicKeyFile="server.crt"
outgoingIP="localhost"
outgoingPort=00000
outgoingPublicKeyFile="server.crt"
def startLISTENER_3_from_1():
incoming_ssl_Encryp... | 2.265625 | 2 |
downloader.py | Esshahn/cryptoticker | 0 | 37722 | <filename>downloader.py<gh_stars>0
import json
import sys
import requests
def download_latest_crypto_data(config):
url = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest"
parameters = {
"convert": config["currency"],
}
headers = {
"X-CMC_PRO_API_KEY": config["api_ke... | 3.328125 | 3 |
core/src/zeit/campus/browser/social.py | rickdg/vivi | 5 | 37723 | <gh_stars>1-10
# XXX 100% copy&paste from zeit.magazin.browser.social
import copy
import zeit.push.browser.form
import zeit.push.interfaces
class SocialBase(zeit.push.browser.form.SocialBase):
campus_fields = ('facebook_campus_text', 'facebook_campus_enabled')
social_fields = copy.copy(zeit.push.browser.for... | 1.84375 | 2 |
sample/helpers.py | jeffs2696/AnalyticalDuctModes | 0 | 37724 | <reponame>jeffs2696/AnalyticalDuctModes<filename>sample/helpers.py
import pychebfun
import numpy as np
from scipy import special as sp
def get_answer():
"""Get an answer."""
return True
def kradial(m,a,b):
""" Compute the bessel functions as well as the zero crossings
Inputs
------
m : int
... | 3 | 3 |
server_py_files/data/filestream.py | bopopescu/timing_system_software | 1 | 37725 | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 05 21:26:33 2014
@author: Nate
"""
import time, datetime, uuid, io, os
import xstatus_ready
import file_locations
import XTSM_Server_Objects
import pdb
import msgpack
import cStringIO
import zlib
import zipfile
import pprint
DEFAULT_CHUNKSIZE=100*1000*1000
class FileSt... | 2.1875 | 2 |
backend/portfolify/wsgi.py | JermyTan/Portfolify | 3 | 37726 | """
WSGI config for portfolify project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
import sys
from django.core.wsgi import get_wsgi_application
# only for dev/test
f... | 1.789063 | 2 |
Raspberry_Pi_Pico/7_segment_display/four_digit_display.py | jckantor/cbe61622 | 2 | 37727 | import tm1637
import machine
import utime
disp = tm1637.TM1637(clk=machine.Pin(3), dio=machine.Pin(2))
adc = machine.ADC(4)
def display_mv(timer):
global adc, disp
mv = 0
N = 50
for k in range(N):
mv += 3300*adc.read_u16()/65535/N
disp.number(int(mv))
machine.Timer(freq=2, mode=machine.T... | 2.6875 | 3 |
leetcode/climbingStairs.py | montukv/Coding-problem-solutions | 0 | 37728 | '''70. Climbing Stairs
Easy
3866
127
Add to List
Share
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
Note: Given n will be a positive integer.
Example 1:
Input: 2
Output: 2
... | 4.09375 | 4 |
server/run_server.py | juandisay/twisted-docker | 5 | 37729 | <gh_stars>1-10
from twisted.application import service, internet
from server import HTTPEchoFactory
import os
# default port in case of the env var not was properly set.
ECHO_SERVER_PORT = 8000
proxy_port = int(os.environ.get('ECHO_SERVER_PORT', ECHO_SERVER_PORT))
application = service.Application('TwistedD... | 2.109375 | 2 |
lesson-12/01/timestamp.py | minimum-hsu/tutorial-python | 0 | 37730 | <reponame>minimum-hsu/tutorial-python
from datetime import datetime
def parse_timestamp(t):
try:
return datetime.strptime(
t,
'%Y-%m-%dT%H:%M:%SZ'
).utctimetuple()
except:
pass
try:
return datetime.strptime(
t,
'%Y-%m-%dT%H:%... | 3.34375 | 3 |
futaba/journal/listener.py | Hoffs/futaba | 23 | 37731 | #
# journal/listener.py
#
# futaba - A Discord Mod bot for the Programming server
# Copyright (c) 2017-2020 <NAME>, <NAME>, jackylam5
#
# futaba is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it wil... | 2.546875 | 3 |
tests/test_db.py | haniffalab/adifa | 0 | 37732 | <reponame>haniffalab/adifa<filename>tests/test_db.py<gh_stars>0
from datetime import datetime
import sqlite3
import pytest
from adifa import models
#from adifa.db import get_db
def test_post_dataset(session):
post = models.Dataset(
filename='test.h5ad',
hash='1234',
title='test',
... | 2.140625 | 2 |
authors/apps/articles/views/article_favourite_view.py | AmosWels/ah-django | 0 | 37733 | from django.http import Http404
from django.core import exceptions
from rest_framework import status
from rest_framework.generics import RetrieveUpdateAPIView
from rest_framework.permissions import (
IsAuthenticatedOrReadOnly, IsAuthenticated
)
from rest_framework.response import Response
from rest_framework.vie... | 1.890625 | 2 |
apt-select.py | pombredanne/apt-select | 0 | 37734 | <filename>apt-select.py
#!/usr/bin/env python
from sys import exit, stderr, version_info
from os import getcwd, path
from subprocess import check_output
from arguments import get_args
from util_funcs import get_html, HTMLGetError
from mirrors import Mirrors
def not_ubuntu():
"""Notify of incompatibility"""
e... | 2.890625 | 3 |
tests/test_wms_utils.py | LiamOSullivan/datacube-ows | 0 | 37735 | <reponame>LiamOSullivan/datacube-ows
# This file is part of datacube-ows, part of the Open Data Cube project.
# See https://opendatacube.org for more information.
#
# Copyright (c) 2017-2021 OWS Contributors
# SPDX-License-Identifier: Apache-2.0
from unittest.mock import MagicMock
import pytest
import datacube_ows.wm... | 2.1875 | 2 |
hello.py | gwenzek/func_argparser | 9 | 37736 | <filename>hello.py
"""Say hello or goodbye to the user."""
import func_argparse
def hello(user: str, times: int = None):
"""Say hello.
Arguments:
user: name of the user
"""
print(f"Hello {user}" * (1 if times is None else times))
def bye(user: str, see_you: float = 1.0):
"""Say goodbye... | 3.578125 | 4 |
python/batchd/blenderclient.py | portnov/batchd | 5 | 37737 | try:
import bpy
from bpy.types import WindowManager, AddonPreferences
from bpy.props import StringProperty, EnumProperty
in_blender = True
except ImportError as e:
in_blender = False
if in_blender:
from batchd import client
batchd_client = None
batchd_queues = []
batchd_types = []
... | 1.992188 | 2 |
sample.py | uguratar/pyzico | 6 | 37738 | <filename>sample.py
# coding=utf-8
from iyzico import Iyzico
from iyzico_objects import IyzicoCard, IyzicoCustomer, \
IyzicoCardToken, IyzicoHTTPException, IyzicoValueException
if __name__ == '__main__':
my_card = IyzicoCard("4242424242424242", "10", "2015", "000",
"Python Test")
... | 2.515625 | 3 |
nbsite/gallery/thumbnailer.py | dipesh1432/nbsite | 15 | 37739 | from __future__ import unicode_literals
import os, sys, subprocess, ast
from nbconvert.preprocessors import Preprocessor
from holoviews.core import Dimensioned, Store
from holoviews.ipython.preprocessors import OptsMagicProcessor, OutputMagicProcessor
from holoviews.ipython.preprocessors import StripMagicsProcessor
fr... | 2.140625 | 2 |
apps/blog/resources.py | ride90/eve_features | 1 | 37740 | <filename>apps/blog/resources.py
RESOURCES = {
'posts': {
'schema': {
'title': {
'type': 'string',
'minlength': 3,
'maxlength': 30,
'required': True,
'unique': False
},
'body': {
... | 1.617188 | 2 |
tests/no_train_or_test/model.py | NehzUx/autodl | 25 | 37741 | # Copyright 2016 Google Inc. 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 ... | 2.75 | 3 |
vavs_project/fbdata/generic.py | valuesandvalue/valuesandvalue | 1 | 37742 | <gh_stars>1-10
# fbdata.generic
# FBDATA
from .models import (
FBAlbum,
FBEvent,
FBLink,
FBPhoto,
FBStatus,
FBVideo,
StreamPost
)
_FB_CLASSES = {
'album': FBAlbum,
'event': FBEvent,
'link': FBLink,
'photo': FBPhoto,
'status': FBStatus,
'video': FBVideo,
'post': ... | 2.171875 | 2 |
C5G2-3D/selfscatt.py | robfairh/npre555-cp03 | 0 | 37743 | <reponame>robfairh/npre555-cp03
import numpy as np
import os
from os import path
import shutil
'''
Cross-sections from Cavarec, 2014..
Materials:
- uo2 - U - UO2 Fuel
- mox3 - P1 - 4.3% MOX Fuel (outer)
- mox2 - P2 - 7.0% MOX Fuel
- mox1 - P3 - 8.7% MOX Fuel (inner)
- gtub - X - Guide Tube
- reflec - R - Reflector
- ... | 2.234375 | 2 |
pyeccodes/defs/grib2/dimensionType_table.py | ecmwf/pyeccodes | 7 | 37744 | <gh_stars>1-10
def load(h):
return ({'abbr': 'layer', 'code': 0, 'title': 'layer'},
{'abbr': 'missing', 'code': 255, 'title': 'missing'})
| 1.789063 | 2 |
tests/test_layers/test_2p5d/checks_2p5d/common.py | RichardoLuo/ColossalAI | 1,630 | 37745 | <gh_stars>1000+
import torch
TESSERACT_DIM = 2
TESSERACT_DEP = 2
BATCH_SIZE = 8
SEQ_LENGTH = 8
HIDDEN_SIZE = 8
NUM_CLASSES = 8
VOCAB_SIZE = 16
IMG_SIZE = 16
def check_equal(A, B):
assert torch.allclose(A, B, rtol=1e-5, atol=1e-2) | 1.976563 | 2 |
default_values.py | Omar-X/App_init | 1 | 37746 | import os
# getting path so you can run the script python3 App_init, python3 .
if os.getcwd()[-8:] != "App_init":
default_path = "App_init/"
print(default_path)
else:
default_path = ""
# reading all built in modules
default_modules = open(f"{default_path}default_modules.txt", "r").readlines()
for a, i in ... | 2.640625 | 3 |
city_scrapers/spiders/chi_ssa_21.py | Anphisa/city-scrapers | 0 | 37747 | <filename>city_scrapers/spiders/chi_ssa_21.py
# -*- coding: utf-8 -*-
import dateutil.parser
from city_scrapers.constants import COMMISSION
from city_scrapers.spider import Spider
class ChiSsa21Spider(Spider):
name = 'chi_ssa_21'
agency_name = 'Chicago Special Service Area #21 Lincoln Square Ravenswood'
... | 2.765625 | 3 |
misp/utils/visual_utils.py | zhoudaxia233/misp | 2 | 37748 | <reponame>zhoudaxia233/misp
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator, AutoMinorLocator
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
from typing import Dict, Tuple
from .utils import predict
__all__ = ['get_heatmap_tensor', 'detransf... | 2.390625 | 2 |
infrastructure/__main__.py | jacopotagliabue/paas-data-ingestion | 30 | 37749 | <reponame>jacopotagliabue/paas-data-ingestion
import pulumi
import pulumi_aws as aws
import pulumi_snowflake as snowflake
from my_snowflake_roles import MySnowflakeRoles
from my_snowflake_snowpipe import MySnowpipe
from my_lambda import MyLambda
PROJECT_NAME = pulumi.get_project()
STACK_NAME = pulumi.get_stack()
PRE... | 1.898438 | 2 |
tests/math/__init__.py | Ejjaffe/dit | 1 | 37750 | """
Tests for dit.math.
"""
| 0.992188 | 1 |
FATS/featureFunction.py | serdarozsoy/FATS | 0 | 37751 | <<<<<<< HEAD
import os,sys,time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import Base
=======
import os,sys,time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import Base
>>>>>>> e5e6c78995f79de751f6aa5e3ad47cb15bd3fffc
from FeatureFunctionLib import * | 1.476563 | 1 |
personal-work/assignment2/rPi/arduino_to_python_to_mySQL.py | crabman84/codeIoT | 0 | 37752 | import serial
import io
import MySQLdb
device = '/dev/ttyACM1'
#ser = serial.Serial('/dev/ttyACM1', 9600)
arduino = serial.Serial(device, 9600)
#dataTemp = arduino.readline()
temp = 5
motorPos = 50
hIndex = 4
i = 0
while(i<3):
dataIndicator = arduino.readline()
indicator = dataIndicator.decode().strip()
... | 2.671875 | 3 |
result_helpers/__init__.py | CFM-MSG/CMAN_pytorch | 0 | 37753 | <filename>result_helpers/__init__.py
from result_helpers.mem_one_class import MEMResultHelper | 1.328125 | 1 |
azure-event-hub-master/service/service.py | sesam-community/azure-eventhub-source | 0 | 37754 | <filename>azure-event-hub-master/service/service.py
import json
from flask import Flask, request, Response
from azure.eventhub import EventHubClient, Offset
from ast import literal_eval
import logging
import cherrypy
import os
from uamqp import types, errors
app = Flask(__name__)
logger = logging.getLogger('service')... | 2.203125 | 2 |
pollect/sources/HttpSource.py | ystradmann/pollect | 0 | 37755 | import time
from typing import Optional
from pollect.core import Helper
from pollect.core.ValueSet import ValueSet, Value
from pollect.sources.Source import Source
class HttpSource(Source):
status_code: Optional[int] = None
def __init__(self, config):
super().__init__(config)
self.url = conf... | 2.546875 | 3 |
ikologikapi/domain/AbstractIkologikCustomerObject.py | Ikologik/ikologik-api-python | 0 | 37756 | from ikologikapi.domain.AbstractIkologikObject import AbstractIkologikObject
class AbstractIkologikCustomerObject(AbstractIkologikObject):
def __init__(self, customer: str):
super().__init__()
self.customer = customer
| 2.25 | 2 |
2018/day04.py | jawang35/advent-of-code | 0 | 37757 | from datetime import datetime
from enum import Enum, auto
import re
guard_id_regex = re.compile(r'#\d+')
class Record():
def __init__(self, record_string):
self.timestamp = datetime.strptime(record_string[1:17], '%Y-%m-%d %H:%M')
guard_id = guard_id_regex.search(record_string)
self.guard_... | 3.09375 | 3 |
lib/symbioticpy/symbiotic/symbiotic.py | IMULMUL/symbiotic | 0 | 37758 | <reponame>IMULMUL/symbiotic
#!/usr/bin/python
import os
import sys
import re
from . transform import SymbioticCC
from . verifier import SymbioticVerifier
from . options import SymbioticOptions
from . utils import err, dbg, print_elapsed_time, restart_counting_time
from . utils.utils import print_stdout
from . utils.p... | 2.1875 | 2 |
main/python-sphinx-removed-in/template.py | RoastVeg/cports | 0 | 37759 | <reponame>RoastVeg/cports
pkgname = "python-sphinx-removed-in"
pkgver = "0.2.1"
pkgrel = 0
build_style = "python_module"
hostmakedepends = ["python-setuptools"]
checkdepends = ["python-sphinx"]
depends = ["python-sphinx"]
pkgdesc = "Sphinx extension for versionremoved and removed-in directives"
maintainer = "q66 <<EMAI... | 1.085938 | 1 |
portal/serializers.py | Radek198/Food-Co-op | 0 | 37760 | from rest_framework import serializers
class ProductSerializer(serializers.Serializer):
product = serializers.ListField(
child=serializers.CharField(max_length=200))
| 2.0625 | 2 |
graphgallery/gallery/linkpred/pyg/__init__.py | EdisonLeeeee/GraphGallery | 300 | 37761 | <gh_stars>100-1000
from .gae import GAE
from .vgae import VGAE
| 1.0625 | 1 |
SightingsTOcsv.py | kfiala/AviSysDataAccess | 1 | 37762 | # Export the contents of AviSys files SIGHTING.DAT and FNotes.DAT to CSV format
# Author: <NAME> <<EMAIL>>
# Version: 1.2 3 April 2021
import sys
import csv
import ctypes
# Input files
DATA_FILE = 'SIGHTING.DAT'
MASTER_FILE = 'MASTER.AVI'
PLACES_FILE = 'PLACES.AVI'
NOTE_INDEX = 'FNotes.IX'
NOTE_FILE = 'FNotes.DAT'
AS... | 2.1875 | 2 |
modele/Class.py | AntoineDelay/chess | 0 | 37763 |
class Case :
def __init__(self,x,y):
self.id = str(x)+','+str(y)
self.x = x
self.y = y
self.piece = None
def check_case(self):
"""renvoie la piece si la case est occupé,renvoie -1 sinon """
if(self.piece != None):
return self.piece
re... | 3.78125 | 4 |
bot/migrators/config_migrator.py | yukie-nobuharu/TTMediaBot | 0 | 37764 | <filename>bot/migrators/config_migrator.py
import sys
from bot.config import ConfigManager, config_data_type
def to_v1(config_data: config_data_type) -> config_data_type:
return update_version(config_data, 1)
migrate_functs = {1: to_v1}
def migrate(
config_manager: ConfigManager,
config_data: config_... | 2.4375 | 2 |
Dynamic Programming/416. Partition Equal Subset Sum/Python Solution/Solution.py | lionelsamrat10/LeetCode-Solutions | 9 | 37765 | <filename>Dynamic Programming/416. Partition Equal Subset Sum/Python Solution/Solution.py
class Solution:
def canPartition(self, nums: List[int]) -> bool:
dp, s = set([0]), sum(nums)
if s&1:
return False
for num in nums:
dp.update([v+num for v in dp if v+num <= s>>1])... | 3.078125 | 3 |
self_paced_ensemble/canonical_resampling/__init__.py | thulio/self-paced-ensemble | 203 | 37766 | """
--------------------------------------------------------------------------
The `self_paced_ensemble.canonical_resampling` module implement a
resampling-based classifier for imbalanced classification.
15 resampling algorithms are included:
'RUS', 'CNN', 'ENN', 'NCR', 'Tomek', 'ALLKNN', 'OSS',
'NM', 'CC', 'SMOTE', ... | 2.328125 | 2 |
omsdk/sdkps.py | DanielFroehlich/omsdk | 61 | 37767 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved.
# Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
#
# Licensed under the Apache License, Ver... | 2.03125 | 2 |
popita/location/serializers.py | gpiechnik2/popita | 0 | 37768 | from rest_framework import serializers
from djoser.serializers import UserSerializer
from math import cos, asin, sqrt, pi
from accounts.models import User
from .models import Localization
class UserInfoSerializer(UserSerializer):
class Meta:
model = User
exclude = ('email', 'password', 'is_superu... | 2.234375 | 2 |
python/ql/test/query-tests/Security/CWE-089/sql_injection.py | p-snft/ql | 3 | 37769 | <reponame>p-snft/ql
from django.conf.urls import patterns, url
from django.db import connection, models
from django.db.models.expressions import RawSQL
class Name(models.Model):
pass
def save_name(request):
if request.method == 'POST':
name = request.POST.get('name')
curs = connection.cursor... | 2.671875 | 3 |
qdev_wrappers/transmon/sweep_helpers.py | GateBuilder/qdev-wrappers | 13 | 37770 | import qcodes as qc
from qdev_wrappers.sweep_functions import _do_measurement, _do_measurement_single, \
_select_plottables
def measure(meas_param, do_plots=True):
"""
Function which measures the specified parameter and optionally
plots the results.
Args:
meas_param: parameter to measure
... | 2.828125 | 3 |
ocrj/misc/nihongo.py | eggplants/OCR_Japanease | 2 | 37771 | import string
hiragana = \
['あ', 'い', 'う', 'え', 'お', 'か', 'き', 'く', 'け', 'こ', 'さ', 'し', 'す', 'せ', 'そ',
'た', 'ち', 'つ', 'て', 'と', 'な', 'に', 'ぬ', 'ね', 'の', 'は', 'ひ', 'ふ', 'へ', 'ほ',
'ま', 'み', 'む', 'め', 'も', 'ら', 'り', 'る', 'れ', 'ろ', 'が', 'ぎ', 'ぐ', 'げ', 'ご',
'ざ', 'じ', 'ず', 'ぜ', 'ぞ', 'だ', 'ぢ', 'づ', 'で', 'ど... | 2.234375 | 2 |
emlearn/distance.py | Brax94/emlearn | 161 | 37772 |
import os.path
import os
import numpy
from . import common, cgen
"""
References
https://github.com/scikit-learn/scikit-learn/blob/15a949460dbf19e5e196b8ef48f9712b72a3b3c3/sklearn/covariance/_empirical_covariance.py#L297
https://github.com/scikit-learn/scikit-learn/blob/15a949460dbf19e5e196b8ef48f9712b72a3b3c3/skl... | 2.265625 | 2 |
scripts/dbload_profiles.py | tonykipkemboi/LinkedIn_NSBE_Hackathon | 0 | 37773 | from db_connection import DbConnection
import random
def load():
db_conn = DbConnection('profiles')
db_conn.execute("drop table if exists profiles")
db_conn.execute("create table profiles (id integer PRIMARY KEY, name text not null, skillset text not null, connection_weight integer not null)")
names_for_prof... | 3.015625 | 3 |
application.py | iamsashank09/handwritten-digit-recognizer-cnn | 0 | 37774 | <filename>application.py
import sys
from keras.models import load_model
import cv2
from preprocessors import x_cord_contour, makeSquare, resize_to_pixel
import pyfiglet
class findHandwrittenDigits:
def __init__(self, imageFileName):
self.classifier = load_model('mnistHandModel.h5')
self.... | 2.875 | 3 |
Packs/ShiftLeft/Integrations/shiftleft/shiftleft_test.py | diCagri/content | 799 | 37775 | <filename>Packs/ShiftLeft/Integrations/shiftleft/shiftleft_test.py
"""Base Integration for ShiftLeft CORE - Cortex XSOAR Extension
"""
import json
import io
from shiftleft import list_app_findings_command, ShiftLeftClient
def util_load_json(path):
with io.open(path, mode="r", encoding="utf-8") as f:
retu... | 2.453125 | 2 |
app/auth/forms.py | karomag/microblog | 0 | 37776 | <filename>app/auth/forms.py
# -*- coding:utf-8 -*-
"""Forms auth."""
from flask_babel import _
from flask_babel import lazy_gettext as _l
from flask_wtf import FlaskForm
from wtforms import (
BooleanField,
PasswordField,
StringField,
SubmitField,
)
from wtforms.validators import (
DataRequired,
... | 3 | 3 |
rescale-video.py | abhra2020-smart/ba-title-bar | 0 | 37777 | import cv2
# used to scale down the video resolution
# the repo doesn't include vid 480x360 file,
# but you can get if from https://www.youtube.com/watch?v=FtutLA63Cp8
cap = cv2.VideoCapture('bad_apple_480x360.mp4')
fourcc = cv2.VideoWriter_fourcc(*'MP4V')
out = cv2.VideoWriter('bad_apple_48x36.mp4', four... | 2.90625 | 3 |
scripts/nabeatu.py | yuzukiimai/robosys2 | 0 | 37778 | #!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
n = 0
def cb(message):
global n
n = message.data
rospy.init_node('nabe')
sub = rospy.Subscriber('rand_number', Int32, cb)
pub = rospy.Publisher('atu', Int32, queue_size=1)
rate = rospy.Rate(1)
while not rospy.is_shutdown():
if n % 3 == 0... | 2.71875 | 3 |
competition/scenarios.py | xfuzzycomp/FuzzyChallenge2021 | 0 | 37779 | from fuzzy_asteroids.util import Scenario
import numpy as np
# "Simple" Scenarios --------------------------------------------------------------------------------------------------#
# Threat priority tests
threat_test_1 = Scenario(
name="threat_test_1",
asteroid_states=[{"position": (0, 300), "angle": -90.0, ... | 1.976563 | 2 |
guess_movie/quizz/models.py | tanguyesteoule/movizz | 1 | 37780 | from django.db import models
# class Game(models.Model):
# name = models.CharField(max_length=200)
#
# def __str__(self):
# return self.name
class Movie(models.Model):
imdb_id = models.CharField(max_length=200, null=True, blank=True)
name = models.CharField(max_length=200, null=True, blank=... | 2.34375 | 2 |
front_end/migrations/0002_rename_nome_popular_especies_nome_popular.py | majubr/website_Django | 0 | 37781 | # Generated by Django 4.0.3 on 2022-03-15 03:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('front_end', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='especies',
old_name='Nome_Po... | 1.671875 | 2 |
ronin_3d/source/ronin_lstm_tcn.py | zju3dv/rnin-vio | 10 | 37782 | import json
import os
import sys
import time
from os import path as osp
from pathlib import Path
from shutil import copyfile
import numpy as np
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils.data import DataLoader
from tqdm import tqdm
from model_temporal import LSTMSeqNetwork, B... | 1.960938 | 2 |
Leetcode/2001-3000/2046. Sort Linked List Already Sorted Using Absolute Values/2046.py | Next-Gen-UI/Code-Dynamics | 0 | 37783 | <reponame>Next-Gen-UI/Code-Dynamics<filename>Leetcode/2001-3000/2046. Sort Linked List Already Sorted Using Absolute Values/2046.py<gh_stars>0
class Solution:
def sortLinkedList(self, head: Optional[ListNode]) -> Optional[ListNode]:
prev = head
curr = head.next
while curr:
if curr.val < 0:
... | 3.3125 | 3 |
constants.py | pvantonov/kodi-amvnews | 3 | 37784 | # coding=utf-8
"""
Definition of constants.
"""
from xbmcswift2.plugin import Plugin
PLUGIN = Plugin()
| 1.109375 | 1 |
python/chaosencrypt/test/discrete_pisarchik.py | nfejes/chaotic-image-encryption | 3 | 37785 | from scipy.misc import imread,imshow
import chaosencrypt as cenc
import numpy as np
from chaosencrypt.discrete_pisarchik import bitexpand,bitreduce
# Read image
print('Loading image...')
im_org = imread('../image.jpg')
# Downsample
im = im_org[::3,::3,:].copy()
# Key
key = {'a':3.8,'n':10,'r':3,'bits':32}
# Encryp... | 2.53125 | 3 |
exercicios/Curso_Udemy_Python/sec3_aula66.py | IgoPereiraBarros/maratona-data-science-brasil | 0 | 37786 | lista = ['python', 'c', 'c++', 'ruby', 'php']
print(sorted(lista, key=len)) | 3.40625 | 3 |
src/fate_of_dice/system/call_of_cthulhu/__init__.py | bonczeq/FateOfDice | 0 | 37787 | <reponame>bonczeq/FateOfDice
from .skill_check import check_skill, SkillCheckResult, SkillCheckResultType
| 1.0625 | 1 |
setup.py | dvd7587/listthedocs | 3 | 37788 | <gh_stars>1-10
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='listthedocs',
version='2.0.1',
author='<NAME>',
author_email='<EMAIL>',
description='List your documentations',
long_description=long_description,
lon... | 1.414063 | 1 |
tests/test_table_aggregation/test_schema_matcher.py | afcarl/corvid | 1 | 37789 | <filename>tests/test_table_aggregation/test_schema_matcher.py<gh_stars>1-10
import unittest
from corvid.types.table import Token, Cell, Table
from corvid.table_aggregation.pairwise_mapping import PairwiseMapping
from corvid.table_aggregation.schema_matcher import SchemaMatcher, \
ColNameSchemaMatcher
class Schem... | 2.390625 | 2 |
jiggle_version/parse_version/parse_dunder_version.py | matthewdeanmartin/jiggle_version | 1 | 37790 | """
A whole file dedicated to parsing __version__ in all it's weird possible ways
1) Only acts on source, no file handling.
2) some functions for *by line*
3) some functions for *by file*
4) Handle quotes
5) Handle whitespace
6) Handle version as tuple
"""
import ast
import re
from typing import Any, Optional, T... | 3.390625 | 3 |
guppy/__init__.py | EhsanKia/guppy3 | 0 | 37791 | <reponame>EhsanKia/guppy3<filename>guppy/__init__.py
"""\
Top level package of Guppy, a library and programming environment
currently providing in particular the Heapy subsystem, which supports
object and heap memory sizing, profiling and debugging.
What is exported is the following:
hpy() Create an object that pro... | 2.421875 | 2 |
python/testData/quickFixes/PyRemoveUnusedLocalQuickFixTest/removeChainedAssignmentStatementFirstTarget_after.py | 06needhamt/intellij-community | 2 | 37792 | def f():
<caret>b = 0
return b | 1.421875 | 1 |
constrained_attack.py | ameya005/Semantic_Adversarial_Attacks | 9 | 37793 | <reponame>ameya005/Semantic_Adversarial_Attacks<filename>constrained_attack.py
"""
Attacking the model using a Fader Network
Note: We are basically searching for the interpolation values
which allow us to break a simple classifier.
"""
import argparse
import json
import logging
import os
from collections import Order... | 2.3125 | 2 |
Ejercicio5.py | mariagarciau/introduccion-algoritmica | 0 | 37794 | <gh_stars>0
def descuento(niños=int(input("Cuantos niños son "))):
if niños==2:
descuentoTotal=10
elif niños==3:
descuentoTotal=15
elif niños==4:
descuentoTotal=18
elif niños>=5:
descuentoTotal=18+(niños-4)*1
return print(descuentoTotal)
descuento()
| 3.578125 | 4 |
experiments/graph/data_loader.py | t3hseus/ariadne | 6 | 37795 | <filename>experiments/graph/data_loader.py
import logging
from torch import multiprocessing
from typing import Callable
import gin
from torch.utils.data import random_split, Subset, DataLoader
from ariadne.graph_net.dataset import GraphBatchBucketSampler
from ariadne_v2 import jit_cacher
from ariadne_v2.data_loader ... | 2.1875 | 2 |
murano-7.0.0/murano/policy/modify/actions/action_manager.py | scottwedge/OpenStack-Stein | 91 | 37796 | <reponame>scottwedge/OpenStack-Stein<filename>murano-7.0.0/murano/policy/modify/actions/action_manager.py<gh_stars>10-100
# Copyright (c) 2015 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the Lic... | 1.90625 | 2 |
wsgi_basic/common/wsgi.py | QthCN/wsgi-basic | 0 | 37797 | import copy
import itertools
import wsgiref.util
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import importutils
import routes.middleware
import six
import webob.dec
import webob.exc
from wsgi_basic import exception
from wsgi_basic.common import authori... | 2.234375 | 2 |
OLD/datasets/cityscapes/legacy/1_downscale_images.py | ivankreso/semseg | 2 | 37798 | <reponame>ivankreso/semseg<filename>OLD/datasets/cityscapes/legacy/1_downscale_images.py
import sys
sys.path.append('../..')
import os
import pickle
import numpy as np
import tensorflow as tf
#from pgmagick import Image
import skimage as ski
import skimage.data, skimage.transform
from tqdm import trange
from cityscape... | 1.695313 | 2 |
applications/init/modules/Paginater.py | himelpdas/Practice-Genie | 0 | 37799 | import math
from gluon import URL, SPAN
class Paginater():
"""
Adapted from http://web2py.com/books/default/chapter/29/14/other-recipes#Pagination
"""
item_limits = [6, 12, 25, 50, 100]
def __init__(self, request, query_set, db):
self._request = request
self._query_s... | 3.03125 | 3 |