id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
3400620 | <reponame>ihalseide/brick-rain
#!/usr/bin/env python3
import pygame
import sys
import random
import time
from base_scene import BaseScene
from game_over_scene import GameOverScene
from piece import Piece, SHAPES, COLORS
from game_resources import IMAGES, SOUNDS
from clouds import Cloud
BOX_SIZE = 20 # how big each s... | StarcoderdataPython |
1820397 | <reponame>ollien/Screenshot-Uploader
class ConfigReader():
def __init__(self,name="config.txt"):
self.keys={}
self.name = name
#Read Keys from file
def readKeys(self):
keysFile=open(self.name,"r")
fileLines=keysFile.readlines()
keysFile.close()
self.keys.clear... | StarcoderdataPython |
4808527 | <filename>tests/sensor/test_bno055.py
import time
import unittest
import pigpio
from pisat.handler import PigpioI2CHandler
from pisat.sensor import Bno055
from pisat.tester.sensor import SensorTestor
ADDRESS_BNO055 = 0x28
class TestBNO055(unittest.TestCase):
def setUp(self) -> None:
pi = pigpio... | StarcoderdataPython |
11201182 | __version__ = '0.6'
from .antenna import *
from .topica import TopicaResult
from .digital_twin import DigitalTwin
| StarcoderdataPython |
8120301 | <reponame>pavlanovak/Iskanje-besed-UVP
<<<<<<< HEAD
PRAVILNO_MESTO_IN_CRKA = 'x'
NEPRAVILO_MESTO_IN_CRKA = '-'
=======
>>>>>>> 80858d2af68bead28a54e3714cc7cd06b1d21285
import random
import json
<<<<<<< HEAD
class Igra:
def __init__(self, beseda, ugibanja, stanje, tocke):
self.beseda = beseda
sel... | StarcoderdataPython |
5152498 | """Abstract Handler with helper methods."""
from clang.cindex import CursorKind, TypeKind
from ctypeslib.codegen import typedesc
from ctypeslib.codegen.util import log_entity
import logging
log = logging.getLogger('handler')
class CursorKindException(TypeError):
"""When a child node of a VAR_DECL is parsed as... | StarcoderdataPython |
4929451 | <filename>tests/vendin_machine/test_vending_machine.py
import pytest
from vending_machine.hoge.vending_machine import VendingMachine
# 自販機に金額を投入できることを確認するテスト
def test_insert_money():
vending_machine = VendingMachine()
vending_machine.insert(100)
# 【Vending Machineの機能】10円、100円、XX
## テスト内容:指定された金額は受け入れて、それ以外は... | StarcoderdataPython |
3585720 | # Generated by Django 4.0.1 on 2022-01-19 05:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('management', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='employee',
name='emp_id',
... | StarcoderdataPython |
5027374 | from appversion.views import VersionAPIView
from django.conf.urls import url
from ifns.views import GetIfnsRequisitesByCode
urlpatterns = [
url(
r'^get_ifns_requisites_by_code/(?P<code>[A-Za-z0-9]+)/$',
GetIfnsRequisitesByCode.as_view(),
name='get_ifns_requisites_by_code'
),
url(r'... | StarcoderdataPython |
6549041 | def diagonals_inds(dim: int, size: int) -> List[Tuple]:
# e.g. if 2 dimension and size = 3
# 1,1 : 3,3
# 1,3 : 3,1
# 3,1 : 1,3
# 3,3 : 1,1
# get a list of all corners that with 0 index in first dimension
corners_all = it.product([0, size - 1], repeat = dim)
corners_0 = [corner for... | StarcoderdataPython |
144317 | <reponame>shivp950/InnerEye-DeepLearning
# ------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# --------------------------... | StarcoderdataPython |
8002146 | <gh_stars>10-100
import concurrent
import geocoder
import json
import s3fs
import pandas as pd
import urllib
import logging
import os
from datetime import datetime
from sqlalchemy import create_engine
import zlib
from itertools import zip_longest
import time
FORMAT = '%(asctime)-15s %(levelname)-6s %(message)s'
DATE_... | StarcoderdataPython |
89624 | <gh_stars>0
import subprocess
import click
@click.command()
def cli():
"""
Stop all services.
:return: Subprocess call result
"""
cmd = 'pkill honcho && docker-compose stop'
return subprocess.call(cmd, shell=True)
| StarcoderdataPython |
381011 | <filename>20211202/4.py
# [0: icID, 1: cardType, 2:tradeType, 3: UpLine, 4: UpTime, 5: UpStation,
# 6: DownLine, 7: DownTime, 8: DownStation]
import time
data_file = r"20211202\Subway_20180301\Subway_20180301.txt"
# data_file = r"20211202\Subway_20180301\Subway_20190301_top100000.txt"
# data_file = "test.txt"
out_fi... | StarcoderdataPython |
9776790 | number = list(map(int, input().strip().split()))
ss = ".|."
string = "WELCOME"
num2, num3 = 1, number[0] - 2
for num in range(1, number[0] + 1):
if int((number[0] - 1) / 2) > num - 1:
print("-" * int((number[1] - (len(ss) * num2)) / 2) + ss * (1 * num2) + "-" * int((number[1] - (len(ss) * num2)) / 2))
... | StarcoderdataPython |
1645375 | stages = ['''
+---+
| |
O |
/|\ |
/ \ |
|
=========
''', '''
+---+
| |
O |
/|\ |
/ |
|
=========
''', '''
+---+
| |
O |
/|\ |
|
|
=========
''', '''
+---+
| |
O |
/| |
|
|
=========''', '''
+---+
| |
O |
| |
|... | StarcoderdataPython |
11399935 | <gh_stars>1-10
from transformers import AutoTokenizer, DataCollatorWithPadding
import torch
import pytorch_lightning as pl
from torch.utils.data import DataLoader
import datasets
from loguru import logger
from typing import List, Union, Dict
from functools import partial
def _collate_fn(features, tokenizer: AutoToken... | StarcoderdataPython |
3292046 | """
Every valid email consists of a local name and a domain name, separated by the '@' sign. Besides lowercase letters, the email may contain one or more '.' or '+'
find the unique email addresses
"""
from typing import List
class Solution:
def numUniqueEmails(self, emails: List[str]) -> int:
def validemai... | StarcoderdataPython |
111234 | <filename>aiida/orm/implementation/django/calculation/job/__init__.py
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. ... | StarcoderdataPython |
1896290 | <gh_stars>1-10
a = float(input('Digite o valor da 1° reta: '))
b = float(input('Digite o 2º valor: '))
c = float(input('Digite o 3° valor: '))
# | b - c | < a < b + c
# | a - c | < b < a + c
# | a - b | < c < a + b
if b - c < a < b + c:
if a - c < b < a + c:
if a - b < c < a + b:
... | StarcoderdataPython |
8045464 | <gh_stars>1000+
# Copyright 2019 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.
"""Contains common helpers for working with Android manifests."""
import hashlib
import os
import re
import shlex
import sys
import xml.dom.... | StarcoderdataPython |
3287550 | <filename>ib2/settings.py<gh_stars>1-10
"""
Django settings for ib2 project.
Generated by 'django-admin startproject' using Django 2.2.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en... | StarcoderdataPython |
6529632 | n, k = map(int,input().split())
num = list(map(int,input().split()))
c = 0
for i in range(0,n):
for j in range(0,n):
if i!=j:
if (num[i]+num[j])%k == 0:
c+=1
print(c//2) | StarcoderdataPython |
163045 | <reponame>ShunranSasaki/furport-back
# Generated by Django 3.0.8 on 2020-07-08 05:28
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL... | StarcoderdataPython |
6415414 | <reponame>xpsurgery/customer-base<gh_stars>1-10
class CustomerBase:
def __init__(self):
self.customers = []
def add(self, customer):
self.customers.append(customer)
def findByLastName(self, lastName):
result = []
for customer in self.customers:
if customer.last... | StarcoderdataPython |
1710057 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2019 Nokia
#
# 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... | StarcoderdataPython |
11272723 | #!/usr/bin/python
# Find the minimum-area bounding box of a set of 2D points
#
# The input is a 2D convex hull, in an Nx2 numpy array of x-y co-ordinates.
# The first and last points points must be the same, making a closed polygon.
# This program finds the rotation angles of each edge of the convex polygon,
# then t... | StarcoderdataPython |
315162 | """
希尔排序
2020-12-06: 11:02.30;
"""
from sort import validatetool
def sort(data):
l = len(data)
gap = l // 2
while gap > 0:
for i in range(gap, l):
val = data[i]
j = i - gap
while j >= 0 and val < data[j]:
data[j + gap] = data[j]
j... | StarcoderdataPython |
8123819 | from pyramid.config import Configurator
from pyramid.response import Response
from time import sleep
from waitress import serve
def see_home(request):
return Response('''\
<html>
<head>
</head>
<body>
<div id="ping"></div>
<div id="x"></div>
<script>
const eventSource = new EventSource('/echoes')
eventSou... | StarcoderdataPython |
3564636 | <reponame>br-paypaldev/Donate<gh_stars>0
import re
from django.conf import settings
from django.conf.urls.defaults import patterns, url, include
from django.core.exceptions import ImproperlyConfigured
urlpatterns = []
# only serve non-fqdn URLs
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^(?P<pat... | StarcoderdataPython |
3520569 | from datetime import datetime
from django import template
from handypackages.datetime_conv import fmt
register = template.Library()
@register.filter(name="persian_datetime")
def datetime_conv(date_time, string_format="%y/%m/%d %h:%M:%s"):
"""
Convert datetime to persian datetime
example(datetime=dateti... | StarcoderdataPython |
4938124 | # Copyright The PyTorch Lightning team.
#
# 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 i... | StarcoderdataPython |
6496531 | <reponame>whitfin/spack<filename>var/spack/repos/builtin/packages/muster/package.py
# Copyright 2013-2019 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 import *
class Muster(CMa... | StarcoderdataPython |
381027 | from typing import List
class Solution:
def peakIndexInMountainArray(self, arr: List[int]) -> int:
def bin_search(low, hi):
mid = low + int((hi - low)/2)
if arr[mid] > arr[mid-1] and arr[mid] > arr[mid+1]:
return mid
elif arr[mid] > arr[mid-1]:
... | StarcoderdataPython |
8100443 | # Generated by Django 2.2.1 on 2019-05-21 19:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('professors', '0007_auto_20190522_0110'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='communi... | StarcoderdataPython |
3351033 | <filename>tests/local/test_argument.py
import sys
from unittest.mock import patch
import pytest
from mnamer.argument import ArgLoader
from mnamer.setting_spec import SettingSpec
from mnamer.types import SettingType
pytestmark = pytest.mark.local
@pytest.mark.parametrize(
"settings_type",
(SettingType.DIREC... | StarcoderdataPython |
329855 | <filename>pygate_grpc/client.py
import grpc
from pygate_grpc import buildinfo, faults, ffs, health, net, wallet
from pygate_grpc.errors import ErrorHandlerMeta
class PowerGateClient(object, metaclass=ErrorHandlerMeta):
def __init__(self, host_name, is_secure=False):
self.channel = (
grpc.secu... | StarcoderdataPython |
9753859 | from unittest import TestCase
import rerldo
class TestYup(TestCase):
def test_is_string(self):
s = rerldo.yup()
self.assertTrue(isinstance(s, str)) | StarcoderdataPython |
6564290 | <filename>utils/errors.py<gh_stars>0
from typing import Any, Union
from discord.ext import commands
class UserInputErrors(commands.UserInputError):
def __init__(self, message: str, *arg: Any):
super().__init__(message=message, *arg) | StarcoderdataPython |
362519 | <gh_stars>0
# Generated by Django 3.0.5 on 2020-09-21 12:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('user', '0019_user_review'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='review',
)... | StarcoderdataPython |
4914111 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class DeviceInfo(object):
def __init__(self):
self._device_id = None
self._device_type = None
self._dv_sn = None
self._manufacturer = None
self._product_model = ... | StarcoderdataPython |
11386941 | # coding=utf-8
from unittest import TestCase
from zeeguu.api.test.api_test_mixin import APITestMixin
from zeeguu.api.api.feeds import (
STOP_FOLLOWING_FEED,
FOLLOWED_FEEDS,
START_FOLLOWING_FEED,
INTERESTING_FEEDS,
RECOMMENDED_FEEDS,
)
from zeeguu.core.model import RSSFeedRegistration
from zeeguu.... | StarcoderdataPython |
29638 | <reponame>Sofia190/book_store_app<gh_stars>0
from django.db import models
# Create your models here.
from django.conf import settings
from django.db import models
from django.utils import timezone
# Create your models here.
class SearchQuery(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, b... | StarcoderdataPython |
6688755 | from .voc import VOCSegmentation, VOCSegmentationIncremental
from .ade import AdeSegmentation, AdeSegmentationIncremental
from .isprs import VaihingenDataset, PotsdamDataset, VaihingenIncremental, PotsdamIncremental
| StarcoderdataPython |
4961050 | <reponame>dmakhno/contrib-python-qubell-client<filename>qubellclient/tests/base.py
# Copyright (c) 2013 Qubell Inc., http://qubell.com
#
# 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... | StarcoderdataPython |
11325624 | import json
from .api_detail import APIDetail
class File(APIDetail):
def __init__(self, session, node=None, location=None, name=None, data=None, wb_data=None, auth=None):
super().__init__(session=session, data=data)
if wb_data is not None:
self._update_from_wb(wb_data=wb_data, auth=aut... | StarcoderdataPython |
1817187 | <reponame>HIT-SCIR-xuanxuan/OpenKS
#!/usr/bin/env python
# encoding: utf-8
# File Name: graph_encoder.py
# Author: <NAME>
# Create Time: 2019/12/31 18:42
# TODO:
import dgl
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl.nn.pytorch import Set2Set
from ...model import TorchModel
from .gat i... | StarcoderdataPython |
1870088 | from asyncmqtt import MQTTException
from asyncmqtt.packet import MQTTFixedHeader, MQTTVariableHeader, MQTTPayload, MQTTPacket, SUBACK, PacketIDVariableHeader
from asyncmqtt.util import *
class SubackPayload(MQTTPayload):
RETURN_CODE_00 = 0x00
RETURN_CODE_01 = 0x01
RETURN_CODE_02 = 0x02
RETURN_CODE_80 ... | StarcoderdataPython |
168952 | <gh_stars>0
import numpy as np
import theano
import theano.tensor as T
from data import noteStateSingleToInputForm
class OutputFormToInputFormOp(theano.Op):
# Properties attribute
__props__ = ()
def make_node(self, state, time):
state = T.as_tensor_variable(state)
time = T.as_tensor_vari... | StarcoderdataPython |
11290500 | <filename>tests/test_middleware.py
import django
from django.core.cache import cache
from django.contrib.auth.models import AnonymousUser, User, Group
from django.test import TestCase
from mock import Mock
import mock
from groups_cache.compat import is_authenticated
from groups_cache.middleware import GroupsCacheMiddle... | StarcoderdataPython |
1774548 | """
get/put functions that consume/produce Python lists using Pickle to serialize
"""
from __future__ import absolute_import
from .compatibility import pickle
from .encode import Encode
from functools import partial
def concat(lists):
return sum(lists, [])
Pickle = partial(Encode,
partial(pickl... | StarcoderdataPython |
382817 | #1. Import libraries:
!pip install keras-bert
!pip install bert-tensorflow
import sys
import codecs
import numpy as np
from bert import tokenization
from keras_bert import load_trained_model_from_checkpoint
from keras.models import Model
from keras import layers
from keras.layers import Input, Dense, BatchNormaliza... | StarcoderdataPython |
1758751 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Skills
- SkillLine.dbc
- SkillLineAbility.dbc (spell lookups)
"""
from .. import *
from ..globalstrings import *
class Skill(Model):
@classmethod
def getTypeText(self):
return {
self.MINOR: MINOR_GLYPH,
self.MAJOR: MAJOR_GLYPH,
self.PRIME: PRIME_GLYPH,
}.ge... | StarcoderdataPython |
3428574 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import numpy as np
from ..constants import Constants
from .observatory import Observatory
__all__ = ["SDSS"]
c = Constants.LIGHTSPEED
class SDSS(Observatory):
def __init__(self):
super().__init__(
name="Sloan Digital Sky Survey"... | StarcoderdataPython |
3470701 | <reponame>KaShing96/hackerrank-challenges
# === Imports ===
import pytest
import json
import os
import functions as fnc
from func_timeout import func_timeout as to
from func_timeout.exceptions import FunctionTimedOut
from datetime import datetime
from colorama import Fore
from colorama import Style
# === Constants... | StarcoderdataPython |
5025458 | from uia import scrape, unidata
from time import sleep
import pickle
from os import path
from datetime import datetime
from dateutil.relativedelta import relativedelta
PICKLE_DIR = 'pickles/'
studies = unidata.studies
# lazy prototyping means infinite loops instead of cronjobs
while True:
for study in studies:
... | StarcoderdataPython |
3568896 | #load packages
from xml.etree import cElementTree as ET
import uuid
import os
import json
import sys
'''
get relevant xml attributes and convert to dictonary
:param root: xml root for image
:return: obs: dictionary for one annotation from the image
'''
def get_attributes(root, labels):
for object in root.findall... | StarcoderdataPython |
6509182 | # -*- coding: utf-8 -*-
from .utils import fetch_menicka, parse_menicka
NAME = "<NAME>"
URL = "https://www.menicka.cz/5335-spravne-misto.html"
RESTAURANT_ID = "5335"
def parse_menu():
menicka_html = fetch_menicka(RESTAURANT_ID)
return parse_menicka(menicka_html)
| StarcoderdataPython |
5197328 | # -*- coding: utf-8 -*-
"""Exception classes."""
class APISpecError(Exception):
"""Base class for all apispec-related errors."""
pass
class PluginError(APISpecError):
"""Raised when a plugin cannot be found or is invalid."""
pass
class SwaggerError(APISpecError):
"""Raised when a swagger validati... | StarcoderdataPython |
11240994 | <reponame>dashhudson/go-links<filename>server/src/migrations/versions/1_11880ac0ca4a_add_lookup_key.py
"""Add lookup key
Revision ID: 11880ac0ca4a
Revises: <KEY>
Create Date: 2020-08-05 22:52:17.165548
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '11880ac0ca... | StarcoderdataPython |
3567591 | from django.db.backends.postgresql.schema import DatabaseSchemaEditor
class SchemaDatabaseSchemaEditor(DatabaseSchemaEditor):
def _create_fk_sql(self, model, field, suffix):
"""Support of our hackish foo\".\"bar table names on FK.
Base copy/paste of base _create_fk_sql with character replacement... | StarcoderdataPython |
11365087 | # coding: utf-8
# Author: <NAME>
# Contact: <EMAIL>
# Python modules
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import QThread, pyqtSignal
import time
# Wizard modules
from wizard.core import environment
from wizard.core import repository
from wizard.core import launch
from wizard.core import image
... | StarcoderdataPython |
1820589 | <filename>exerc3_sec6.py<gh_stars>1-10
print("CONTAGEM REGRESSIVA:")
n = 10
while n > 0:
print(n,"!")
n = n - 1
print("FIM!") | StarcoderdataPython |
11384961 | from .login import LoginForm # noqa | StarcoderdataPython |
3586972 | <gh_stars>0
import unittest
from pyiron.lammps.control import LammpsControl
class TestLammps(unittest.TestCase):
def test_generate_seed_from_job(self):
lc = LammpsControl()
job_hash_dict = {'job_0_0': lc.generate_seed_from_job(job_name='job_0', seed=0),
'job_0_1': lc.gener... | StarcoderdataPython |
1799261 | <reponame>RiccardoVaccari/Groovy2.0
from src.database.model import DiscordServer, Track, Radio
from pony.orm import db_session, select
class Server:
@db_session
def __init__(self, guild):
self.id = str(guild.id)
self.name = guild.name
if not self.get():
new_server ... | StarcoderdataPython |
6652747 | """
File: Runner.py
License: Part of the PIRA project. Licensed under BSD 3 clause license. See LICENSE.txt file at https://github.com/jplehr/pira/LICENSE.txt
Description: Module to run the target software.
"""
import sys
sys.path.append('..')
import lib.Utility as U
import lib.Logging as L
import lib.FunctorManageme... | StarcoderdataPython |
9668199 | # Grafiek positief getest naar leeftijd door de tijd heen, per leeftijdscategorie
# <NAME>, (@rcsmit) - MIT Licence
# IN: tabel met positief aantal testen en totaal aantal testen per week, gecategoriseerd naar leeftijd
# handmatig overgenomen uit Tabel 14 vh wekelijkse rapport van RIVM
# Wekelijkse update epid... | StarcoderdataPython |
9752967 | <filename>metpy/calc/thermo.py<gh_stars>1-10
# Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import division
import numpy as np
import scipy.integrate as si
from ..package_tools import Exporter
from ..constan... | StarcoderdataPython |
6554562 | <reponame>karolyi/forum-django
from django.urls.conf import path
from .views.frontend import (
TopicCommentListingView, TopicExpandCommentsDownView,
TopicExpandCommentsUpView, TopicExpandRepliesUpRecursive, TopicListView)
urlpatterns_base = [
path(route=r'', view=TopicListView.as_view(), name='topic-listi... | StarcoderdataPython |
47260 | tutor = "codi"
print(tutor)
| StarcoderdataPython |
5078709 | # Copyright (c) 2019 Works Applications Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
6572120 | <gh_stars>0
import datetime
import boto3
import botocore
import os
import re
def find_tag(key, tags):
return next((tag['Value'] for tag in tags if tag['Key'] == key), None)
def ipv4_ptr_fqdn(address):
return '%s.in-addr.arpa.' % ('.'.join(reversed(address.split('.'))))
def ipv4_amazon_name(address):
retu... | StarcoderdataPython |
9705508 | from .progeny import *
| StarcoderdataPython |
9763081 | #!/usr/bin/env python
from __future__ import print_function
import unittest
from ruffus import transform, Pipeline, pipeline_run, regex, inputs
import ruffus
import sys
"""
test_inputs_with_multiple_args_raising_exception.py
inputs with multiple arguments should raise an exception
"""
import os
tempdi... | StarcoderdataPython |
3437031 | from problem.models import Problem
from .models import CodeforcesProblemSet
def get_parent(problem):
try:
return CodeforcesProblemSet.objects.get(child=problem).parent
except:
return problem
def check(problem1, problem2):
return get_parent(problem1).id == get_parent(problem2).id
def jo... | StarcoderdataPython |
207416 | """
# Utilities that aid in the design and analysis of piping networks
"""
from lib.pypeflow.utils.pump_curve import PumpCurve
| StarcoderdataPython |
1725813 | <filename>djexperience/service/admin.py
from django.contrib import admin
from .models import Service, TypeService, Protest
@admin.register(Service)
class ServiceAdmin(admin.ModelAdmin):
list_display = ('__str__', )
search_fields = ('title',)
@admin.register(TypeService)
class TypeServiceAdmin(admin.ModelAdm... | StarcoderdataPython |
21380 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Tests for utility classes."""
import datetime
import sys
import unittest
from absl import app
from absl.testing import absltest
from grr_response_core.lib import rdfvalue
from grr.test_lib import test_lib
long_string = (
"迎欢迎\n"
"Lorem ipsum dolor sit amet... | StarcoderdataPython |
342463 | <gh_stars>0
# defines a function that takes two arguments
def cheese_and_crackers(cheese_count, boxes_of_crackers):
# prints a string with the first argument passed into the function inserted into the output
print(f"You have {cheese_count} cheeses!")
# prints a string with the second argument passed into th... | StarcoderdataPython |
6563162 | <reponame>Halftruth08/Game_AI<filename>demo1.py
#demo 1: in command line, enter:
# python3 demo1.py
import codenames.model_building as cmb
model = cmb.make_full_model()
import codenames.game_player as cgp
cgp.codemaster(model)
| StarcoderdataPython |
3371070 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 9 17:02:59 2018
@author: bruce
"""
import pandas as pd
import numpy as np
from scipy import fftpack
from scipy import signal
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
def correlation_ma... | StarcoderdataPython |
4978584 | image_extensions = (
'3fr', 'ari', 'arw', 'bay', 'bmp', 'cap', 'cr2', 'cr3', 'crw',
'dcr', 'dcs', 'dds', 'dib', 'dng', 'drf', 'eip', 'emf', 'erf',
'fff', 'gif', 'ico', 'ief', 'iiq', 'jfif', 'jpe', 'jpeg', 'jpg',
'jxr', 'k25', 'kdc', 'mef', 'mos', 'mrw', 'nef', 'nrw', 'orf',
'ori', 'pbm', 'pef', ... | StarcoderdataPython |
3255980 | <filename>openbook_posts/management/commands/migrate_post_images.py
from django.core.management.base import BaseCommand
import logging
from django.db import transaction
from openbook_common.utils.model_loaders import get_post_model, get_post_media_model
logger = logging.getLogger(__name__)
class Command(BaseComma... | StarcoderdataPython |
131400 | <gh_stars>1-10
"""Init file for backend App"""
# pylint: disable=invalid-name
import sys
import logging
import redis
from logging.handlers import RotatingFileHandler
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_bootstrap import WebCDN
from flask_sqlalchemy import SQLAlchemy
from flask_login... | StarcoderdataPython |
1876099 | <filename>dcms/media/views.py
from rest_framework import views, viewsets
from rest_framework.parsers import FileUploadParser
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework.response import Response
from rest_framework import status
from config.authentication import default_authenti... | StarcoderdataPython |
4818964 | <filename>eit_app/test_cam.py
import cv2
frameWeight = 640
frameHeight = 480
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
cap.set(3, frameWeight)
cap.set(4, frameHeight)
cap.set(10, 150)
while cap.isOpened():
success, img = cap.read()
if success:
cv2.imshow("Result", img)
if cv2.waitKey(1) & 0xFF ... | StarcoderdataPython |
3520153 | <reponame>evinus/My-appproch-One<gh_stars>0
from scipy.stats.stats import mode
import tensorflow.keras as keras
from tensorflow.python.keras import activations
#from tensorflow.python.keras import callbacks
import metrics as met
import cv2
import os
import numpy as np
from sklearn.model_selection import train_test_spl... | StarcoderdataPython |
9778183 | <gh_stars>0
from __future__ import annotations
from math import log, sqrt
from typing import Dict, Optional, Tuple
import parameters
class TreeNode:
player_reward = {
1: 1,
2: -1
}
def __init__(self, state: Tuple[int, ...], parent: Optional[TreeNode] = None) -> None:
self.state... | StarcoderdataPython |
9752073 | import os
import csv
class Formatter():
DEL_COM = ','
LINE_LF = '\n'
UTF_8 = 'utf-8'
DBL_QUOTE = '"'
def __init__(self, *args, **kwargs):
"""
delimiter: delimiter of column
line_sep: separater of line as record
"""
self.delimiter = kwargs['delimiter'] if 'de... | StarcoderdataPython |
8079626 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 12 07:10:48 2019
@author: gbrunkhorst
"""
import gbxltable
| StarcoderdataPython |
11332096 | <filename>website_multi_company_sale/__manifest__.py
# Copyright 2017-2018 <NAME> <https://it-projects.info/team/yelizariev>
# Copyright 2018 <NAME> <https://it-projects.info/team/ilmir-k>
# Copyright 2018 <NAME> <https://it-projects.info/team/iledarn>
# Copyright 2019 <NAME> <https://it-projects.info/team/KolushovAlex... | StarcoderdataPython |
299815 | def login():
return 'login info'
a = 18
num1 = 30
num2 = 10
num2 = 20
| StarcoderdataPython |
3381420 | <gh_stars>10-100
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
$ python setup.py register sdist upload
First Time register project on pypi
https://pypi.org/manage/projects/
Pypi Release
$ pip3 install twine
$ python3 setup.py sdist
$ twine upload dist/keri-0.0.1.tar.gz
Create release git:
$ git tag -a v0.4.2... | StarcoderdataPython |
3432589 | <reponame>ciaranjordan/webex_bot
import logging
from abc import ABC, abstractmethod
log = logging.getLogger(__name__)
CALLBACK_KEYWORD_KEY = 'callback_keyword'
class Command(ABC):
def __init__(self, command_keyword, card, help_message=None, delete_previous_message=False):
self.command_keyword = command_... | StarcoderdataPython |
229799 | <gh_stars>0
# Copyright 2015 Metaswitch Networks
#
# 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 ag... | StarcoderdataPython |
9795093 | from glowworm import gso
from deap import benchmarks
if __name__ == '__main__':
def fitness(candidate):
# return 1/(benchmarks.schwefel(candidate)[0]+1)
return 1/(benchmarks.ackley(candidate)[0]+1)
gso(agents_number=80, dim=10, func_obj=fitness, epochs=300, step_size=0.5, random_step =True, virtual_individual ... | StarcoderdataPython |
6472064 | import pytest
from adlib27.autodiff import AutoDiff as AD
import numpy as np
# Testing the getters and setters
def test_getters():
x = AD(val=[10])
value = x.val
derivative = x.der
assert value == pytest.approx([10], rel=1e-4)
for d in derivative:
assert d == pytest.approx([1])
def test_s... | StarcoderdataPython |
5198883 | # Generated by Django 2.2.11 on 2020-05-30 16:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("patients", "0011_auto_20200530_2150"),
]
operations = [
migrations.RemoveField(model_name="patient", name="patient_search_id",),
]
| StarcoderdataPython |
237837 | <filename>gui/ui/interbasin_dialog.py<gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\interbasin_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.