id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8074221 | #import inbuilt module from http library
from http.server import HTTPServer, BaseHTTPRequestHandler
#class to hold the server
class WebServer(BaseHTTPRequestHandler):
#inbuilt method do_get inherited from the class
#method runs when get request is received
def do_GET(self):
#check path if is a ... | StarcoderdataPython |
3565856 | #!/pxrpythonsubst
#
# Copyright 2017 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | StarcoderdataPython |
1851070 | <reponame>waikato-ufdl/wai-annotations-bluechannel
import numpy as np
from wai.annotations.core.component import ProcessorComponent
from wai.annotations.core.stream import ThenFunction, DoneFunction
from wai.annotations.core.stream.util import RequiresNoFinalisation
from wai.annotations.domain.image.segmentation impor... | StarcoderdataPython |
6420336 | import argparse
from collections import namedtuple
from typing import Dict
from pathlib import Path
import torch
def main(args: argparse.Namespace):
bert_weight_path: str = args.bert_weight_path
transformer_weight_path: str = args.transformer_weight_path
result_path: str = args.result_path
bert_weig... | StarcoderdataPython |
1723019 | <gh_stars>0
from typing import Callable, List, TypeVar
from dataclasses import dataclass
from omegaconf import OmegaConf, SCMode, MISSING
from dataset_zr19 import ConfDataset
from train_vocoder import ConfTrainVocoder
from model import ConfModel
from datamodule import ConfData
CONF_DEFAULT_STR = """
seed: 13
sampli... | StarcoderdataPython |
1965043 | # Import installed modules
from flask import abort
from flask_apispec import doc, use_kwargs, marshal_with
from flask_jwt_extended import get_current_user
from flask_jwt_extended import jwt_refresh_token_required
from webargs import fields
# Import app code
from app.api.v1.api_docs import docs
from app.core import dat... | StarcoderdataPython |
8072849 | <filename>statey/ext/pulumi/plugin_installer.py
from typing import Optional
import pylumi
import statey as st
from statey.ext.pulumi import exc
from statey.ext.pulumi.constants import PULUMI_NS
class PulumiPluginInstaller(st.PluginInstaller):
"""
Plugin installer using pulumi's native functionality
"""
... | StarcoderdataPython |
3226029 | <reponame>TadayoshiCarvajal/EvoSchedule<filename>evoschedule/app/genome_builder.py
class GenomeBuilder:
def __init__(self, time_scale, time_per_task, min_task_time):
""" A class used to generate a Genome object."""
self.time_scale = time_scale
self.total_minutes = self.get_total_minutes()
... | StarcoderdataPython |
9791623 | <filename>tests/test_client/test_sdk_utils.py
from datetime import datetime
import pytest
import cognite.client._utils as utils
from cognite.client.stable.datapoints import Datapoint, TimeseriesWithDatapoints
class TestConversions:
def test_datetime_to_ms(self):
from datetime import datetime
as... | StarcoderdataPython |
3301078 | # bundler.py
"""Module to implement the Bundler component of the Long Term Archive."""
import asyncio
import json
from logging import Logger
import logging
import os
import shutil
import sys
from typing import Any, Dict, Optional
from zipfile import ZIP_STORED, ZipFile
from rest_tools.client import RestClient # type... | StarcoderdataPython |
4990981 | """
Write a function to generate the generalized abbreviations of a word.
Example:
Given word = "word", return the following list (order does not matter):
["word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d",
"1or1", "w1r1", "1o2", "2r1", "3d", "w3", "4"]
"""
class Solution(object):... | StarcoderdataPython |
12848632 | <filename>tests/unit/dataactvalidator/test_b9_award_financial.py
from tests.unit.dataactcore.factories.staging import AwardFinancialFactory
from tests.unit.dataactcore.factories.domain import ProgramActivityFactory
from tests.unit.dataactcore.factories.job import SubmissionFactory
from tests.unit.dataactvalidator.utils... | StarcoderdataPython |
5063342 | from . import util
from . import exceptions
from . import constants
from . import ProgressHandler
from .Deezer import Deezer
from .Downloader import Downloader
name = "PyDeezer"
| StarcoderdataPython |
11216069 | import FWCore.ParameterSet.Config as cms
# output block for alcastream HCAL Min Bias
# output module
# module alcastreamHcalMinbiasOutput = PoolOutputModule
OutALCARECOHcalCalMinBiasHI_noDrop = cms.PSet(
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('pathALCARECOHcalCalMinBias')
),
... | StarcoderdataPython |
1816836 | from waio.rules import MessageCommandsRule
@dp.message_handler(MessageCommandsRule(commands=['start', 'echo']))
async def commands_rule_without_labeler(message: Message):
await message.answer(
f'Filter used: [MessageCommandsRule], msg: {message.text}'
)
| StarcoderdataPython |
1967560 | #
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
import fnmatch
import os
from typing import List
DEFAULT_ALLOWEDLIST_FILE = os.path.join(os.path.dirname(... | StarcoderdataPython |
6402108 | <reponame>HrWang96/AutoBand<filename>MidiTranscription/identifier.py
"""
identifier.py contains the functions used to identify:
1. note (A, A#, B, C, C#, etc)
2. chord (major triad, minor triad, major 7th, etc)
"""
# DEFENITIONS
# assigning midi values to notes
cnotes = [36,48,60,72,84]
csnotes = [x... | StarcoderdataPython |
6493482 | """
Root Mean Squared Error (MSE)
Calculates the RMSE between a cover and stego image
"""
import cv2
import math
from MSE import MSE
class RMSE(MSE):
def __init__(self):
super().__init__()
self.name = "Root Mean Squared Error"
# calculates MSE and takes square root
def get_error(self, ... | StarcoderdataPython |
341153 | <reponame>LiXuanqi/NuaaOversea-backend-Flask
#!/usr/bin/env python
# encoding: utf-8
"""
File name: search.py
Function Des: ...
~~~~~~~~~~
author: 1_x7 <<EMAIL>> <http://lixuanqi.github.io>
"""
from sqlalchemy import or_
from app.models import Application, Tag, Country
def search_application(query_... | StarcoderdataPython |
1670887 | <reponame>pijll/xxmaker<filename>xxmaker/gamepart/Train.py<gh_stars>0
from . import Paper
from Definitions import mm
import Colour
import Font
from graphics.cairo import Draw
from graphics.cairo.Draw import TextStyle
class Train:
def __init__(self, name, colour, price, image=None, rusted_by=None, exchange_price=N... | StarcoderdataPython |
5148743 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
from __future__ import unicode_literals
import os
import time
from django.utils.encoding import force_bytes
from cronman.job import BaseCronJob
from cronman.taxonomies import CPUPriority, IOPriority, LockType
# Test cron jobs:
class Sleep(BaseCr... | StarcoderdataPython |
6569474 | # Copyright 2020 Pax Syriana Foundation. Licensed under the Apache License, Version 2.0
#
import click
from via_cms.model import *
# from via_cms.model._relationship import GeolocPost
# from via_cms.model.feed.basket_dao import Basket
# from via_cms.model.feed.feed_document_dao import FeedDocument
# from via_cms.... | StarcoderdataPython |
3505166 | #! /usr/bin/env python
class file_object:
def __init__(self, filename=None, name_md5=None, name_B64=None, name_type=None, filesize=None, inode=None, parent_inode=None, mode=None, nlink=None, namesize=None, uid=None, gid=None, genId=None, mtime=None, atime=None, ctime=None, crtime=None, xnonce=None, xmaster=None, xN... | StarcoderdataPython |
1828968 | # coding: utf-8
from numpy import median
from nltk import word_tokenize, sent_tokenize
import os
import re
import unify
from tqdm import tqdm
import ufal.udpipe
global model
def ensure_dir(directory):
if not os.path.exists(directory):
os.makedirs(directory)
return directory
de... | StarcoderdataPython |
223987 | <gh_stars>0
import click
from qcportal import FractalClient
@click.command()
@click.option(
"--qcaid",
"qcaid",
type=click.INT,
required=True,
help="id of the optimization record to pull information from",
)
@click.option(
"--print_spec",
type=click.BOOL,
default=False,
help="print... | StarcoderdataPython |
3563140 | <reponame>ajoer/LocationBias<gh_stars>0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
-- Locality bias analysis and visualization scripts --
Analyse links and references from revisions of pages in language versions on Wikipedia for locality bias.
Evaluate whether a country is local to a language. Make visualizati... | StarcoderdataPython |
5103069 | from abc import abstractmethod, ABC
from serum import (
inject,
dependency,
Context,
singleton)
from serum._injected_dependency import Dependency as InjectedDependency
from serum.exceptions import NoNamedDependency, InjectionError
import pytest
@dependency
class SomeDependency:
pass
@dependency... | StarcoderdataPython |
1839459 | <reponame>greywormz/Astrophysics<filename>Interactives/starlib.py<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
StarLib
This is a set of routines we have written to help in the generation of
stars for the astronomical interactives project.
Functions included
------------------
Rad_calc(mass):
... | StarcoderdataPython |
3290872 | <reponame>jspeerless/citrine-python
from copy import deepcopy
import uuid
from random import random
import pytest
from citrine.informatics.descriptors import RealDescriptor
from citrine.informatics.design_spaces import EnumeratedDesignSpace, DesignSpace, ProductDesignSpace
from citrine.resources.design_space import D... | StarcoderdataPython |
3253806 | <filename>latexing/viewer.py
import sublime
import sublime_plugin
import os.path
import time
import subprocess
from . import cache
from . import logger
from . import progress
from . import terminal
from . import tools
log = logger.getLogger(__name__)
class LtxJumpToPdfCommand(sublime_plugin.WindowCommand):
de... | StarcoderdataPython |
11381842 | <reponame>dynalz/coredis
import datetime
import functools
import inspect
import os
import re
from typing import Any, List, Optional, Tuple, Union
try:
from typing import Literal
except:
from typing_extensions import Literal
import coredis
import inflect
import redis
import redis.cluster
import requests
from pa... | StarcoderdataPython |
12800271 | #!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
import urllib3
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import base64
import json
import os
from textblob... | StarcoderdataPython |
5090189 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import lxml.html
from mock import Mock
from preggy import expect
from holmes.config import Config
from holmes.reviewer import Reviewer
from holmes.validators.required_meta_tags import RequiredMetaTagsValidator
from tests.unit.base import ValidatorTestCase
from tests.fixtures ... | StarcoderdataPython |
1617812 | <filename>submission/migrations/0001_initial.py
# Generated by Django 2.2.6 on 2020-01-02 13:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('hacker', '0003_delete_submission'),
('company', ... | StarcoderdataPython |
349960 | import pyautogui, sys, time
class PlayerInitiateClass:
def WindowsClick(self):
buttonLoc = pyautogui.locateOnScreen('windowsButton.png')
if (buttonLoc != None):
buttonPoint = pyautogui.center(buttonLoc)
buttonX, buttonY = buttonPoint
pyautogui.click(butto... | StarcoderdataPython |
9799065 | from django.contrib.redirects.models import Redirect
from ddt import ddt, data
from tests_utils.international_slug_mixin import InternationaSluglMixinTestMixin
@ddt
class InternationaSluglMixinFunctionnalRedirectionTest(InternationaSluglMixinTestMixin):
"""
Test Case handle all Redirect cases.
"""
@d... | StarcoderdataPython |
1799412 | <reponame>anrath/coba<filename>coba/environments/core.py
from abc import abstractmethod, ABC
from typing import Optional, Sequence, Hashable, Any, Union, Iterable, overload, Dict
from coba.utilities import HashableDict
from coba.pipes import Source
Action = Union[Hashable, HashableDict]
Context = Union[None, Hashabl... | StarcoderdataPython |
1806632 | # coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import six
from azure.containerregistry import (
RepositoryProperties,
ArtifactManifestProperties,
ArtifactTagProperties,
)
from azure.contai... | StarcoderdataPython |
6462973 | from hive.settings import hive_setting
from hive.util.server_response import ServerResponse
import logging
logger = logging.getLogger("HiveManage")
class HiveManage:
def __init__(self):
self.app = None
self.response = ServerResponse("HiveManage")
def init_app(self, app):
self.app = ... | StarcoderdataPython |
6537110 | <gh_stars>0
'''
Mendel's First Law
http://rosalind.info/problems/iprb/
Problem
Probability is the mathematical study of randomly occurring phenomena. We will
model such a phenomenon with a random variable, which is simply a variable that
can take a number of different distinct outcomes depending on the result of an
u... | StarcoderdataPython |
6552197 | #!/usr/bin/python2.7
import os
from optparse import OptionParser
from jinja2 import Template
from jinja2 import Environment, FileSystemLoader
import yaml
#Get options
parser = OptionParser()
parser.add_option("-c", "--config", dest="conf",
help="Config values file")
parser.add_option("-t", "--templa... | StarcoderdataPython |
11233411 | <gh_stars>1-10
#
# Copyright (c) Dell Inc., or its subsidiaries. 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
#
fro... | StarcoderdataPython |
6533269 | <filename>notes_app/persons_app/views.py
# <NAME> copyright@2021
from django.http import Http404
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Person
from .serializers import PersonSerializer
class ListPersons(APIView):
... | StarcoderdataPython |
6424423 | import server
import client
import packet
| StarcoderdataPython |
330728 | <filename>python/arithmetic_slices.py
'''
A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.
For example, these are arithmetic sequence:
1, 3, 5, 7, 9
7, 7, 7, 7
3, -1, -5, -9
The following sequence is not arithme... | StarcoderdataPython |
3355708 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# author: <EMAIL>
# datetime: 2021/3/16 下午3:39
# project: vulhub-compose
__version__ = '0.0.6'
| StarcoderdataPython |
1725506 | <filename>flexs/utils/__init__.py<gh_stars>10-100
"""
Utility modules.
`utils.sequence_utils` is the most important and useful.
"""
| StarcoderdataPython |
136568 | # -*- coding: utf-8 -*-
def get_m2_name(self):
"""Return the name of the current area unit
Parameters
----------
self : Unit
A Unit object
Returns
-------
unit_name : str
Name of the current unit
"""
if self.unit_m2 == 1:
return "mm²"
else:
ret... | StarcoderdataPython |
11348868 | <gh_stars>0
from http.cookiejar import LWPCookieJar, LoadError
from http.client import HTTPMessage
from re import (
compile as re_compile,
IGNORECASE
)
from os.path import exists as path_exists
from time import sleep
from urllib.parse import urlencode, parse_qsl
from urllib.request import (
build_opener,
... | StarcoderdataPython |
9605029 | <filename>Script_Python/Exercicios_Secao4/conversor_jardas_metros.py
jardas = float(input('digite seu comprimento em jardas: '))
metros = 0.91 * jardas
print(f'{jardas} jardas é equivalente a {metros} metros')
| StarcoderdataPython |
11249224 | <reponame>natestedman/Observatory
#!/usr/bin/env python
# Copyright (c) 2010, individual contributors (see AUTHORS file)
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice ap... | StarcoderdataPython |
11326522 | import csv
from dataactcore.logging import configure_logging
from dataactcore.utils.stringCleaner import StringCleaner
from dataactcore.models.lookups import FIELD_TYPE_DICT_ID
class FieldCleaner(StringCleaner):
""" This class takes a field definition file and cleans it,
producing a field definition file... | StarcoderdataPython |
3305985 | # -*- coding: utf-8 -*-
"""
Sample app with two different themes
"""
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
import dash_bootstrap_components as dbc
"""
==================================================... | StarcoderdataPython |
367076 | from transformers import BertTokenizer
from sklearn.feature_extraction.text import TfidfVectorizer
from pytt.utils import read_pickle
import parameters as p
class AbstractTokenizer:
"""Abstract class for a tokenizer."""
def __init__(self):
pass
def tokenize(self, text):
pass
def conv... | StarcoderdataPython |
1790058 | from . import Expr
from . import Token
class Stmt(object) : pass
class Block(Stmt) :
#block -> "{" statements "}"
def __init__(self, statements : list) :
self.statements = statements
class Class(Stmt) :
#class -> class <name> "{" function* "}"
def __init__(self, name : Token, superclass : Exp... | StarcoderdataPython |
1849271 | <reponame>LifeEGX/methQC
# -*- coding: utf-8 -*-
import pytest
from pathlib import Path
import pandas as pd
import shutil
import logging
TESTPATH = 'tests'
#app
import methylcheck
class TestLoadProcessed():
epic_df = Path(TESTPATH,'test_epic_filter.pkl')
epic_df2 = Path(TESTPATH,'test_epic_filter.pkl.gz')
... | StarcoderdataPython |
4994061 | from batou.utils import cmd
import batou.template
import os.path
bootstrap_template = os.path.dirname(__file__) + '/bootstrap-template'
def generate_bootstrap(version, develop):
engine = batou.template.Jinja2Engine()
template = open(bootstrap_template, 'r').read()
return engine.expand(template, dict(ver... | StarcoderdataPython |
1770202 | <reponame>heljhumenad/parts-arrival<filename>parts/app/partsnumber/migrations/0001_initial.py
# Generated by Django 2.2 on 2021-02-26 05:38
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations ... | StarcoderdataPython |
5158967 | # -*- coding: utf-8 -*-
"""
transistor.utility.utils
~~~~~~~~~~~~
This module contains various utilities useful to maintain in Transistor source code.
:copyright: Copyright (C) 2018 by BOM Quote Limited
:license: The MIT License, see LICENSE for more details.
~~~~~~~~~~~~
"""
from functools import wraps
from time imp... | StarcoderdataPython |
11331437 | from lock import lock
import datetime
class Scan():
def__init__(self, lock, card):
self.lock=lock
self.card=card
self.datetime.date.today()
self.time=datetime.time.strftime()
def getLock(self):
return self.lock
def getCard(self):
return self.c... | StarcoderdataPython |
3475997 | <gh_stars>1-10
import lumos.numpy.casadi_numpy as np
import pytest
def test_basic_logicals_numpy():
a = np.array([True, True, False, False])
b = np.array([True, False, True, False])
assert np.all(a & b == np.array([True, False, False, False]))
if __name__ == "__main__":
pytest.main()
| StarcoderdataPython |
8152469 | <filename>livesettings/test_app/localsite/config.py<gh_stars>1-10
from livesettings import config_register, ConfigurationGroup, PositiveIntegerValue, MultipleStringValue, ModuleValue
from django.utils.translation import ugettext_lazy as _
# First, setup a grup to hold all our possible configs
MYAPP_GROUP = Configurati... | StarcoderdataPython |
19521 | <reponame>ludo67100/electroPyy_Dev<filename>electroPyy/io/__init__.py
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 21 14:54:51 2019
@author: Ludovic.SPAETH
"""
from electroPyy.io.BaseRawIO import BaseRawIO
from electroPyy.io.HdF5IO import HdF5IO
from electroPyy.io.NeuroExIO import NeuroExIO
from electroPy... | StarcoderdataPython |
358099 | <reponame>398786172/keithley
"""***********************************************************
*** Copyright Tektronix, Inc. ***
*** See www.tek.com/sample-license for licensing terms. ***
***********************************************************"""
import socket
import struct
import math
impor... | StarcoderdataPython |
8160372 | <NAME>
dabbsr
https://docs.google.com/document/d/1NYZeAN_fGb0iTEdF8upy8mrT_fNUva248VOr3c7x7pY/edit#
import turtle
wn = turtle.Screen()
wn.colormode(255)
wn.bgcolor(5,160,170)
luigi = turtle.Turtle()
def red_shape():
"""
first
"""
luigi.color("Red")
luigi.begin_fill()
luigi.speed(0)
... | StarcoderdataPython |
332113 | <gh_stars>10-100
import itertools
import asynctest
import pytest
from aioredis import RedisError
from jsondaora import dataclasses
@pytest.mark.asyncio
async def test_should_get_many(
fake_service,
serialized_fake_entity,
fake_entity,
serialized_fake_entity2,
fake_entity2,
):
await fake_servi... | StarcoderdataPython |
3590408 | <gh_stars>10-100
# A Program for viewing a dll's import section on Windows
import pefile
target_file = raw_input("The file you wish to inspect: ")
pe = pefile.PE(target_file)
print "*************************************"
print "***********IMPORT TABLE**************"
for entry in pe.DIRECTORY_ENTRY_IMPORT:
print ent... | StarcoderdataPython |
8155448 | <reponame>Lukas-Dresel/InBetweenUs<gh_stars>1-10
import ipdb
from construct import *
class SignedVarInt32Adapter(Adapter):
def _decode(self, obj, context, path):
return obj if obj & (1<<31) == 0 else (1<<32) - obj
def _encode(self, obj, context, path):
return obj if obj > 0 else (1<<32) + obj
... | StarcoderdataPython |
9669170 | <reponame>ajmal017/amp
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# ## Imports
... | StarcoderdataPython |
9722978 | # Importation des librairies
from tkinter import *
import math
from time import *
# Déclaration des variables globales
# Fenêtres
endgameview = None
settingview = None
playview = None
menuview = None
pauseview = None
warningview = None
# Widgets
sz_arena = None
cr_arena = None
cr_rackets = None
cr_ball = None
spd_ball... | StarcoderdataPython |
1676110 | #!/usr/bin/env python
from os import path
import versioneer
import sys
if sys.version_info < (3,0):
from io import open
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
requi... | StarcoderdataPython |
8098411 | <reponame>Rhoana/compresso<filename>experiments/compression/x264.py
import os
import numpy as np
from PIL import Image
from subprocess import Popen, PIPE
import tempfile
class x264(object):
@staticmethod
def name():
'''X.264 compression
'''
return 'X.264'
@staticmethod
def co... | StarcoderdataPython |
3546598 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""General utilities for helping to serve foremanlite requests."""
import logging
import typing as t
from pathlib import Path
from flask import make_response
from flask.wrappers import Request
from flask_restx.inputs import boolean
from flask_restx.reqparse import ParseRe... | StarcoderdataPython |
1860457 | <filename>hopper/utils/console/TtyHelper.py
# Copyright (c) 2015 Xilinx Inc.
#
# 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
# t... | StarcoderdataPython |
12856398 | <filename>src/lk_db/ents/time/EntTime.py
from lk_db.ents.Ent import Ent
class EntTime(Ent):
pass
| StarcoderdataPython |
3496362 | # NOT_RPYTHON
"""
Plain Python definition of the builtin ABC-related functions.
"""
# Cannot use _weakrefset like in _py_abc.py, since it is not a built-in module
from _weakref import ref
# We'll make our own WeakSet instead, with only the functionality that's needed
# This replaces the easily-forgetable calls to '_a... | StarcoderdataPython |
73348 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-unsafe
from typing import Any, Dict, List, Optional, Sequence, Tuple, Type
from libcst._exceptions import PartialParserSyntaxError
f... | StarcoderdataPython |
146057 | <gh_stars>0
#!/usr/bin/env python3
'''djs setup file'''
from setuptools import setup, find_packages
from os.path import abspath, dirname, join
from io import open
root_dir = abspath(dirname(__file__))
short_description = '''A framework for varying model parameters and automating concurrent usage
of the Wrf-hydro/Nat... | StarcoderdataPython |
4974261 | valores = [7, 2, 5, 0, 4]
# função para dobrar os valores:
def dobra(lista):
posicao = 0
while posicao < len(lista):
lista[posicao] *= 2
posicao += 1
print(lista)
dobra(valores)
# Tudo que a função dobra fizer, vai interferir na lista valores definitivamente
print(valores)
print('*' * 30)... | StarcoderdataPython |
3333683 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="pyautonifty",
version="0.0.1",
author="Markichu, Davidryan59, EL-S",
author_email="<EMAIL>",
description="Automatically and programmatically generate drawing instructions... | StarcoderdataPython |
5129417 | <reponame>zif350/tic-tac-toe
from tictactoe.board import Board
from itertools import cycle
from time import sleep
class Game:
def __init__(self, players):
self._board = Board()
self._players = players
@property
def board(self):
return self._board
@board.setter
def board(s... | StarcoderdataPython |
6453741 | import helper
import copy
from wg84Corrdinates import Wg84Corrdinates, Wg84CorrdinatesProfile
class Route:
def __init__(self, file):
[self.data, self.title] = helper.parse(file)
if not self.data:
raise Exception("Data cannot be empty")
self.yPoints = [x.ele for x in self.data... | StarcoderdataPython |
4983414 | <gh_stars>1-10
# -*- Python -*-
#
# <NAME> <<EMAIL>>
#
__doc__ = """
command line interface
"""
import click, json
# map aliases to long commands
aliases = dict()
# main command
# enable -h seems to interfere with the pyre_app decorator.
# disable it for now
# CONTEXT_SETTINGS = dict(help_option_names=['-h', '--he... | StarcoderdataPython |
1851114 | <filename>src/boundaryConstraintPSO.py<gh_stars>0
import numpy as np
from mlpy.particleSwarmOptimization.pso import PSO
np.set_printoptions(suppress=True)
class BoundaryConstraintPSO(PSO):
def __init__(self):
super(BoundaryConstraintPSO, self).__init__()
self.boundaryConstraint = None
def ... | StarcoderdataPython |
1666509 | from models.Model import Model
import numpy as np
from sklearn.model_selection import GridSearchCV
from sklearn import svm
class SVM(Model):
def __init__(self, params):
self.params = params
self.featureList = []
self.acc = -1
# used for the name of the prediction file
self... | StarcoderdataPython |
6535592 | <filename>src/pypgmc/expression_utils.py
'''
@author: londenberg
'''
import theano.tensor as T
def mul_op(a, b):
return a*b
def add_op(a,b):
return a+b
def LogSumExp(x, axis=None, keepdims=True):
''' Numerically stable theano version of the Log-Sum-Exp trick'''
x_max = T.max(x, axis=axis, keepdims=T... | StarcoderdataPython |
4993092 | <reponame>sanyaade-teachings/cep<filename>src/curt/curt/modules/vision/oakd_processing.py
"""
Copyright (C) Cortic Technology Corp. - All Rights Reserved
Written by <NAME> <<EMAIL>>, 2021
"""
from curt.modules.vision.base_vision_processing import BaseVisionProcessing
import logging
class OAKDProcessingWorker(BaseVi... | StarcoderdataPython |
3347981 | <gh_stars>1-10
import functools
from PyQt5 import QtWidgets as widgets
import numpy as np
from matplotlib import cm
def make_color_map(labels):
unique_labels = sorted(np.unique(labels))
n_labels = len(unique_labels)
return dict(
(label, cm.gist_ncar(idx / n_labels))
for idx, label in enum... | StarcoderdataPython |
9767150 | BUFFER_SIZE = 1024
# methods
PUT = "PUT"
QUERY = "QUERY"
GET = "GET"
DELETE = "DELETE"
# messages
OK = "OK"
ERROR = "ERROR"
WARNING = "WARNING"
SUCCESS = "SUCCESS"
NOT_FOUND = "NOT_FOUND"
ALREADY_EXISTS = "ALREADY_EXISTS"
BAD_SYNTAX = "BAD_SYNTAX"
REPLICA_IS_DOWN = "REPLICA_IS_DOWN"
CANNOT_GUARANTEE_CORRECT_OUTPUT ... | StarcoderdataPython |
9650122 | <gh_stars>0
import os
import json
import sys
import requests
from urllib.parse import urlparse
from subprocess import run, Popen, PIPE
from datetime import datetime, timedelta
from progressbar import progressbar
from py_dataset import dataset
def download_file(url):
fname = url.split("/")[-1]
r = requests.ge... | StarcoderdataPython |
338003 | import decimal
def half_round(num, fmt):
"""
decimal_round(0.1235, '1.0') == 0.0
decimal_round(0.1235, '0.1') == 0.1
decimal_round(0.1235, '0.01') == 0.12
decimal_round(0.1235, '0.001') == 0.124
decimal_round(0.1235, '0.0001') == 0.1235
"""
if fmt.find('.') >= 0:
# Float
... | StarcoderdataPython |
8147122 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@_ambonilla 2014
Using cocos & piglet libraries, is a small counter program
where when you push the up key it will add a number to the
displayed value, and the down key will substract one
"""
import cocos
import sys
from cocos.actions import *
import... | StarcoderdataPython |
1888990 | import os
import cv2
import glob
import numpy as np
import pickle
from writeKandDistC import writeKandDistNPZ
# Interactively capture images for calibration and store them in the given directory
def capture_calibration_images(camera_port, chessboard_size, save_directory):
assert (os.path.exists(save_directory))
... | StarcoderdataPython |
12836479 | from JumpScale import j
j.base.loader.makeAvailable(j, 'tools')
from Sandboxer import Sandboxer
j.tools.sandboxer = Sandboxer()
| StarcoderdataPython |
6412659 | <filename>user/migrations/0010_auto_20200924_1023.py<gh_stars>0
# Generated by Django 3.1 on 2020-09-24 10:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency... | StarcoderdataPython |
6600930 | #!/usr/bin/env python3
import random
from pyqti.qti import Qti
from pyqti.item import Section, Essay, Kprim
# Create a new section
pasta = Section("Recipes")
# Generate three essay questions, 10 points each
for i, p in enumerate(["Spaghetti", "Penne", "Linguine"], 1):
item = Essay(10, p,
f"""<p>Share y... | StarcoderdataPython |
98360 | <filename>6 semester/Computer graphics/lab6.9.py
show_process = False
iterations = 500
import turtle
if not show_process:
turtle.tracer(0)
for i in range(500):
turtle.forward(i)
turtle.left(91)
turtle.update()
turtle.exitonclick()
| StarcoderdataPython |
171300 | def test_test_suite():
assert True
| StarcoderdataPython |
247499 | from flask.ext.script import Shell, Manager
from collabo import create_app
app = create_app()
manager = Manager(app)
def make_shell_context():
return dict(app=app)
manager.add_command("shell", Shell(make_context=make_shell_context))
if __name__ == "__main__":
manager.run()
| StarcoderdataPython |
1831951 | from unittest import TestCase
from unittest.mock import patch, Mock
from oxygen import BaseHandler, OxygenLibrary
from oxygen.errors import OxygenException
from ..helpers import get_config_as_file
class TestOxygenLibrary(TestCase):
EXPECTED_KEYWORDS = ('run_junit', 'run_gatling', 'run_zap')
def setUp(self):... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.