id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3327812 | from sqlalchemy import Boolean, Column, LargeBinary, Integer, String
from sqlalchemy.orm import relationship
from database_schemas.base import Base
class UserEntry(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, autoincrement=True)
username = Column(String, unique=True, index=True)... | StarcoderdataPython |
4828424 | import numpy as np
import pandas as pd
import os
from urbansim_defaults import datasources
from urbansim_defaults import utils
from urbansim.utils import misc
import orca
from utils import geom_id_to_parcel_id, parcel_id_to_geom_id
from utils import nearest_neighbor
#####################
# TABLES AND INJECTABLES
####... | StarcoderdataPython |
158220 | # Generated by Django 3.1.2 on 2020-10-12 20:33
import ckeditor.fields
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Categ... | StarcoderdataPython |
3320947 | import numpy as np
import matplotlib.pyplot as plt
from ftocp import FTOCP
from map import MAP
from riccati_sols import double_integrator_params
from unicycle import Unicycle
import signal
import time
import traceback
# allow Ctrl-C to work despite plotting
signal.signal(signal.SIGINT, signal.SIG_DFL)
# ==========... | StarcoderdataPython |
1711926 | <gh_stars>1000+
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 8 20:54:15 2017
@author: DIP
@Copyright: <NAME>
"""
import numpy as np
# prints components of all the topics
# obtained from topic modeling
def print_topics_udf(topics, total_topics=1,
weight_threshold=0.0001,
... | StarcoderdataPython |
165251 | # <NAME>
# Solution to https://www.urionlinejudge.com.br/judge/problems/view/1197
# -*- coding: utf-8 -*-
while True:
try:
a,b = [int(i) for i in raw_input().split(" ")]
print 2*a*b
except EOFError:
break
| StarcoderdataPython |
124755 |
"""
Copyright thautwarm (c) 2019
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the foll... | StarcoderdataPython |
3253180 | import functools
import contextlib
def to_decorator(wrapped_func):
"""
Encapsulates the decorator logic for most common use cases.
Expects a wrapped function with compatible type signature to:
wrapped_func(func, args, kwargs, *outer_args, **outer_kwargs)
Example:
@to_decorator
def foo(... | StarcoderdataPython |
3326427 | #Desafio 31
distancia = float(input('\033[0;35mqual é a distância da sua viagem? '))
print('\033[0;31mVocê está prestes a começar uma viagem de {:.0f}km'.format(distancia))
preco = (distancia * 0.50)
preco2 = (distancia * 0.45)
if distancia <= 200:
print('\033[0;35msua passagem custará \033[0;33mR${:.2f}'.format(pr... | StarcoderdataPython |
183534 | #!/usr/bin/python3
# -*- coding: UTF-8 -*-
import Tools,config,sys, getopt
if __name__ == "__main__":
if len(sys.argv)<3:
print("error")
exit()
op=sys.argv[1]
task_name=sys.argv[2]
if op=="-t":
if task_name=="say_hello":
Tools.send_to_admin("您好,这是一条测试信息")
eli... | StarcoderdataPython |
4805217 | <filename>101_people_counter/main_generate_training_data.py
"main function, entry point for "
import logging
import argparse
import video_source as vs
import frame as f
import contour as c
import cv2
import time
import pickle
import pandas as pd
import datetime
import os
if __name__ == "__main__":
#--------------... | StarcoderdataPython |
1635153 |
from pyPks.Utils.Config import getBoolOffYesNoTrueFalse as getBool
from pyPks.Utils.DataBase import getTableDict
def getMarketsDict( sMarketsTable ):
#
dConverts = dict(
bHasCategories = getBool,
iEbaySiteID = int,
iCategoryVer = int,
iUtcPlusOrMinus = int )
... | StarcoderdataPython |
139071 | <reponame>dlyongemallo/qflex
# Lint as: python3
"""
Provides utils for qFlex.
"""
import numpy as np
import cirq
import re
def ComputeSchmidtRank(gate):
if len(gate.qubits) == 1:
return 1
if len(gate.qubits) > 2:
raise AssertionError("Not yet implemented.")
V, S, W = np.linalg.svd(
... | StarcoderdataPython |
71539 | <reponame>YasinBlackhat/read-file-csv--finde-password-0-10000<gh_stars>1-10
# my lib an valid and dict and list
import csv
lihash_filecsv = dict()
li =[]
lihash=[]
countname = 0
count_csv_hash = 0
d = 1
# read file csv for crack
<<<<<<< HEAD
print('Example Type location : E:\\Land program\\new folder\\2.csv')... | StarcoderdataPython |
3214824 | import re
import sys
import logging
import logging.handlers
from pygments.lexer import RegexLexer, include
from pygments.token import (Punctuation, Text, Comment, Keyword, Name, String,
Generic, Operator, Number, Whitespace, Literal, Error, Token)
from pygments import highlight
from pygments.formatters impor... | StarcoderdataPython |
113289 | <reponame>CuchulainX/dffml
import asyncio
from .asynchelper import concurrently
async def run_command(cmd, logger=None, **kwargs):
r"""
Run a command using :py:func:`asyncio.create_subprocess_exec`.
If ``logger`` is supplied, write stdout and stderr to logger debug.
``kwargs`` are passed to :py:fun... | StarcoderdataPython |
1758810 | <reponame>jumaamohammed/404
import urllib.request as foOfo
import urllib.error as oohhh
import base64, time, socket, os
import subprocess
from subprocess import (PIPE, Popen)
check = ''
ip = '172.16.176.156'
class four0four:
def __init__(self):
self.url = 'http://172.16.176.156/pop.html'
self.opsys = os.name
... | StarcoderdataPython |
143768 | <filename>tests/conftest.py
# Copyright (c) 2021 Food-X Technologies
#
# This file is part of foodx_devops_tools.
#
# You should have received a copy of the MIT License along with
# foodx_devops_tools. If not, see <https://opensource.org/licenses/MIT>.
import copy
import pathlib
import typing
import unittest.mock
... | StarcoderdataPython |
1760052 | <reponame>tbeckham/eutester<gh_stars>0
import unittest
import inspect
import time
import gc
import argparse
import re
import sys
import os
import types
import traceback
import random
import string
from eutester.eulogger import Eulogger
from eutester.euconfig import EuConfig
import StringIO
import copy
from eutester.ti... | StarcoderdataPython |
3259802 | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 4
@author: <NAME>
"""
import random
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
class FrozenLake:
"""Environment of frozen lake.
Attributes:
map_idx: 0 for 4x4 map, 1 for 10x10 map.
"""
... | StarcoderdataPython |
18231 | # Copyright (c) 2016-2018 <NAME>. All rights reserved. A
# copyright license for redistribution and use in source and binary forms,
# with or without modification, is hereby granted for non-commercial,
# experimental and research purposes, provided that the following conditions
# are met:
# - Redistributions of source ... | StarcoderdataPython |
3203724 | <gh_stars>0
import pytest
from sopel.tests import rawlist
from sopel_help import providers
TMP_CONFIG = """
[core]
owner = testnick
nick = TestBot
enable = coretasks, help
[help]
output = local
origin_base_url = https://example.com/sopel/
origin_output_name = help.html
origin_output_dir = /tmp/
"""
CHANNEL_LINE = '... | StarcoderdataPython |
3244924 | <reponame>uhh-lt/SCoT
import csv
FILE_NAMES = [
"gbooks_1520_1908.csv",
"gbooks_1909_1953.csv",
"gbooks_1954_1972.csv",
"gbooks_1973_1986.csv",
"gbooks_1987_1995.csv",
"gbooks_1996_2001.csv",
"gbooks_2002_2005.csv",
"gbooks_2006_2008.csv"
... | StarcoderdataPython |
3270219 | <gh_stars>10-100
"""Sampler classes.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gin
import tensorflow as tf
from robovat.envs.push import heuristic_push_sampler
from networks import samplers
@gin.configurable
class HeuristicPushSampler(s... | StarcoderdataPython |
2802 | <reponame>christiansencq/ibm_capstone
import requests
import json
# import related models here
from .models import CarDealer, DealerReview
from requests.auth import HTTPBasicAuth
import logging
logger = logging.getLogger(__name__)
# Create a `get_request` to make HTTP GET requests
# e.g., response = requests.get(url,... | StarcoderdataPython |
23276 |
from functools import reduce
from itertools import groupby
from operator import add, itemgetter
def merge_records_by(key, combine):
return lambda first, second: {
k: first[k] if k == key else combine(first[k], second[k])
for k in first
}
def merge_list_of_records_by(key, combine):
keypr... | StarcoderdataPython |
3375453 | <gh_stars>1-10
#Ref: https://0x00sec.org/t/get-file-signature-with-python/931
#!/usr/bin/env python
# check_sigs.py - EnergyWolf 2016
# Take a file path as argument, and check it for known file
# signatures using www.filesignatures.net
# pickling the signatures file makes subsequent look ups
# significantly faster
# ... | StarcoderdataPython |
41993 | <reponame>Redaloukil/PackageWay<gh_stars>0
from django.apps import AppConfig
class HelpsAppConfig(AppConfig):
name = "backend.helps"
verbose_name = "Helps"
def ready(self):
try:
import users.signals # noqa F401
except ImportError:
pass | StarcoderdataPython |
1641294 | from __future__ import absolute_import
from sentry.api import client
from sentry.api.bases.group import GroupEndpoint
class GroupEventsLatestEndpoint(GroupEndpoint):
def get(self, request, group):
event = group.get_latest_event()
return client.get('/events/{}/'.format(event.id), request.user, re... | StarcoderdataPython |
155627 | <reponame>ivanlyon/exercises<gh_stars>0
'''
Is there a way to create an sum of a few fixed numbers
Status: Accepted
'''
from collections import deque
###############################################################################
def main():
"""Read input and print output"""
_ = input() # Read past unneces... | StarcoderdataPython |
1666297 | #
# (C) Copyright IBM Corp. 2022
#
# 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 writi... | StarcoderdataPython |
1694227 | <filename>pyleecan/Functions/MeshSolution/build_meshsolution.py
from ...Classes.MeshSolution import MeshSolution
def build_meshsolution(list_solution, list_mesh, label="", dimension=2, group=None):
"""Build the MeshSolution objets from FEMM outputs.
Parameters
----------
field : ndarray
a vec... | StarcoderdataPython |
60161 | """
Middleware for managing internal server errors,
and response with a apt error message
"""
import falcon
class InternalServerErrorManager(object):
"""Middleware for managing internal server errors"""
def process_response(self, request, resp, resource, req_succeeded):
"""
Manages respon... | StarcoderdataPython |
96177 | <reponame>hqman/velruse
"""Bitbucket Authentication Views
http://confluence.atlassian.com/display/BITBUCKET/OAuth+on+Bitbucket
"""
import json
from urlparse import parse_qs
import oauth2 as oauth
import requests
from pyramid.httpexceptions import HTTPFound
from pyramid.security import NO_PERMISSION_REQUIRED
from v... | StarcoderdataPython |
1767685 | # -*- coding: utf-8 -*-
from django import template
from django.http import QueryDict
register = template.Library()
@register.filter
def number_format(number, args=''):
qd = QueryDict(args)
decimals = int(qd['decimals']) if 'decimals' in qd else 0
dec_point = str(qd['dec_point']) if 'dec_point' in qd ... | StarcoderdataPython |
57975 | import re
from collections import namedtuple
from hon.utils.numberutils import to_int_ns
from .preprocessor import Preprocessor
class VariablesPreprocessor(Preprocessor):
"""The variable preprocessor.
The variable preprocessor takes the variables defined in the book's
configuration file, i.e. ``book.yaml... | StarcoderdataPython |
3242346 | # We need the fsac server, which is provided separately. The build process should place the
# required files here.
from FSharp.lib import const
from FSharp.lib.fsac.server import Server
import sublime
_server = None
def get_server():
global _server
if _server is None or not _server.proc.stdin:
if sub... | StarcoderdataPython |
1738181 | # encoding: utf-8
from datetime import datetime
import re
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from django.utils.translation import ugettext as _
from django.db import models
from django.contrib.comments.views.comments import post_comment
from django.http import HttpResp... | StarcoderdataPython |
1674501 | <gh_stars>10-100
from buffalo import utils
utils.init()
from chunk import Chunk
from pluginManager import PluginManager
PluginManager.loadPlugins()
class TestChunk:
def test_init(self):
assert Chunk(0,0) is not None
def test_data(self):
chunk = Chunk(100,100)
assert chunk.data is not None
assert len(chunk... | StarcoderdataPython |
1646758 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ok.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
M... | StarcoderdataPython |
1685123 | <gh_stars>0
import csv
import cv2
import sys
import numpy as np
from keras.models import Sequential
from keras.layers import Flatten, Dense, Lambda, Cropping2D, Dropout
from keras.layers.convolutional import Convolution2D
from keras.models import Model
import matplotlib.pyplot as plt
from sklearn.utils import shuffl... | StarcoderdataPython |
31704 |
"""
Discussion:
Because we have a facilitatory synapses, as the input rate increases synaptic
resources released per spike also increase. Therefore, we expect that the synaptic
conductance will increase with input rate. However, total synaptic resources are
finite. And they recover in a finite time. Therefore, at... | StarcoderdataPython |
109908 | #!/usr/bin/python3
#
# Copyright 2017 <NAME>, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of c... | StarcoderdataPython |
4812004 | #!/usr/bin/python
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_version": "0.1.0",
"status": ["preview"],
"supported_by": "community",
}
DOCUMENTATION = r"""
---
module: launchdarkly_user_segment_sync
short_description: Sync LaunchDar... | StarcoderdataPython |
100380 | import gc
import ctypes
from . import list_methods
from inspect import getmembers, isfunction
def add_method(builtin_class, method_name, method_function):
patchable_builtin_class = gc.get_referents(builtin_class.__dict__)[0]
patchable_builtin_class[method_name] = method_function
ctypes.pythonapi.PyType_... | StarcoderdataPython |
4808434 | from django.contrib import admin
from .models import Team, Player, Role
admin.site.register(Team)
admin.site.register(Player)
admin.site.register(Role)
| StarcoderdataPython |
4801433 | <gh_stars>0
import json
from re import L
from requests.api import get
import logging
from retrieve_config_data import news_apikey
from retrieve_config_data import covid_terms
def news_API_request(covid_terms = covid_terms):
"""argument string
the phrases which to retreive articles with from the api
... | StarcoderdataPython |
3362202 | """
A DXT->PNG converter for the DXT1 Python Codeclub exercise.
@author Romet
"""
from struct import unpack
from PIL import Image
def decode_rgb565(val):
"""Decode a RGB565 uint16 into a RGB888 tuple."""
r5 = (val & 0xf800) >> 11
g6 = (val & 0x7e0) >> 5
b5 = val & 0x1f
return (
int((r5 * ... | StarcoderdataPython |
74391 | <gh_stars>1-10
from cursor import data
from cursor import renderer
from enum import Enum
import wasabi
import inspect
import hashlib
log = wasabi.Printer()
class MinMax:
def __init__(self, minx: int, maxx: int, miny: int, maxy: int):
self.minx = minx
self.maxx = maxx
self.miny = miny
... | StarcoderdataPython |
127810 | import sys
import unittest
import pendulum
from src import (
Crypto,
CryptoCommandService,
)
from minos.networks import (
InMemoryRequest,
Response,
)
from tests.utils import (
build_dependency_injector,
)
class TestCryptoCommandService(unittest.IsolatedAsyncioTestCase):
def setUp(self) -> N... | StarcoderdataPython |
1777596 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# classify_images_into_subfolder.py
# @Date : 02/08/2021
# @Author : garywei944 (<EMAIL>)
# @Link : https://github.com/garywei944
# This script is modified from https://blog.csdn.net/y459541195/article/details/100687966
import numpy as np
import pandas as pd
impor... | StarcoderdataPython |
3350947 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import uuid
import django.utils.timezone
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.Crea... | StarcoderdataPython |
3324529 | #!/usr/bin/env python
######################################################
# -*- coding: utf-8 -*-
# File Name: s3_log_parser.py
# Author: <NAME> & <NAME>
# Created Date: 2017-10-28
# Description: Parse CloudWatch logs
######################################################
import argparse
import json
import os
impor... | StarcoderdataPython |
1613470 | <gh_stars>0
""" OpenstackDriver for Compute
based on BaseDriver for Compute Resource
"""
import mock
from keystoneauth1.exceptions.base import ClientException
from calplus.tests import base
from calplus.v1.compute.drivers.openstack import OpenstackDriver
fake_config_driver = {
'os_auth_url': 'http://contro... | StarcoderdataPython |
1776788 | <reponame>DPsalmist/bincom
# Generated by Django 3.1.4 on 2021-01-08 22:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='states',
name='stat... | StarcoderdataPython |
148976 | <filename>src/cobra/apps/dashboard/autocheck/app.py
from django.conf.urls import url
from cobra.core.application import Application
from cobra.core.loading import get_class
class AutoCheckDashboardApplication(Application):
name = None
index_view = get_class('dashboard.autocheck.views', 'IndexView')
def... | StarcoderdataPython |
1767940 | from .service import ContractService
__all__ = (
'ContractService',
)
| StarcoderdataPython |
41221 | <reponame>Sulles/YOLOL_Simulator
"""
Created: October 12, 2019
Author: Sulles
=== DESCRIPTION ===
This class houses the revamped GUI object and all associated objects
"""
# noinspection PyUnresolvedReferences
from Classes.map import obj_map
# noinspection PyUnresolvedReferences
from gui_lib import ListObj, TabList, D... | StarcoderdataPython |
3209810 | """ Training config
COLORMODE = Enum(['L', 'RGB'])
"""
MODEL = 'unet'
IMAGE_COLORMODE = 'L'
MASK_COLORMODE = 'RGB'
"""RGB setting
"""
MASK_USECOLORS = 'RB'
BG_COLOR = False
BACKGROUND_COLOR = [0, 1, 0]
""" 'tversky' or 'categorical cross entropy'
'binary_crossentropy', 'weighted_binary_crossentropy'
"""
LOSS... | StarcoderdataPython |
1786341 | <filename>Chapter 9 - File IO/07_pr_03.py<gh_stars>0
#Write a program to generate multiplication tables from 2 to 20 and write it to the different files.
# Place these files in a folder for a 13- year old boy.
for i in range(2, 21):
with open(f"tables/Multiplication_table_of_{i}.txt", 'w') as f:
for j in... | StarcoderdataPython |
3356920 | import re
import os
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.url import urljoin_rfc
from scrapy.utils.response import get_base_url
import csv, codecs, cStringIO
from product_spiders.items import Product, Product... | StarcoderdataPython |
3319300 | import datetime
import logging
import os
import boto3
CW = boto3.client("cloudwatch")
logging.getLogger().setLevel(os.environ.get("LOGLEVEL", logging.INFO))
def handler(_event, _context):
logging.debug("environment variables:\n %s", os.environ)
timestamp = datetime.datetime.now(datetime.timezone.utc)
t... | StarcoderdataPython |
4842282 | RED = "\033[93m{"
GREEN = "\033[92m"
BOLD = "\033[1m"
END = "\033[0m"
def bold_red(text: str) -> str:
return BOLD + RED + text + END + END
def bold_green(text: str) -> str:
return BOLD + GREEN + text + END + END
def bold(text: str) -> str:
return BOLD + text + END
| StarcoderdataPython |
49307 | """
.. module:: Augmentation
:platform: Unix, Windows
:synopsis: A useful module indeed.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import numpy as np
import random
from nltk.corpus import wordnet
import collections
import math
#import nltk
#nltk.download('wordnet')
class Augmentation:
r"""
This is the clas... | StarcoderdataPython |
1601356 | from .uuids import get_uuid, set_uuid
import logging
logger = logging.getLogger(__name__)
def unproxy(uuid_mapping):
"""This is a convenience for unproxying a lot of objects at once.
"""
for uuid, obj in uuid_mapping.items():
if isinstance(obj, GenericLazyLoader):
uuid_mapping[uuid] = ... | StarcoderdataPython |
3314470 | import logging
log = logging.getLogger(__name__)
_type_map = {}
class TypeMeta(type):
def __new__(mcs, name, bases, attrs):
cls = type.__new__(mcs, name, bases, attrs)
if '__metaclass__' not in attrs:
_type_map[name.lower()] = cls
from TelegramBotAPI.types.field import Fie... | StarcoderdataPython |
1664839 | <reponame>ndrewl/neoml<gh_stars>0
""" Copyright (c) 2017-2021 ABBYY Production LLC
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... | StarcoderdataPython |
3116 | import pandas as pd
import ta
from app.common import reshape_data
from app.strategies.base_strategy import BaseStrategy
pd.set_option("display.max_columns", None)
pd.set_option("display.width", None)
class EMABBAlligatorStrategy(BaseStrategy):
BUY_SIGNAL = "buy_signal"
SELL_SIGNAL = "sell_signal"
def c... | StarcoderdataPython |
1607547 | <reponame>beyucel/gpytorch
#!/usr/bin/env python3
import math
import torch
import gpytorch
import unittest
import warnings
from gpytorch.lazy import CachedCGLazyTensor, NonLazyTensor
from gpytorch.utils.gradients import _ensure_symmetric_grad
from test.lazy._lazy_tensor_test_case import LazyTensorTestCase
from unittes... | StarcoderdataPython |
76526 | <filename>tests/test_protocol_implements_decorator.py
from protocol_implements_decorator import implements
from typing import Protocol
def test():
"""Run some tests on the functionality of the decorators."""
class Printable(Protocol):
"""A test protocol that requires a to_string method."""
d... | StarcoderdataPython |
1753678 | <reponame>xotonic/netconfessor<filename>gen/tools/jnc_plugin/java_value.py
import collections
import context
import util
from .ordered_set import OrderedSet
class JavaValue(object):
"""A Java value, typically representing a field or a method in a Java
class and optionally a javadoc comment.
A JavaValue ... | StarcoderdataPython |
1692848 | <reponame>suyanan/vioser<filename>1.0/VIOS/ngs/scripts/db_nt_process.py
#-*- coding:utf-8 -*-
from .config_paras import *
if __name__ == '__main__':
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
os.environ['DJANGO_SETTINGS_MODULE'] = 'VIOS.settings'
django.s... | StarcoderdataPython |
3301637 | <reponame>sbutler/spacescout_web
""" Copyright 2013 Board of Trustees, University of Illinois
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-... | StarcoderdataPython |
1628243 | <gh_stars>1-10
"""
Generate the right type of host object and return it or run commands against it
"""
import logging
from dsi.common.local_host import LocalHost
from dsi.common.log import IOLogAdapter
from dsi.common.remote_ssh_host import RemoteSSHHost
LOG = logging.getLogger(__name__)
# This stream only log error... | StarcoderdataPython |
3265780 | <filename>naa_csv_reader.py<gh_stars>1-10
import csv
def csv_reader(csv_filename):
"""
This module reads the csv file for a specified spectrum that contains the
peak information in a single column. This module will extract the peak
energies as well as their associated net area with uncertainty ... | StarcoderdataPython |
3208616 | #Ler dois vetores de dimensão 5 e calcular o produto interno deles.
vetor1 = []
vetor2 = []
produtoInterno = 0.0
print("insira as componentes do primeiro vetor: ")
for i in range(5):
vetor1.append(float(input(f'Entre com o {i+1}-ésimo valor do vetor 1: ')))
print("insira as componentes do segundo vetor: ")
for i in... | StarcoderdataPython |
3229911 | """AyudaEnPython: https://www.facebook.com/groups/ayudapython
Una empresa de servicios públicos desea liquidar el total de la factura
teniendo en cuenta:
+---------+------------------+---------------+
| Estrato | Nivel de Consumo | Tarifa Básica |
+---------+------------------+---------------+
| 1 ... | StarcoderdataPython |
1730582 | # Configuration file for jupyterhub.
## The public facing URL of the whole JupyterHub application.
#
# This is the address on which the proxy will bind.
# Sets protocol, ip, base_url
# Default: 'http://:8000'
c.JupyterHub.bind_url = 'http://:8000'
## The URL the single-user server should start in.
... | StarcoderdataPython |
1748616 | from card_lookup import process_exact_match
def test_exact_match_found(db_cursor):
test_inputs = ["Goblin",
"cerberus",
"Puppet",
"Ceres of the Night",
"Ta-G, Katana Unsheathed",
"Marionette//Tre",
"X... | StarcoderdataPython |
1738780 | # given 2 integer, determin weather
# or not they differ by one bit
# link : https://www.youtube.com/watch?v=LqxtPV8xKeI&list=PLNmW52ef0uwvkul_e_wLD525jbTfMKLIJ&index=3
def grayNumber(a, b):
x = a ^ b
while x > 0:
if x % 2 == 1 and x >> 1 > 0:
return False
x >>= 1
re... | StarcoderdataPython |
1777719 | <reponame>malva28/Cat-Jump-2D<filename>codigo/controller.py
import glfw
import sys
class Controller:
def __init__(self):
self.mc = None
def set_model(self, m):
self.mc = m
def on_key(self, window, key, scancode, action, mods):
if self.mc.game_over:
print("The game is o... | StarcoderdataPython |
3376598 | <filename>test_project/test_project/settings.py
"""
Django settings for test_project project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside ... | StarcoderdataPython |
148801 | #!/usr/bin/env python
from setuptools import setup, find_packages
version = None
exec(open('dagr_revamped/version.py').read())
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='dagr_revamped',
version=version,
description='A deviantArt Ripper script written in Python',
a... | StarcoderdataPython |
2756 | <filename>languages/pt-br.py
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" é uma expressão opcional como "field1=\'newvalue\'". Não é possível atualizar ou excluir os resultados de uma junção',
'# of International Staff'... | StarcoderdataPython |
4837544 | # SPDX-FileCopyrightText: 2019 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import array
import board
import audiobusio
import simpleio
import neopixel
#---| User Configuration |---------------------------
SAMPLERATE = 16000
SAMPLES = 1024
THRESHOLD = 100
MIN_DELTAS = 5
DELAY = 0.2
FRE... | StarcoderdataPython |
4813584 | <reponame>bsmsoft/bsm
import os
import click
from bsm.cmd import Cmd
from bsm.util.option import parse_lines
@click.group(context_settings=dict(help_option_names=['-h', '--help']))
@click.option('--verbose', '-v', is_flag=True, help='Verbose mode, also print debug information')
@click.option('--quiet', '-q', is_flag... | StarcoderdataPython |
3272939 | # implementing my own class, continent class
class Continent:
def __init__(self, name, population):
self.name = name
self.population = population
def set_continent_name(self, name):
self.name = name
def set_continent_population(self, population):
self.population = populati... | StarcoderdataPython |
3346074 | <gh_stars>1-10
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
gncdir = os.path.dirname(parentdir)
docdir = os.path.dirname(gncdir)
sys.path.insert(0,parentdir)
sys.path.insert(0, gncdir)
sys.path.insert(0, docdir)
imp... | StarcoderdataPython |
4824817 | <filename>bugs/PENDING_SUBMIT/0433-BAD-IMAGE-Pixel5-29b7a44e-no-opt-test/generate_cts_test.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 The GraphicsFuzz Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | StarcoderdataPython |
4843289 | <filename>google_or_tools/toNum_sat.py
# Copyright 2021 <NAME> <EMAIL>
#
# 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 b... | StarcoderdataPython |
121605 | <filename>calico/felix/test/test_endpoint.py
# -*- coding: utf-8 -*-
# Copyright 2014, 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/l... | StarcoderdataPython |
1650267 | <filename>src/main/python/lib/default/gtkgui/version_control/custom_widgets.py
import gtk
# Semi-ugly hack to get hold of the button in a treeview header (treeviewcolumn)
# See e.g. http://www.tenslashsix.com/?p=109 or http://piman.livejournal.com/361173.html
# or google on e.g. 'gtk treeview header popup menu' for m... | StarcoderdataPython |
112468 | <gh_stars>0
import pickle
from os.path import join
import os
import numpy as np
def pickle_save(data_var, pkl_path, mode='wb'):
with open(pkl_path, mode) as pkl_file:
pickle.dump(data_var, pkl_file)
def pickle_load(pkl_path, mode='rb'):
with open(pkl_path, mode) as pkl_file:
data = pickle.lo... | StarcoderdataPython |
114303 | from http.server import BaseHTTPRequestHandler
import os
import subprocess
import time
from typing import ClassVar, Dict, List, Optional, Tuple
from onceml.components.base import BaseComponent, BaseExecutor
from onceml.orchestration.Workflow.types import PodContainer
from onceml.types.artifact import Artifact
from once... | StarcoderdataPython |
3375849 | from PIL import Image
def plus(str):
# 返回指定长度的字符串,原字符串右对齐,前面填充0。
return str.zfill(8)
def getCode(img):
str = ""
# 获取到水印的宽和高进行遍历
for i in range(img.size[0]):
for j in range(img.size[1]):
# 获取水印的每个像素值
rgb = img.getpixel((i, j))
# 将像素值转为二进制后保存
... | StarcoderdataPython |
168815 | <filename>secdef_parser.py
#!/usr/bin/env python3
"""secdef_parser.py: Tool to parse secdef and find most active instruments"""
import os
import sys
import urllib.request as request
import gzip
from argparse import ArgumentParser
from contextlib import closing
from io import BytesIO
import pandas as pd
VERSION = '0... | StarcoderdataPython |
1633324 | <gh_stars>1-10
from django.urls import path
from rest_framework.routers import DefaultRouter
from .views import ArtistViewSet
artist_list = ArtistViewSet.as_view({
'get': 'list',
'post': 'create'
})
artist_detail = ArtistViewSet.as_view({
'get': 'retrieve',
})
router = DefaultRouter()
router.register(r'a... | StarcoderdataPython |
3366885 | """Django models for Bookmarks app"""
from uuid import uuid4
from django.db import models
# Create your models here.
class Bookmark(models.Model):
id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
name = models.CharField(max_length=200)
notes = models.TextField('Notes', blank=True)
... | StarcoderdataPython |
1751304 | #!/usr/bin/python
#
# Copyright 2010 Google Inc.
#
# 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 |
4838146 | """
This is the interface that allows for creating nested lists.
You should not implement it, or speculate about its implementation
class NestedInteger(object):
def isInteger(self):
# @return {boolean} True if this NestedInteger holds a single integer,
# rather than a nested list.
def getInteg... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.