id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
4869609 | import os
import conll
import sys
ud_version_uri = {
'v2.8': 'https://lindat.mff.cuni.cz/repository/xmlui/bitstream/handle/11234/1-3687/ud-treebanks-v2.8.tgz',
'v2.7': 'https://lindat.mff.cuni.cz/repository/xmlui/bitstream/handle/11234/1-3424/ud-treebanks-v2.7.tgz',
'v2.6': 'https://lindat.mff.cuni.cz/repo... | StarcoderdataPython |
8081861 | import docker
import logging
logger = logging.getLogger(__name__)
class DockerClientMixin(object):
"""A mixin class that gives subclasses access to a docker Client
object.
"""
@property
def docker_cli(self):
"""A docker Client object. Always returns the same one."""
if not hasatt... | StarcoderdataPython |
6689125 | <reponame>Jovamih/PythonProyectos
#/usr/bin/env python
import pandas as pd
import numpy as np
import numexpr
def rendimiento():
#la libreria numexpr proporciona eval() funcion que evalua literales de cadena a expresiones python logicas
data=pd.DataFrame(np.random.randint(12,200,size=(8,4)),columns=list('ABCD')... | StarcoderdataPython |
8175266 | #!/usr/bin/env python2.7
#-*- coding: utf-8 -*-
from copy import deepcopy
import shutil, os, sys
from envconfig import *
DST_DIR = './dst-files/'
def load_env_kv() : #return [prog_env, nodes_env]
prog = {
'QTUM_PREFIX' : QTUM_PREFIX,
'QTUM_BIN' : QTUM_BIN,
'CMD_QTUMD': CMD_QTUMD,
... | StarcoderdataPython |
5020412 | import inspect
from ..functions import CF
_VN = CF()
class DocstringRewriteMeta(type):
"""Modify docstrings at time of import.
**Methodology**
To do this, we intercede before the class is created and modify
the docstrings of the attributes defined on the class.
Inherited methods are also modi... | StarcoderdataPython |
6626252 | searched_book = input()
command = input()
book_count = 0
book_found = False
while command != "No More Books":
if command == searched_book:
book_found = True
break
book_count += 1
command = input()
if not book_found:
print("The book you search is not here!")
print(f"You checked {bo... | StarcoderdataPython |
4957842 | <filename>src/vidsortml/utilities/database_utilities.py
import pickle
import pprint
import os
import pathlib
DATABASES_ROOT_DIR = pathlib.Path(__file__).parents[1] / 'databases'
class database:
name: str = "Default"
data: dict
def __init__(self, name):
self.name = name
self.data = {}
... | StarcoderdataPython |
1779974 | from .iExecutor import iExecutor
class Printer(iExecutor):
def __init__(self, *parents, msg=""):
self.msg = msg
super().__init__(*parents)
def run(self, item):
if item is not None:
print(f"printer loaded, item {item}, message: {self.msg}", flush=True)
else:
... | StarcoderdataPython |
8054927 | <reponame>ResonantGeoData/ResonantGeoData<filename>django-rgd-imagery/rgd_imagery/tasks/jobs.py
from celery import shared_task
from rgd.tasks import helpers
@shared_task(time_limit=86400)
def task_load_image(file_pk):
from rgd_imagery.models import Image
from rgd_imagery.tasks.etl import load_image
image... | StarcoderdataPython |
6542996 | <reponame>jim-schwoebel/allie
'''
AAA lllllll lllllll iiii
A:::A l:::::l l:::::l i::::i
A:::::A l:::::l l:::::l iiii
A:::::::A l:::::l l:::::l ... | StarcoderdataPython |
3281703 | ### Subtract the Product and Sum of Digits of an Integer - Solution
class Solution:
def subtractProductAndSum(self, n: int) -> int:
total_sum, product = 0, 1
while (n > 0):
total_sum += n % 10
product *= n % 10
n //= 10
diff = product - total_sum
... | StarcoderdataPython |
5017015 | <filename>src/scripts/client-soappy.py
#!/usr/bin/env python
# Example SOAP client for the Mutalyzer web service in Python using the
# SOAPpy library.
#
# See https://mutalyzer.nl/webservices
#
# Usage:
# python client-soappy.py 'NM_002001.2:c.1del'
#
# This code is in the public domain; it can be used for whatever ... | StarcoderdataPython |
11349418 | import logging
import shutil
import tempfile
from pathlib import Path
import toml
from lambda_packager.config import Config
from lambda_packager.handle_poetry import poetry_is_used, export_poetry
from lambda_packager.handle_requirements_txt import install_requirements_txt
class NoSrcFilesFound(Exception):
pass
... | StarcoderdataPython |
9703248 | <gh_stars>0
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import time
import subprocess
import json
import re
import copy
import socket
DIR_LOG_BASE = "/var/log/xf-traffic-generator"
UNIQUE_KEY = "unique"
MAIN_EXEC_NAME = "./xf-generator-main"
DAEMON_EXEC_NAME = "./xf-generator-daemon"
DAEMON_PY_NAME = "../too... | StarcoderdataPython |
11385448 | import yaml
from sigma.parser.collection import SigmaCollectionParser
from sigma.parser.exceptions import SigmaParseError, SigmaCollectionParseError
from stix2 import CustomObject, KillChainPhase, properties
from yeti.core.errors import ValidationError
from .indicator_base import Indicator
@CustomObject('x-sigma', ... | StarcoderdataPython |
9799001 | # -*- coding: utf-8 -*-
# The main program for Markov chain Monte Carlo simulation
# This program requires four initial parameters, k, r, T and nsteps.
# where k is the number of nodes, r is the weight coefficient.
# T is temperature, nsteps is total number of steps, i.e., graphs.
# They are specified at the beginning ... | StarcoderdataPython |
9700939 | <reponame>ymetz/local_interpretability
from tcav.tcav import TCAV
import tcav.model as cm
import tcav.utils as utils
import os
import pickle
import image_crawler
from dataservice import get_model_list, get_dataset_list
import tcav.activation_generator as act_gen
import tensorflow as tf
def load_tcavs(model, dataset):... | StarcoderdataPython |
6529784 | # Copyright 2021 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | StarcoderdataPython |
122891 | <reponame>focusexplorer/AI_hand_digit_recognition<filename>test.py
from PIL import Image
import sys
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import glob
import re
import copy
def relu(x):
y=copy.deepcopy(x);
y[y<0]*=0.1;
# print 'x=',x,'y=',y
return y;
# if x>=0:
# return x;
# ... | StarcoderdataPython |
240252 | def function(request):
return "👋 Hello from python functions-framework"
| StarcoderdataPython |
90635 | <reponame>AlexanderAivazidis/scvelo<filename>scvelo/tools/pymc/pymc3_model.py
# -*- coding: utf-8 -*-
r"""Base Pymc3 model class for all models in pymc3"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymc3 as pm
import theano
from pymc3.variational.callbacks import CheckParametersConv... | StarcoderdataPython |
4810036 | <reponame>alexsharoff/BuildMigrator<filename>build_migrator/generators/_cmake/cmake_copy.py<gh_stars>10-100
import os
from .cmake_cmd import CMakeCmd
copy_tmpl = "configure_file({input} {output} COPYONLY)\n"
class CMakeCopy(CMakeCmd):
priority = 1
@staticmethod
def add_arguments(arg_parser):
pas... | StarcoderdataPython |
6501763 | from ..imagelist import ImageList
from ..office31 import Office31
from ..officehome import OfficeHome
from ..visda2017 import VisDA2017
from typing import Optional, ClassVar, Sequence
from copy import deepcopy
__all__ = ['Office31', 'OfficeHome', "VisDA2017"]
def open_set(dataset_class: ClassVar, public_classes: S... | StarcoderdataPython |
6460321 | # Time: O(n)
# Space: O(1)
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
class Solution(object):
def longestMountain(self, A):
"""
:type A: List[int]
:rtype: int
"""
result, up_len, down_len = 0, 0, 0
for i in xrange(1, len(A)... | StarcoderdataPython |
4981772 | <gh_stars>1-10
import requests, json, pandas as pd
import os
from dotenv import load_dotenv
# Returns parks (lat, long) from National Park Service API
def parks_get():
load_dotenv()
endpoint = "https://developer.nps.gov/api/v1/parks"
HEADERS = {"X-Api-Key": os.getenv("DATAGOV_KEY")}
params = {"limit":... | StarcoderdataPython |
4834448 | <reponame>drumcap/vanillaPython<gh_stars>0
import networkx
import re
class RawSentence:
def __init__(self, textIter):
if type(textIter) == str:
self.textIter = textIter.split('\n')
else:
self.textIter = textIter
self.rgxSplitter = re.compile('([.!?:](?:["\']|(?![0-9... | StarcoderdataPython |
6548305 | # ---------------------------------------------------------------------------
# Pelion Device Management SDK
# (C) COPYRIGHT 2017 Arm Limited
#
# 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
#... | StarcoderdataPython |
3255964 | from opening_hours.hours import get_opening_hours
def get_resources_total_hours(resource_ids, period_start, period_end):
opening_hours = get_opening_hours(
resource_ids,
period_start,
period_end,
)
hours_in_day = 24
total_opening_hours = 0
for opening_hour in opening_hours:... | StarcoderdataPython |
4959932 | import json
import logging
import os
import requests
import sys
import uuid
WIT_API_HOST = os.getenv('WIT_URL', 'https://api.wit.ai')
WIT_API_VERSION = os.getenv('WIT_API_VERSION', '20160516')
DEFAULT_MAX_STEPS = 5
INTERACTIVE_PROMPT = '> '
LEARN_MORE = 'Learn more at https://wit.ai/docs/quickstart'
class WitError(Ex... | StarcoderdataPython |
6449264 | from . import oldShorthands
def run(doc):
oldShorthands.transformShorthandElements(doc)
oldShorthands.transformProductionPlaceholders(doc)
oldShorthands.transformMaybePlaceholders(doc)
oldShorthands.transformAutolinkShortcuts(doc)
oldShorthands.transformProductionGrammars(doc)
| StarcoderdataPython |
4860919 | from nltk import word_tokenize
from nltk.stem import WordNetLemmatizer
from utilities import clean_text
import pandas as pd
class LemmaTokenizer(object):
def __init__(self):
self.wnl = WordNetLemmatizer()
def __call__(self, doc):
return [self.wnl.lemmatize(t) for t in word_tokenize(doc)]
# f... | StarcoderdataPython |
11220450 | import i3ipc
from .find import Finder
class Executor():
def __init__(self, prefix):
self.count = 0
self.prefix = prefix
self.callback = lambda i3, window: None
self.callbacks = {}
def onNewWindow(self, on_new_window):
self.callback = on_new_window
return self
def onDone(self, on_done):
... | StarcoderdataPython |
6670788 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def CheckChangeOnUpload(input_api, output_api):
"""Warn when changing md_history without vulcanizing."""
def _is_history_source_file(file):
path = ... | StarcoderdataPython |
11318930 | # -*- coding: utf-8 -*-
# -------------------------------------------#
# author: <NAME> #
# email: <EMAIL> #
# -------------------------------------------#
""" XMNLP - Lexical
Model Tree:
lexical
├── label2id.json
├── lexical.onnx
├── trans.npy
└── vocab.txt
"""
import o... | StarcoderdataPython |
4838645 | import FWCore.ParameterSet.Config as cms
HITrackCorrections = cms.EDAnalyzer('HITrackCorrectionAnalyzer',
trackSrc = cms.InputTag("hiGeneralTracks"),
vertexSrc = cms.InputTag("hiSelectedVertex"),
pfCandSrc = cms.InputTag("particleFlowTmp"),
jetSrc = cms.InputTag("akPu4CaloJets"),
tpEffSrc = cms.In... | StarcoderdataPython |
4863732 | <reponame>NunoEdgarGFlowHub/pymia
"""The evaluator module provides classes to evaluate the metrics on predictions.
All evaluators inherit the :class:`pymia.evaluation.evaluator.Evaluator`, which contains a list of results after
calling :meth:`pymia.evaluation.evaluator.Evaluator.evaluate`. The results can be passed to... | StarcoderdataPython |
5142503 | endpoint="http://dynamodb.us-east-1.amazonaws.com"
| StarcoderdataPython |
222497 | import os
import theano
import theano.tensor as T
from neupy import layers, storage, architectures
from imagenet_tools import (CURRENT_DIR, FILES_DIR, load_image,
print_top_n, download_file)
theano.config.floatX = 'float32'
SQUEEZENET_WEIGHTS_FILE = os.path.join(FILES_DIR, 'squeezenet.pi... | StarcoderdataPython |
5182344 | <filename>lecture_11_advanced_topics/hw/hw2.py
"""
You are given the following code:
class Order:
morning_discount = 0.25
def __init__(self, price):
self.price = price
def final_price(self):
return self.price - self.price * self.morning_discount
Make it possible to use different discount... | StarcoderdataPython |
3525946 | <gh_stars>10-100
'''
Authors: <NAME>, <NAME>
Emails: <EMAIL>, <EMAIL>
Date: 03/17/2019
Overview: Entry point of autostack.
'''
from autostack.cli import cli
def main():
'''
Entry point of autostack.
'''
cli()
| StarcoderdataPython |
11233175 | # Copyright 2021 <NAME>. 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 agreed to... | StarcoderdataPython |
11246194 | <reponame>Oyekunle-Mark/eat-that-cake
def find_repeat(numbers):
# sort numbers in place
numbers.sort()
# initialize a variable previous_number to zero
previous_number = 0
# loop through every number in numbers
for number in numbers:
# if current number equals previous_number
if ... | StarcoderdataPython |
1810047 | ''' show_arp.py
IOSXR parsers for the following show commands:
* show arp detail
* show arp vrf <WORD> detail
* show arp traffic detail
'''
# Python
import re
# Metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Schema, Any, Optional
# parser utils
from gen... | StarcoderdataPython |
1983469 | <gh_stars>0
from abc import ABC, abstractmethod
class ApiBase(ABC):
"""
APIs base methods.
"""
@abstractmethod
def get_url(self) -> str:
pass
@abstractmethod
def process_import(self) -> int:
pass
| StarcoderdataPython |
9663173 | """Backups and commit the configuration, and handles commit confirm."""
import logging
from napalm.base.exceptions import CommitError
from napalm_arubaoss.helper.utils import backup_config, commit_candidate
from napalm_arubaoss.helper.get_config import get_config
from napalm_arubaoss.helper.load_replace_candidate im... | StarcoderdataPython |
115119 | <filename>test/test_topology_handler.py<gh_stars>0
import unittest
import sdxdatamodel.parsing
from sdxdatamodel.parsing.topologyhandler import TopologyHandler
from sdxdatamodel.parsing.exceptions import DataModelException
TOPOLOGY_AMLIGHT = './test/data/amlight.json'
class TestTopologyHandler(unittest.TestCase):
... | StarcoderdataPython |
260005 | #!/usr/bin/env python
"""
Running tests for djangosaml2_spid application.
"""
import os
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
if __name__ == "__main__":
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
django.setup()
TestRunner = get... | StarcoderdataPython |
6641578 | import nuke
def duplicate_node(node, to_file = None):
"""Slightly convoluted but reliable(?) way duplicate a node, using
the same functionality as the regular copy and paste.
Could almost be done tidily by doing:
for knobname in src_node.knobs():
value = src_node[knobname].toScript()
... | StarcoderdataPython |
5149341 | """
Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
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 agre... | StarcoderdataPython |
11274149 | <gh_stars>1-10
"""
Base GraphQL utilities
isort:skip_file
"""
# The GraphQL query recommended for a full schema introspection.
from .introspection_query import introspection_query
# Gets the target Operation from a Document
from .get_operation_ast import get_operation_ast
# Build a GraphQLSchema from an intr... | StarcoderdataPython |
5128943 | <reponame>mkoivi-ms/InnerEye-DeepLearning<gh_stars>1-10
# ------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# -----------... | StarcoderdataPython |
6543269 | <gh_stars>10-100
import pytest
import numpy as np
from geneal.genetic_algorithms.genetic_algorithm_base import GenAlgSolver
from geneal.utils.exceptions import NoFitnessFunction, InvalidInput
from geneal.utils.exceptions_messages import exception_messages
from geneal.genetic_algorithms.genetic_algorithm_base import (... | StarcoderdataPython |
3480683 | <filename>MonteCarloMarginalizeCode/data/BNS_2015_MDC/DerivedZeroSpinTests/get_coinc.py<gh_stars>1-10
#!/usr/bin/env python
import sys
import math
import sqlite3
# Stolen from gstlal_inspiral_plotsummary
sim_coinc_map = """
CREATE TEMPORARY TABLE
sim_coinc_map
AS
SELECT
sim_inspiral.simulation_id AS s... | StarcoderdataPython |
8181530 | #Problema1
def numeros_divisibles_multiplos (limite_inferior, limite_superior):
if limite_superior > limite_inferior:
resultado = []
for n in range (limite_inferior, limite_superior + 1):
if n % 7 == 0 and n % 5 == 0:
resultado.append(n)
return resu... | StarcoderdataPython |
4959760 | <gh_stars>0
# Copyright (c) 2010-2019 openpyxl
import pytest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def ExtendedProperties():
from ..extended import ExtendedProperties
return ExtendedProperties
class TestExtendedProperties:
... | StarcoderdataPython |
3494381 | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
# Create your models here.
class Profile(models.Model):
"""
method to create profile
"""
avatar = models.ImageField(upload_to='media/', null=T... | StarcoderdataPython |
3349345 | <gh_stars>1-10
Ra = 1
kRa = 1000
mRa = 1000000
TAS = 1000000000 | StarcoderdataPython |
8021451 | from subprocess import run, PIPE, STDOUT
from btr.loader import Loader
from btr.utilities import get_outdir_path
import pandas as pd
settings_files = [
'test_data/run_settings/settings_synthetic_Ordinal.json',
'test_data/run_settings/settings_synthetic_Multiclass_Linear.json',
'test_data/run_settings/setti... | StarcoderdataPython |
1828524 | """authentik policy signals"""
from django.core.cache import cache
from django.db.models.signals import post_save
from django.dispatch import receiver
from structlog.stdlib import get_logger
from authentik.core.api.applications import user_app_cache_key
from authentik.policies.engine import GAUGE_POLICIES_CACHED
from ... | StarcoderdataPython |
103569 | <filename>default_tts.py
"""
Assumes a working docker instance of the parente/espeakbox image.
This should be the case with the docker-compose method of installing Eva.
"""
import sys
import requests
import gossip
from eva import log
from eva import conf
def get_settings_string():
"""
Will eventually pull from... | StarcoderdataPython |
340419 | """
my NN library
(based on Yoav's)
"""
import _dynet as dynet
import numpy as np
import array
from bilstm_aux.lib.constants import START_TAG, END_TAG
from scipy import linalg
def init_dynet(seed):
"""initialize DyNet"""
dyparams = dynet.DynetParams()
# Fetch the command line arguments (optional)
dypa... | StarcoderdataPython |
1959923 | <reponame>lmadhusudhanan/contrail-test
import argparse
import ConfigParser
import sys
import string
import json
import os
import re
import platform
from fabric.api import env, run, local, lcd, get
from fabric.context_managers import settings, hide
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
from... | StarcoderdataPython |
357935 | """
Classes for retrieving tiles from different providers.
"""
import abc
import io
import logging
import os
import random
import numpy as np
import PIL.Image
from requests_cache import CachedSession
from . import fs_cache
CACHE_DIR = os.path.expanduser( '~/.vismap-tiles')
logger = logging.getLogger(__name__)
_... | StarcoderdataPython |
11218710 | <filename>client/states/invited.py
from client.states import logged_in, waiting, playing
from client.board import Board, Mark
from client.states.base import State
from random import random
class InvitedState(State):
def handle_input_command(self, command):
if command == "y":
self._handle_invi... | StarcoderdataPython |
317313 | """ models module """
import numpy as np
import scipy.integrate as sci
import itertools
from core import utils
from core import fitting
class Model(object):
""" Parent Class for the charge carrier recombination models """
def __init__(self, ids, units, units_html, factors, fvalues, gvalues, gvalues_range, ... | StarcoderdataPython |
3474531 | import logging
import os
from dotenv import load_dotenv
from flask import Flask
from flask_mail import Mail
from flask_wtf import CSRFProtect
from flask import g
from flask.sessions import SecureCookieSessionInterface
from flask_login import user_loaded_from_header
import logging_config
load_dotenv()
postgres_user =... | StarcoderdataPython |
3362827 | from unittest import TestCase
from parameterized import parameterized
from design_patterns.solid.ocp.common import Color, Size
from design_patterns.solid.ocp.product_filter_bad import ProductFilter
from unit.ocp_common import products
class TestProductFilter(TestCase):
def setUp(self) -> None:
self.prod... | StarcoderdataPython |
3402240 | <gh_stars>100-1000
# Generated by Django 2.2.6 on 2019-10-09 16:00
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_... | StarcoderdataPython |
277358 | """Scripts to compute multitask features and targets
"""
from __future__ import print_function
import argparse
import csv
import glob
import json
import medleydb as mdb
from medleydb import mix
import mir_eval
import numpy as np
import os
import compute_training_data as C
EXCEPTIONS = {
'AnEndlessSporadic_Anyth... | StarcoderdataPython |
6544963 | <reponame>crisperdue/holpy
# Author: <NAME>
from kernel.type import TFun, TConst, NatType
from kernel.term import Term, Const, Binary
from data.list import ListType, mk_literal_list, is_literal_list, dest_literal_list
"""Utility functions for characters and strings."""
charT = TConst("char")
stringT = TConst("string... | StarcoderdataPython |
8118527 | <filename>instapp/models.py
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Profile(models.Model):
profile_photo = models.ImageField(upload_to='profile-pics')
bio = models.TextField()
user= models.ForeignKey(User)
@classmethod
def get_all(c... | StarcoderdataPython |
1821549 | import boto3
from botocore.config import Config
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import ensure_csrf_cookie
from rest_framework import status
... | StarcoderdataPython |
6488566 | import io
import json
import time
import asyncio
import aiohttp
import traceback
from concurrent.futures._base import CancelledError
import collections
import telepot
import telepot.async.helper
class Bot(telepot._BotBase):
def __init__(self, token, loop=None):
super(Bot, self).__init__(token)
sel... | StarcoderdataPython |
4905674 | <filename>setup.py
"""Python setup script.
:author: <NAME> <<EMAIL>>
:license: MIT, see license file or https://opensource.org/licenses/MIT
:created on 2018-10-06 10:55:36
:last modified by: <NAME>
:last modified time: 2019-07-23 10:27:04
"""
import io
import os
import re
from setuptools import setup
def read(*nam... | StarcoderdataPython |
1715539 | # -*- coding: utf-8 -*-
from sys import argv
script, file_name = argv
txt = open(file_name)
print txt.read()
#remember to close the file after open it
txt.close()
txt_again = raw_input('Input the file name again\n > ')
txt_file_again = open(txt_again)
print txt_file_again.read()
txt_file_again.close() | StarcoderdataPython |
1603009 | # coding: utf8
shortcuts = {
"Terminal":{
#https://github.com/0nn0/terminal-mac-cheatsheet
"Go to the beginning of the line you are currently typing on.":"Ctrl A ",
"Go to the end of the line you are currently typing on.":"Ctrl E ",
"Clears everything on current line":"Ctrl Q ",
... | StarcoderdataPython |
4838662 | <filename>rodan/test/views/test_workflow.py
from django.conf import settings
from rodan.models import Workflow, InputPort, OutputPort, ResourceType
from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework.test import APITestCase
from model_mommy import mommy
from rodan.test.hel... | StarcoderdataPython |
4825782 | # ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | StarcoderdataPython |
3467396 | <filename>dbots/rest/errors.py
import json
from ..errors import XenonException
__all__ = (
"HTTPException",
"HTTPNotFound",
"HTTPForbidden",
"HTTPBadRequest",
"HTTPTooManyRequests",
"HTTPUnauthorized"
)
class HTTPException(XenonException):
def __init__(self, status, message):
se... | StarcoderdataPython |
5063845 | <filename>tests/guard/test_inquiry.py
import pytest
from vakt.guard import Inquiry
def test_default_values():
i = Inquiry()
assert '' == i.subject
assert '' == i.action
assert '' == i.resource
assert {} == i.context
def test_json_roundtrip():
i = Inquiry(resource='books:abc', action='view',... | StarcoderdataPython |
11205768 | <reponame>ruslanlvivsky/python-algorithm<filename>swexpert/d2/sw_2001.py
test_cases = int(input().strip())
def catch_flies(y, x, m, mat):
total = 0
for i in range(y, y + m):
for j in range(x, x + m):
total += mat[i][j]
return total
for t in range(1, test_cases + 1):
n, m = tuple(... | StarcoderdataPython |
80318 | <filename>oops_fhir/r4/code_system/modifier_type_codes.py
from pathlib import Path
from fhir.resources.codesystem import CodeSystem
from oops_fhir.utils import CodeSystemConcept
__all__ = ["ModifierTypeCodes"]
_resource = CodeSystem.parse_file(Path(__file__).with_suffix(".json"))
class ModifierTypeCodes:
"""... | StarcoderdataPython |
1633144 | """handle sessions
Revision ID: 7f317474332d
Revises: <PASSWORD>
Create Date: 2016-08-30 11:47:35.513396
"""
# revision identifiers, used by Alembic.
revision = "7<PASSWORD>"
down_revision = "<PASSWORD>"
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ple... | StarcoderdataPython |
1635890 | <filename>Dataset/Leetcode/train/102/29.py
class Solution:
def XXX(self, root: TreeNode) -> List[List[int]]:
d = collections.defaultdict(list)
def f(r, i):
if r:
d[i].append(r.val)
f(r.left, i + 1)
f(r.right, i + 1)
f(root, 0)
... | StarcoderdataPython |
11214656 | <gh_stars>1-10
# Copyright 2018 dhtech
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file
import lib
def generate(host, mgmt_fqdn, *args):
"""Arg format is domain:host.
The OS of the host is used to get the backend type.
"""
vault_prefix = ''
i... | StarcoderdataPython |
8071199 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Unit tests for //compiler_gym:compiler_env_state."""
import json
from io import StringIO
from pathlib import Path
import pytest
from pydant... | StarcoderdataPython |
87761 | <reponame>sysdiglabs/syscli
# Copyright 2018 Sysdig
#
# 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 applica... | StarcoderdataPython |
9670639 | #!/usr/bin/env python
from __future__ import print_function
import os
import cv2
import numpy as np
import ugv_bot.srv
from ugv_bot.srv import SendImu, SendImuResponse
import rospy
import serial
from sensor_msgs.msg import Imu
uno=serial.Serial(port='/dev/ttyACM0', baudrate='9600', timeout=0.01)
def read_serial... | StarcoderdataPython |
5050723 | """Contains the time command"""
import traceback
import json
import datetime
import configparser
import botutils
from library import display_time
from discord.ext import commands
from botc import check_if_is_player, Phase
from botc.gameloops import base_day_loop, calculate_base_day_duration, debate_timer, \
nomina... | StarcoderdataPython |
1948108 | from setuptools import setup
version = {}
with open("particlizer/version.py") as f:
exec(f.read(), version)
setup(name='particlizer',
version=version['__version__'],
description='Turn images into particlized interactive animations',
author='<NAME>',
author_email='<EMAIL>',
url='https... | StarcoderdataPython |
1796439 | <reponame>VasuXD/YukkiMusicBot
#
# Copyright (C) 2021-2022 by TeamYukki<EMAIL>, < https://github.com/TeamYukki >.
#
# This file is part of < https://github.com/TeamYukki/YukkiMusicBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/TeamYukki/YukkiMusicBot/blob/mast... | StarcoderdataPython |
5050708 | from scraper import html_scraper, scrap_them_all
from utils import preprocess, preprocess_lematize, strings_concatenate
from word_cloud import generate_wordcloud
from summarization import summarization_freq, save_summary, summarizer_sumy
from goose3 import Goose
global_url = "http://www.olharalerta.com.br/noticias/"
... | StarcoderdataPython |
6578286 | import FWCore.ParameterSet.Config as cms
# Ideal geometry for ECAL+HCAL, needed for simulation
from Geometry.CMSCommonData.ecalhcalGeometryXML_cfi import *
from Geometry.HcalCommonData.hcalParameters_cfi import *
from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import *
| StarcoderdataPython |
11325451 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 21 00:06:45 2019
@author: Mochi
"""
import os
os.system('sudo shutdown -h now') | StarcoderdataPython |
8069935 | """
백준 6497번 : 전력난
- 크루스칼 알고리즘 혹은 프림 알고리즘
"""
import sys
input = sys.stdin.readline
def find(x):
if Nroot[x] != x:
Nroot[x] = find(Nroot[x])
return Nroot[x]
while True:
M, N = map(int, input().split())
# 이 포인트가 중요.
if M == 0 and N == 0:
break
Nroot = [i for i in range(M)]
... | StarcoderdataPython |
9629647 | <reponame>syncccc/Python-Crash-Course
# 创建原始列表并打印
travel_places = ['lhasa','lijiang','qinghai lake','skyland']
print(travel_places)
# 按字母顺序打印该列表,同时不要修改原始列表
print("\n这里是按照字母顺序打印的列表:")
print(sorted(travel_places))
# 再次打印该列表,核实顺序未变
print("\n这个是原始列表:")
print(travel_places)
# 按与字母顺序相反的顺序打印这个列表,同时不要修改它
print("\n这个是与字母顺序相反... | StarcoderdataPython |
8171584 | <reponame>mbeacom/mythril
from mythril.analysis.report import Report
from mythril.analysis import modules
import pkgutil
import logging
def fire_lasers(statespace):
issues = []
_modules = []
for loader, name, is_pkg in pkgutil.walk_packages(modules.__path__):
_modules.append(loader.find_modu... | StarcoderdataPython |
1794974 | <reponame>cccccccccccccc/Myleetcode<filename>804/uniquemorsecodeword.py
from typing import List
class Solution:
def uniqueMorseRepresentations(self, words: List[str]) -> int:
morseform = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-",... | StarcoderdataPython |
9533 | import pygame.font
import copy
class Text:
"""Draws a text to the screen."""
def __init__(self, rect, size, color, screen, text):
self.screen = screen
self.rect = copy.deepcopy(rect)
self.text = text
self.color = color
self.font = pygame.font.SysFont(None, size)
... | StarcoderdataPython |
6597468 | import os
import platform
import shutil
import tempfile
import warnings
from collections import Counter
from os.path import join as pjoin
from typing import MutableMapping, Optional
import lmdb
import configparser
from . import constants as c
from . import __version__
class TxnRegisterSingleton(type):
_instance... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.