id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
108514
# ====================================================================== # Disk Defragmenter # Advent of Code 2017 Day 14 -- <NAME> -- https://adventofcode.com # # Computer simulation by Dr. <NAME> III # ====================================================================== # ========================================...
StarcoderdataPython
1747130
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "LICENSE.txt" file acc...
StarcoderdataPython
3265423
import logging import math import os import numpy as np import torch from torch import nn from torch.autograd import Variable as Var from archive.genut import msk_list_to_mat from archive.genut import Trainer class LMTrainer(Trainer): def __init__(self, opt, model, data): super().__init__(opt, model, da...
StarcoderdataPython
3375167
import random MEMBER_SIZES = 3 with open("fp_profiling", "r") as fh: lines = [line.strip().split() for line in fh.readlines()] totals = {} lasts = {} for stamp, stage, token, module in lines: stamp = float(stamp) if token not in totals: totals[token] = (0, 0, 9999999999, 0, []) if stage == "S...
StarcoderdataPython
22832
# known contracts from protocol CONTRACTS = [ # NFT - Meteor Dust "<KEY>", # NFT - Eggs "<KEY>", # NFT - Dragons "<KEY>", # NFT - Loot "<KEY>", ] def handle(exporter, elem, txinfo, contract): print(f"Levana! {contract}") #print(elem)
StarcoderdataPython
3348392
import datetime import os import re from dateutil import tz import sqlalchemy as sa from sqlalchemy.engine.reflection import Inspector from alembic import autogenerate from alembic import command from alembic import util from alembic.environment import EnvironmentContext from alembic.operations import ops from alembi...
StarcoderdataPython
56213
<filename>assistance_arbitration/assistance_arbitrator/src/assistance_arbitrator/monitors/octomap_monitor.py #!/usr/bin/env python # Monitor the octomap and check if the threshold of clutter in the octomap is # too high. This is almost never likely to be the actual cause of issues from __future__ import print_function...
StarcoderdataPython
3203335
import uspider class MSUSpider(uspider.USpider): name = "msuspider" allowed_domains = ["msu.ru"] download_delay = 1 extract_text = "db" def __init__(self, **kwargs): super().__init__(**kwargs) self.start_urls.insert(0, "https://msu.ru")
StarcoderdataPython
3245861
class Vertex(object): def __init__(self, key): self.id = key self.connected_to = {} def add_neighbor(self, nbr, weight=0): self.connected_to[nbr] = weight def get_connections(self): return self.connected_to.keys() def get_id(self): return self.id def get_w...
StarcoderdataPython
3243993
<reponame>brunocroh/wifidog-auth-flask import os from auth import create_app app = create_app() if __name__ == '__main__': app.run(debug=app.config['DEBUG'], host=app.config['HOST'], port=int(app.config['PORT']))
StarcoderdataPython
1646031
<filename>traxee/flipkart/api/serializers.py from rest_framework import serializers from django.db.models.fields import EmailField from django.db.models.fields import PositiveIntegerField class SignUpSerializers(serializers.Serializer): email = serializers.EmailField() name = serializers.CharField() passwo...
StarcoderdataPython
1669009
<filename>deleteRows.py import os import csv def deleteKeys(folder, keys): for fil in os.listdir(folder): if os.path.splitext(fil)[1] == '.csv': with open(os.path.join(folder, fil)) as f: rows = [row for row in csv.reader(f)] origLength = len(rows) ...
StarcoderdataPython
1721254
""" Entradas contraseña-->int-->contraseña Salidas correcto-->str-->Acesso Permitido incorrecto-->str-->Senha Invalida """ #Caja negra while True: #Entrada contraseña=int(input()) #Caja negra if(contraseña==2002): #Salida print("Acesso Permitido") break else: ...
StarcoderdataPython
129040
<reponame>kozakusek/ipp-2020-testy from part1 import ( gamma_board, gamma_busy_fields, gamma_delete, gamma_free_fields, gamma_golden_move, gamma_golden_possible, gamma_move, gamma_new, ) """ scenario: test_random_actions uuid: 239604592 """ """ random actions, total chaos """ board = ga...
StarcoderdataPython
1785397
<reponame>izmirli/modern-python-projects-course from calculator import Calculator def test_calculator(): calc = Calculator() calc.add(10) calc.subtract(5) calc.multiply(5) assert str(calc) == "Calculator(25)" def test_calculator_initial_value(): calc = Calculator(10) assert str(calc) == ...
StarcoderdataPython
3361264
<reponame>elliotbrandwein/discord_options_chain_bot # # written by me, <NAME> # No rights are granted to anyone without the express written consent of me or the National Football League import datetime from collections import defaultdict import robin_stocks as r import keyring import getpass ########### THI...
StarcoderdataPython
176380
<gh_stars>1-10 import time,opt import RPi.GPIO as GPIO def DistanceMeasure(distance_limit=0.2,time_limit=1,time_delay=10): GPIO.setmode(GPIO.BCM) trig=27;GPIO.setup(trig,GPIO.OUT) echo=22;GPIO.setup(echo,GPIO.IN) count=0 while 39: GPIO.output(trig,1) time.sleep(0.00001) GPIO.output(trig,0) # wh...
StarcoderdataPython
3268342
class Group: def __init__(self, name: object, header: object, footer: object) -> object: self.name = name self.header = header self.footer = footer
StarcoderdataPython
1629067
<gh_stars>0 from Models import VehcleDriver from time import sleep from random import randint import random from faker import Faker import json from kafka import KafkaProducer def publish_message(producer_instance, topic_name, key, value): try: key_bytes = bytes(key, encoding='utf-8') value_bytes ...
StarcoderdataPython
3352135
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------------------...
StarcoderdataPython
3268430
<reponame>ved93/deliberate-practice-challenges<gh_stars>0 def binary_search(a,k): left, right = 0, len(a)-1 while left <= right: mid = (left + right) // 2 if a[mid] == k: return True elif a[mid] < k: left = mid +1 else: right = mid...
StarcoderdataPython
3383678
from hwt.hdl.constants import DIRECTION from hwt.interfaces.std import VectSignal, Signal from hwt.synthesizer.param import Param from hwtLib.amba.axi3Lite import Axi3Lite_addr, Axi3Lite, Axi3Lite_r, Axi3Lite_b,\ IP_Axi3Lite from hwtLib.amba.axi_intf_common import AxiMap, Axi_id, Axi_hs, Axi_strb from hwtLib.amba.a...
StarcoderdataPython
59131
from django.shortcuts import render, redirect from django.contrib.auth import login, authenticate, logout from .forms import UserLoginForm def home_view(request): context = {'name': 'Dave'} return render(request, 'home.html',context) def login_view(request): form = UserLoginForm(request.POST or None) ...
StarcoderdataPython
1628743
from PyPowerStore.utils import constants from PyPowerStore.tests.unit_tests.base_test import TestBase from PyPowerStore.utils.exception import PowerStoreException import mock class TestVolume(TestBase): def test_get_volumes(self): vol_list = self.provisioning.get_volumes() self.assertListEqual(v...
StarcoderdataPython
3273848
""" Methods for drawing from the sunspot latitude and radius distribution """ import numpy as np import astropy.units as u __all__ = ['draw_random_sunspot_latitudes', 'draw_random_sunspot_radii'] @u.quantity_input(theta=u.rad, phi=u.rad) def rtp_to_edge(radius, theta, phi, n_points=1000): """ Use the havers...
StarcoderdataPython
42957
<reponame>PublicMapping/districtbuilder-classic from __future__ import absolute_import, unicode_literals import os from celery import Celery from . import REDIS_URL os.environ.setdefault("DJANGO_SETTINGS_MODULE", "publicmapping.settings") # Configure Celery app to use Redis as both the results backend and the message...
StarcoderdataPython
116432
<reponame>Telefonica/clipspy from .rules_engines import RulesEngine import logging import os from typing import Text logger = logging.getLogger(__name__) class RulesEnginesStore(object): """ Base class for rules engine stores. """ def load_persistent_state(self, rules_engine: RulesEngine, id: Text...
StarcoderdataPython
44560
from openprocurement.tender.core.procedure.serializers.base import ListSerializer from openprocurement.tender.core.procedure.serializers.document import ConfidentialDocumentSerializer from openprocurement.tender.core.procedure.serializers.parameter import ParameterSerializer from openprocurement.tender.esco.procedure.s...
StarcoderdataPython
195178
from enum import Enum class MerossEventType(Enum): # Fired when the MQTT client connects/disconnects to the MQTT broker CLIENT_CONNECTION = 10 DEVICE_ONLINE_STATUS = 100 DEVICE_BIND = 200 DEVICE_UNBIND = 201 DEVICE_SWITCH_STATUS = 1000 DEVICE_BULB_SWITCH_STATE = 2000 DEVICE_BULB_STATE ...
StarcoderdataPython
3390950
from researchutils.chainer.functions import average_k_step_squared_error from chainer.link import Chain from chainer import reporter import chainer import chainer.functions as F class FFPredictionEvaluator(Chain): def __init__(self, predictor, loss_fun=average_k_step_squared_error, k_step=1): super(FFPred...
StarcoderdataPython
1662830
<reponame>preranaandure/wildlifecompliance # -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2019-12-24 05:49 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('wildlifecompliance', '0357_auto_20191224_1345'), ] ...
StarcoderdataPython
3256480
<gh_stars>100-1000 # -*- 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 drughiv(path): """data from Exercise 7.6, p222 ...
StarcoderdataPython
1641993
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: self.ans = 0 def depth(p): if not ...
StarcoderdataPython
1780176
<filename>esphome/components/modbus_controller/__init__.py import binascii import esphome.codegen as cg import esphome.config_validation as cv from esphome.components import modbus from esphome.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_LAMBDA, CONF_OFFSET from esphome.cpp_helpers import logging from .const im...
StarcoderdataPython
156024
# -*- coding: UTF8 -*- from pupylib.PupyModule import * from pupylib.PupyCompleter import * from rpyc.utils.classic import download import os import os.path import time __class_name__="DownloaderScript" @config(category="manage") class DownloaderScript(PupyModule): """ download a file/directory from a remote syst...
StarcoderdataPython
3345773
# -*- coding: utf-8 -*- from Particion import Particion from Particionado import Particionado from src.Instances import Instances import random class DivisionPorcentual(Particionado): """docstring for DivisionPorcentual""" def __init__(self): super(DivisionPorcentual, self).__init__() self.porcentaje = 0.0 ...
StarcoderdataPython
3287536
<reponame>pesh1983/exercises """Implementations calculation of Fibonacci numbers.""" def fib1(amount): """ Calculate Fibonacci numbers. The second variable is used to store the result. :param amount: Amount of numbers to produce. :return: Generator. >>> list(fib1(0)) [] >>> list(fib1...
StarcoderdataPython
64301
"""This module contains the general information for AaaTacacsPlusEpFsmStage ManagedObject.""" from ...ucscmo import ManagedObject from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta from ...ucscmeta import VersionMeta class AaaTacacsPlusEpFsmStageConsts(): LAST_UPDATE_TIME_ = "" NAME_NOP = "nop" ...
StarcoderdataPython
3379931
from yaml import safe_load from handler import Context, Arguments, CommandResult from rpg.items.item import Item async def run(ctx: Context, args: Arguments) -> CommandResult: item = args[0] items_data = Item._read_objects_from_file(item.__class__) item_data = items_data.get(item.id) if item_data i...
StarcoderdataPython
3319600
<gh_stars>0 # -*- coding: utf-8 -*- print('Olá Python!') # Resposta do desafio: salario = 3450.45 despesas = 2456.2 percentaul_comprometido = despesas / salario * 100 print(percentaul_comprometido) # Desafio: Operadores Lógicos trabalho_terca = True trabalho_quinta = True ''' - Confirmando os 2: TV 50" + Sorvete - ...
StarcoderdataPython
3371481
""" Defines the model used for generating index and compression @<NAME> """ import time import numpy as np from eva_storage.models.sdae_wrapper import SDAE_wrapper from logger import Logger, LoggingLevel import torch import torch.utils.data import argparse parser = argparse.ArgumentParser(description='Define argum...
StarcoderdataPython
3407
"""Collection of tests.""" import pytest import dblib.lib f0 = dblib.lib.Finding('CD spook', 'my_PC', 'The CD drive is missing.') f1 = dblib.lib.Finding('Unplugged', 'my_PC', 'The power cord is unplugged.') f2 = dblib.lib.Finding('Monitor switched off', 'my_PC', 'The monitor is switched off.') def test_add_remove(...
StarcoderdataPython
85929
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 18}) def cut_by_item(dataframe, key, step): item_range = np.arange(0, dataframe[key].max(), step) grouped = dataframe.groupby(pd.cut(dataframe[key], item_ra...
StarcoderdataPython
4820254
"""RAK811 CLI interface. Provides a command line interface for the RAK811 module (Firmware V3.0). Copyright 2021 <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/l...
StarcoderdataPython
4818930
<reponame>malteos/explirefit from __future__ import division import codecs from os import listdir from os.path import isfile, join import pickle import numpy as np from helpers import data_helper ###########################################################################################################################...
StarcoderdataPython
184698
<gh_stars>1-10 /usr/lib/python2.7/encodings/cp1258.py
StarcoderdataPython
1697461
import os PACKAGEDIR = os.path.abspath(os.path.dirname(__file__)) from .correct import * from .planetsystem import * from .transitfit import * from .utils import *
StarcoderdataPython
1521
<filename>image_aug.py # coding=UTF-8 # This Python file uses the following encoding: utf-8 import cv2 import numpy as np import xml.etree.cElementTree as ET from random import sample #default args: default_args = {'noise_prob': 0.1, 'gasuss_mean': 0, 'gasuss_var': 0.001, ...
StarcoderdataPython
61181
import numpy as np from scipy.stats import chi2 from tqdm import tqdm as tqdm from ...common import ( Gaussian, GaussianDensity, HypothesisReduction, normalize_log_weights, ) from ...configs import SensorModelConfig from ...measurement_models import MeasurementModel from ...motion_models import MotionM...
StarcoderdataPython
1714263
<reponame>gaocegege/treadmill """Runs the Treadmill application runner. """ import logging import os import click from treadmill import appenv from treadmill import runtime as app_runtime from treadmill.appcfg import abort as app_abort _LOGGER = logging.getLogger(__name__) def init(): """Top level command ha...
StarcoderdataPython
1690635
import networkx as nx import csv import pandas as pd import itertools import json import dedupe from itertools import combinations,product import sys import os import numpy as np from affinegap import normalizedAffineGapDistance import simplejson from tqdm import tqdm import tempfile from dedupe.clustering import clust...
StarcoderdataPython
1745746
<gh_stars>1-10 # ipop-project # Copyright 2016, University of Florida # # 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 limitation the rights # to use,...
StarcoderdataPython
1694138
<filename>utility/nginx_current_port_by_domain.py import re import sys configLocation = sys.argv[1] domain = sys.argv[2] def currentPort(): with open(configLocation) as nginxConf: for line in nginxConf.readlines(): if ("proxy_pass" in line) and (domain in line): match = re.se...
StarcoderdataPython
73034
<filename>wiki/admin.py<gh_stars>1-10 from django.contrib import admin from .models import WikiPage admin.site.register(WikiPage)
StarcoderdataPython
1613258
import time from lib import tasks import tests.test_recommender as rec def test_add(): res = tasks.add.delay(1, 2) success = False val = res.get(timeout=5) rec.test_race_filter() assert val == 3 if __name__ == "__main__": test_add()
StarcoderdataPython
1627073
<filename>newscollector/real_time_manager.py<gh_stars>0 # coding=utf-8 from time import sleep from threading import Thread from .newscollector_worker import search_index from .db_functions import add_source_if_missed def read_configs(fname): configs = __import__(fname) return configs.sources def index_che...
StarcoderdataPython
3247140
<filename>LunchBot/message.py __author__ = 'Simon' import email class Attachment(object): def __init__(self,msg_part): open(msg_part.get_filename(), 'wb').write(msg_part.get_payload(decode=True)) self.data = open(msg_part.get_filename(),'r').read() self.data_type = msg_part.get_content_ty...
StarcoderdataPython
3277532
from .request_method_routing import RequestMethodRouting from .create import Create from .update import Update from .delete import Delete from .read import Read class CRUDByMethod(RequestMethodRouting): def __init__(self, di): super().__init__(di) def method_handler_map(self): return { ...
StarcoderdataPython
1656672
<filename>tests/diffcalc/test_utils.py ### # Copyright 2008-2011 Diamond Light Source Ltd. # This file is part of Diffcalc. # # Diffcalc is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the ...
StarcoderdataPython
3347839
<filename>web/datasets/tests/management/commands/test_cityhall.py from datetime import datetime import pytest from django.utils.timezone import make_aware from web.datasets.management.commands._cityhall import save_bid @pytest.mark.django_db class TestSaveBid: def test_save_bid(self, mock_backup_file): i...
StarcoderdataPython
1796748
import colt def test_version() -> None: assert colt.__version__ == "0.7.3"
StarcoderdataPython
1710056
<reponame>An00bRektn/CTF #!/usr/bin/python3 from pwn import * from hashlib import sha256 BLOCK_SIZE = 32 def decrypt_block(block, secret): dec_block = b'' for i in range(BLOCK_SIZE): val = (block[i]-secret[i]) % 256 dec_block += bytes([val]) return dec_block r = remote('172.16.17.32',3085...
StarcoderdataPython
8217
<filename>09_multiprocessing/prime_validation/primes_factor_test.py<gh_stars>0 import math import time def check_prime(n): if n % 2 == 0: return False, 2 for i in range(3, int(math.sqrt(n)) + 1): if n % i == 0: return False, i return True, None if __name__ == "__main__": ...
StarcoderdataPython
1641186
"""Contains all schedules spreadsheet settings commands related to Tosurnament.""" from discord.ext import commands from bot.modules.tosurnament import module as tosurnament from common.api import spreadsheet class TosurnamentSchedulesSpreadsheetCog(tosurnament.TosurnamentBaseModule, name="schedules_spreadshe...
StarcoderdataPython
1720006
<gh_stars>0 #<NAME>, <NAME>, <NAME> #Lab 6 import random # generates a list of random integers # int -> list def rand_num(size): alist = [] for i in range(size): #integer random numbers between 10 and 70 n = random.randint(10,70) alist.append(n) return alist # generates a...
StarcoderdataPython
1740427
import sdp.scripts.load_nstx_exp_ref as nstx_exp import sdp.scripts.FWR2D_NSTX_139047_Postprocess as fwrpp import sdp.plasma.analysis as ana import matplotlib.pyplot as plt import pickle import numpy as np with open('/p/gkp/lshi/XGC1_NSTX_Case/FullF_XGC_ti191_output/ref_pos.pck','r') as f: ref_pos = pickle.load(f...
StarcoderdataPython
146416
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class PyPyspellchecker(PythonPackage): """Pure python spell checker based on work by <NA...
StarcoderdataPython
3238521
from setuptools import setup, find_packages requirements:list = [] with open("requirements.txt", "r") as file: requirements = file.readlines() setup( name="cclr", version="0.0.1B", author="<NAME>", author_email="<EMAIL>", packages=find_packages(), install_requires=requirements, entry_points={ "console_scrip...
StarcoderdataPython
3383174
from django.contrib import admin from .models import Passport # Register your models here. admin.site.register(Passport)
StarcoderdataPython
180912
from nslocapysation.classes.localized_string import LocalizedString class DynamicLocalizedString(LocalizedString): """ A subclass of LocalizedString, whose instances represent localized strings that are used with a dynamic key (i.e. some variable as key). Those are special because you need to chec...
StarcoderdataPython
4811493
<filename>sla_app/migrations/0010_remove_keyperformanceindicator_for_period.py # Generated by Django 2.1.3 on 2018-12-04 21:10 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('sla_app', '0009_merge_20181204_2108'), ] operations = [ migrations.Re...
StarcoderdataPython
3270781
<reponame>OsmosizBiz/tphysics #Imports from tphysics.shapes import * #Create a class to hold a verlet version of the circle class VerletCircle(Circle): #Define init for the circle def __init__(self, x, y, radius, xspeed, yspeed): #Crete our derivative shape super(VerletCircle, self).__init__(x, y, radius) ...
StarcoderdataPython
1708716
# # Software distrubuted under MIT License (MIT) # # Copyright (c) 2020 Flexpool # # 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 limitation the # ...
StarcoderdataPython
3253444
#!/usr/bin/env python __title__ = 'dockerlief' __version__ = '0.1.0' __author__ = '<NAME>' __author_email__ = '<EMAIL>' __license__ = 'Apache 2.0'
StarcoderdataPython
1654899
from helpers.base_viewset import BaseViewSet from .models import BaseAccount from .serializers import WholeAccountSerializer class AccountViewSet(BaseViewSet): queryset = BaseAccount.objects.all() serializer_class = WholeAccountSerializer
StarcoderdataPython
3224329
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from django.conf import settings from django.core.urlresolvers import reverse from django.contrib.auth.models import User from powerpages.models import Page from powerpages.sync import PageFileDumper from powerpages.admi...
StarcoderdataPython
3218126
<reponame>Strata-ai/Social-Distancing-Detector import numpy as np from PyQt5.QtCore import Qt, QThread, QTimer from PyQt5.QtGui import QPixmap, QFont, QImage, QCursor, QIntValidator from PyQt5.QtWidgets import QMainWindow, QWidget, QPushButton, QHBoxLayout, QApplication, QLabel, \ QDialog, ...
StarcoderdataPython
78670
from kivy.uix.screenmanager import Screen class HomeScreen(Screen): """ The Welcome Screen """ def __init__(self, BippyApp, **kwargs): super(HomeScreen, self).__init__(**kwargs) self.BippyApp = BippyApp return
StarcoderdataPython
3312718
<filename>turbo_stream/utils/request_handlers.py """ Request Handler Methods & Wrappers """ import logging import time from functools import wraps from random import random logging.basicConfig( format="%(asctime)s %(name)-12s %(levelname)-8s %(message)s", level=logging.INFO ) def request_handler(wait: float = 1,...
StarcoderdataPython
1737711
# Copyright 2022 The OFA-Sys Team. # All rights reserved. # This source code is licensed under the Apache 2.0 license # found in the LICENSE file in the root directory. import json import logging import math from dataclasses import dataclass, field from typing import Optional import torch from fairseq import metric...
StarcoderdataPython
1723076
<filename>PopUp.py from PyQt5.QtWidgets import QWidget, QMessageBox from PyQt5 import QtCore class PopUpWrapper(QWidget): def __init__(self, title, msg, more=None, yesMes=None, noMes=None, actionWhenYes=None, actionWhenNo=None, parent=None): super().__init__() self.width = 320...
StarcoderdataPython
61768
<filename>django/docs/ref/models/instances.txt.py XXXXXXXXXXXXXXXXXXXXXXXX XXXXX XXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXX XXXXXXXX XXXXXXXXX XXX XXXXXXX XX XXX XXXXXXXXX XXXX XX XXXXXX XX XXX XXXXXXXX XXXXXXXXX XX XXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXX XXXX...
StarcoderdataPython
63876
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- from pathlib import Path import warnings import covsirphy as cs def main(): warnings.simplefilter("error") # Create output directory in example directory code_path = Path(__file__) input_dir = code_path.parent.with_name("input") output_dir...
StarcoderdataPython
1750219
<reponame>harmsm/uhbd<gh_stars>0 """ UhbdErrorCheck.py A set of functions to check for errors in uhbd output. """ def checkOut(out,filename): """ Check for errors in uhbdaa and uhbdpr.out. """ lines = out.split("\n") # Check for fatal errors hash = [l[1:6] for l in lines] try: ...
StarcoderdataPython
3260736
<gh_stars>10-100 import re import shutil import tempfile from copy import deepcopy from itertools import permutations from pathlib import Path import wordninja from app.attack.hashcat_cmd import HashcatCmdStdout from app.domain import Rule, WordListDefault from app.logger import logger from app.utils import subproces...
StarcoderdataPython
3217643
# -*- coding: utf-8 -*- """ infermedica_api.webservice ~~~~~~~~~~~~~~~~~~~~~~~~~~ This module contains classes and function responsible for making API requests. """ import json import platform import warnings import requests from . import __version__, exceptions, models, API_CONFIG, DEFAULT_API_VERSION, DEFAULT_AP...
StarcoderdataPython
3236571
<reponame>ennsk/fort-pymdwizard #!/usr/bin/env python # -*- coding: utf8 -*- """ The MetadataWizard(pymdwizard) software was developed by the U.S. Geological Survey Fort Collins Science Center. See: https://github.com/usgs/fort-pymdwizard for current project source code See: https://usgs.github.io/fort-pymdwizard/ for ...
StarcoderdataPython
3295496
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ------------------------------------------------- @ Author : pengj @ date : 2019/10/14 9:27 @ IDE : PyCharm @ GitHub : https://github.com/JackyPJB @ Contact : <EMAIL> ---------------------------------...
StarcoderdataPython
187592
<filename>redback/get_data/fermi.py<gh_stars>1-10 class FermiDataGetter(object): def __init__(self) -> None: raise NotImplementedError()
StarcoderdataPython
4801464
import datetime import re from dataclasses import dataclass from datetime import timezone import pytz from dateutil.parser import parse NanosecPattern = re.compile(r".+\.(\d+).*") RequiredTimePattern = re.compile(r".*\d\d?[/:-]\d\d?.*") @dataclass class DateTimeWithNS: datetime: datetime.datetime nanosec: i...
StarcoderdataPython
1697514
import logging import os import typing from typing import Dict, Optional, Text, Union from rasa.core.domain import Domain if typing.TYPE_CHECKING: from rasa.core.interpreter import NaturalLanguageInterpreter logger = logging.getLogger(__name__) async def train( domain_file: Union[Domain, Text], stories...
StarcoderdataPython
1647460
import os import time import random import numpy as np import datasets # CHANGE THESE PATHS TO PATHS OF THE .mat DATASETS DESCRIBED IN THE PAPER mat_path_coil20 = os.path.expanduser("~/Documents/datasets/elm/coil20.mat") mat_path_g50c = os.path.expanduser("~/Documents/datasets/elm/g50c.mat") mat_path_uspst = os.path....
StarcoderdataPython
56812
from RestrictedPython import compile_restricted from RestrictedPython import Eval from RestrictedPython import Guards from RestrictedPython import safe_globals from RestrictedPython import utility_builtins from RestrictedPython.PrintCollector import PrintCollector from multiprocessing import Process from multipr...
StarcoderdataPython
112446
<reponame>minhpqn/pyvi<filename>pyvi/__init__.py __author__ = 'trungtv'
StarcoderdataPython
1764870
#! /usr/bin/env python from z_app import app if __name__ == "__main__": app.run(debug=True)
StarcoderdataPython
1640377
""" Cpp solution with explanation in details It's a very classical question. Ref: http://www.geeksforgeeks.org/partition-set-k-subsets-equal-sum/ class Solution { public: // Method returns true if nums can be partitioned into K subsets // with equal sum bool canPartitionKSubsets(vector<int>& nums, int K)...
StarcoderdataPython
11140
<gh_stars>1-10 # Given an integer n, count the total number of digit 1 appearing # in all non-negative integers less than or equal to n. # # For example: # Given n = 13, # Return 6, because digit 1 occurred in the following numbers: # 1, 10, 11, 12, 13. # class Solution: def countDigitOne(self, n): """ ...
StarcoderdataPython
73117
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding : utf-8 -*- # Author: <NAME> import json import argparse from humblecritic import goodreads as gr from humblecritic import __version__ def setup_parser(): parser = argparse.ArgumentParser( description='Get score for HumbleBundle bundles.') parser.add...
StarcoderdataPython
199059
<reponame>kmr0877/pyq<filename>src/pyq/tests/test_numpy.py from __future__ import absolute_import try: import numpy from numpy import ma except ImportError: numpy = ma = None import pytest import pyq from pyq import * from pyq import _PY3K, Q_VERSION from .test_k import K_INT_CODE, K_LONG_CODE SYM_NA = ...
StarcoderdataPython
55077
from pathlib import Path from boucanpy.core import logger from boucanpy.cli.base import BaseCommand from boucanpy.db.models import models class DbTruncate(BaseCommand): name = "db-truncate" aliases = ["truncate"] description = "truncate db" add_log_level = True add_debug = True @classmethod ...
StarcoderdataPython