id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3267959 | <reponame>haihabi/model_optimization<filename>model_compression_toolkit/common/logger.py
# Copyright 2021 Sony Semiconductors Israel, Inc. 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 o... | StarcoderdataPython |
105204 | <reponame>bgfritz1/debarcer<filename>debarcer/src/handle_args.py
import os
import sys
import argparse
import configparser
def handle_arg(var, alt, error):
"""Argument parsing and error handling"""
if var is None:
if alt is not None:
var = alt
if var is None:
... | StarcoderdataPython |
147790 | <reponame>hidalgopl/django-sockpuppet-expo<gh_stars>0
from collections import defaultdict
from django.conf import settings
import os
BASE_PATH = settings.BASE_DIR
class MixinBase:
template_name = "demo.html"
demo_template = None
subtitle = None
def get_files(self):
files = defaultdict(list)
... | StarcoderdataPython |
1699715 | <reponame>neukirchen-212/phonopy
import pytest
import numpy as np
from phonopy.harmonic.force_constants import cutoff_force_constants
from phonopy.structure.cells import get_primitive
fc_1_10_ref = [-0.037549, 0.000000, 0.000000,
0.000000, 0.002415, -0.001746,
0.000000, -0.001746, 0.0024... | StarcoderdataPython |
18118 | <filename>Reinforcement-Learning/Python-Model/venv/lib/python3.8/site-packages/tensorflow/core/protobuf/graph_debug_info_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/core/protobuf/graph_debug_info.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:... | StarcoderdataPython |
3260451 | p = []
i = []
for g in range(int(input())):
n = int(input())
if n % 2 == 0: p.append(n)
else: i.append(n)
p.sort()
i.sort(reverse=True)
for j in p: print(j)
for j in i: print(j)
| StarcoderdataPython |
3287627 | <reponame>Xamaneone/SoftUni-Intro
import json
from tkinter import Button, Entry, Label
from gui_shop.canvas import tk
from gui_shop.helpers import clean_screen
from gui_shop.products import render_products
def register(**user):
user.update({"products": []})
with open("db/users.txt", "a") as file:
fil... | StarcoderdataPython |
3229601 | import sys
import click
import random
import string
import os
import json
import logging
from pprint import pprint
from cookiecutter.main import cookiecutter
from datetime import datetime
from jinja2 import Environment, BaseLoader
import boto3
from pcluster.configure.networking import (
NetworkConfiguration,
P... | StarcoderdataPython |
1661841 | <filename>pincer/objects/guild.py<gh_stars>0
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2021 Pincer
#
# 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,
# inclu... | StarcoderdataPython |
1714579 | <reponame>KwatME/ccal
from re import sub
from numpy import nan
from ..dictionary import merge
from ..plot import NAME_COLORSCALE, plot_plotly
from ._make_data_annotation import _make_data_annotation
from ._make_target_annotation import _make_target_annotation
from ._process_data import _process_data
from ._process_ta... | StarcoderdataPython |
3245351 | <gh_stars>0
import numpy as np
from multiprocessing import Queue
from aco.common_aco import Aco
from aco.tsp_parser import *
from helper.constants import *
class Paco(Aco):
def __init__(self, num_ants=10,
tau_zero=0.4,
tsp_file="",
num_cities=10,
... | StarcoderdataPython |
196700 | <gh_stars>0
### keras playground 1.3 (minmax scaling patch) ###
import os
import pickle
import pandas as pd
import numpy as np
from keras.models import Sequential, load_model
from keras.layers import Dense, Activation, BatchNormalization
from keras import backend as K
import matplotlib.pyplot as plt
from skl... | StarcoderdataPython |
1634086 | <filename>scripts/makeConfiguration.py<gh_stars>1-10
#!/usr/bin/python
import ConfigParser
import os
import re
print("""Welcome to Bookworm.
~~~~~~~~~~~~~~~~~~~~
First off, let's build a configuration file. This will live
at bookworm.cnf in the current directory: if you mistype anything,
or want to change settings, e... | StarcoderdataPython |
82385 | <reponame>uaca/deepy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from util import run
from deepy.utils import GaussianInitializer
model_path = os.path.join(os.path.dirname(__file__), "models", "gaussian1.gz")
if __name__ == '__main__':
# I have to set std to be 0.1 in this case, or it will not conver... | StarcoderdataPython |
151621 | <reponame>stewardshiptools/stewardshiptools
from cedar_settings.default_settings import default_settings
from django.contrib.staticfiles.templatetags.staticfiles import static
default_settings['cedar__default_support_url'] = ('text', 'http://www.cedarbox.ca/support/')
default_settings['cedar__default_splash_page_bac... | StarcoderdataPython |
190197 | #! /usr/bin/python
import sys
from objects import Map
from utils import find_map
fd = open("Loader", "r")
fd.seek(0,2)
loader_len = fd.tell()
fd.close()
print "Loader is {0} bytes long.".format(loader_len)
if len(sys.argv) != 2:
print("Usage: claim_frags <device>")
exit(1)
fd = open(sys.argv[1], "r+b")
map... | StarcoderdataPython |
3365469 | '''
Created on Mar 13, 2020
@author: ballance
'''
from ucis.lib.lib_obj import LibObj
from ucis.cover_type import CoverType
from ucis.lib.libucis import get_lib
from ucis import UCIS_INT_COVER_GOAL, UCIS_INT_COVER_LIMIT,\
UCIS_INT_COVER_WEIGHT
class LibCoverType(LibObj, CoverType):
def __init__(self, db,... | StarcoderdataPython |
165432 | <reponame>MastaCoder/Projects<filename>Contests/CCC/CCC '06 S3 - Tin Can Telephone.py
# I have no idea if this is actually functioning.
def line_intersection(l1, l2):
xdiff = (l1[0][0] - l1[1][0], l2[0][0] - l2[1][0])
ydiff = (l1[0][1] - l1[1][1], l2[0][1] - l2[1][1])
def det(a, b):
return a[0] * ... | StarcoderdataPython |
1796013 | import sys
def max_subarray_sum(arr, n):
# define a window with 0 as start index and len of window which is n
# give max_sum = 0
# loop the array with window until the index of the len of the window is the len of the array -1
# if the current sum of the window > than the max_sum, max_sum = sum of the w... | StarcoderdataPython |
3220927 | """
Plotting objects
"""
# geoms
from .geom_abline import geom_abline
from .geom_area import geom_area
from .geom_bar import geom_bar
from .geom_bin2d import geom_bin2d
from .geom_blank import geom_blank
from .geom_boxplot import geom_boxplot
from .geom_col import geom_col
from .geom_count import geom_count
from .geom... | StarcoderdataPython |
3388599 | <reponame>adampoulston/pronto
# coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class BaseParser(object):
"""An abstract parser object.
"""
@classmethod
@abc.abstractmethod
def hook(cls, force=Fals... | StarcoderdataPython |
119339 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... | StarcoderdataPython |
1776001 | # The MIT License (MIT)
#
# Copyright (c) 2015 Numenta, 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
# to use, copy, mod... | StarcoderdataPython |
54746 | # encoding: utf-8
import pytest
import six
from flask import Blueprint
import ckan.plugins as p
from ckan.common import config, _
class MockRoutingPlugin(p.SingletonPlugin):
p.implements(p.IBlueprint)
def get_blueprint(self):
# Create Blueprint for plugin
blueprint = Blueprint(self.name, s... | StarcoderdataPython |
3223418 | import os
flag, isOperand, isOperator = 0, 0, 0
Variable, Result = 0.0, 0.0
strOperation, strForResult = '', 'Expression = '
while strOperation != '=': # Приложение выводит результат вычислений когда получает от пользователя =.
os.system("clear")
v... | StarcoderdataPython |
141399 | <gh_stars>1-10
AzToolchainInfo = provider(
doc = "Azure toolchain rule parameters",
fields = [
"az_tool_path",
"az_tool_target",
"azure_extension_dir",
"az_extensions_installed",
"jq_tool_path",
],
)
AzConfigInfo = provider(
fields = [
"debug",
"g... | StarcoderdataPython |
21928 | # ===============================================================================
# Copyright 2019 ross
#
# 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/LICE... | StarcoderdataPython |
3202095 | <reponame>Saibamen/credo-webapp
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework.views import APIView
from rest_framework.parsers import JSONParser
from rest_framework.response import Response
from rest_framework import status
from credocommon.exceptions import RegistrationException... | StarcoderdataPython |
3359224 | <reponame>dginformatica/GoWDiscordTeamBot<gh_stars>0
import asyncio
from models import DB
class Subscriptions:
SUBSCRIPTION_CONFIG_FILE = 'subscriptions.json'
def __init__(self):
self._subscriptions = {}
self.load_subscriptions()
def load_subscriptions(self):
db = DB()
r... | StarcoderdataPython |
3300151 | from federatedml.feature.fate_element_type import NoneType
from operator import itemgetter
from federatedml.param.evaluation_param import EvaluateParam
from federatedml.protobuf.generated.boosting_tree_model_meta_pb2 import BoostingTreeModelMeta
from federatedml.protobuf.generated.boosting_tree_model_meta_pb2 import O... | StarcoderdataPython |
5889 | <reponame>helion-security/helion
# -*- coding: utf-8 -*-
#
# test/test_metadata.py
# Part of ‘python-daemon’, an implementation of PEP 3143.
#
# This is free software, and you are welcome to redistribute it under
# certain conditions; see the end of this file for copyright
# information, grant of license, and disclaime... | StarcoderdataPython |
186753 | <filename>tests/test_save_commands.py
import pytest
import os, sys
import mock
import builtins
workspace_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, os.path.abspath(workspace_path))
path = os.path.dirname(__file__)
from save_commands import save_commands
def alter_databa... | StarcoderdataPython |
1608491 | <gh_stars>10-100
import socket
import sys
import binascii
def getChecksumValue(byteArray):
""" returns the checksum value as a byte from an array of bytes """
#sum all the values
sumOfValues = 0
for x in range(len(byteArray)):
sumOfValues += byteArray[x]
# return
... | StarcoderdataPython |
189668 | <reponame>armoner24/News-Central<filename>get_news.py<gh_stars>0
import urllib2
from bs4 import BeautifulSoup
url="https://news.google.com/topics/CAAqJggKIiBDQkFTRWdvSUwyMHZNRGx1YlY4U0FtVnVHZ0pKVGlnQVAB?hl=en-IN&gl=IN&ceid=IN%3Aen"
page=urllib2.urlopen(url)
soup=BeautifulSoup(page, 'html.parser')
headlines=[]
nul... | StarcoderdataPython |
1681608 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Ui_MainWindowLoginByFaceID.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 ... | StarcoderdataPython |
59002 | <gh_stars>0
name = input("what is your name? ")
age = int(input("how old are you {0}? ".format(name)))
if (18 <= age < 31):
print("welcome to holiday")
else:
print("you are not 18-30") | StarcoderdataPython |
39316 |
def inner_stroke(im):
pass
def outer_stroke(im):
pass
| StarcoderdataPython |
3371316 | <reponame>tcysin/portfolio
"""
This module contains functionality for finding duplicated and near-duplicated
images.
TODO better description
TODO which methods do we use here?
"""
from collections import defaultdict
from typing import Dict, Iterable, List
import numpy as np
from PIL import Image
from scipy import sp... | StarcoderdataPython |
1781766 |
import copy
import csv
import numpy as np
import os
import pandas as pd
import pdb
from . import utils
def read_raw_csv(file, target = 'domain1_score'):
'''
Reading the main training file is tricky. We rely on these two posts:
- https://stackoverflow.com/a/37723241/2232265
- https://stackoverfl... | StarcoderdataPython |
3252222 | <reponame>matu3ba/cports
pkgname = "python-six"
pkgver = "1.16.0"
pkgrel = 0
build_style = "python_module"
hostmakedepends = ["python-setuptools"]
checkdepends = ["python-pytest"]
depends = ["python"]
pkgdesc = "Python compatibility utilities"
maintainer = "q66 <<EMAIL>>"
license = "MIT"
url = "https://github.com/benja... | StarcoderdataPython |
1702062 | <filename>scripts/anchor_nights.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Find potential anchor nights."""
import numpy as np
from dr2 import constants
qc = constants.IPHASQC
BLACKLIST = [20040806, 20050920, 20051106, 20061110, 20061127]
def parse_extinction():
result = []
for value in qc['ext_r_... | StarcoderdataPython |
80213 | import os
import numpy as np
import argparse
import os.path as osp
import json
from tqdm import tqdm
from mmcv import mkdir_or_exist
def getFlying3dMetas(root, Type, data_type='clean'):
Metas = []
imgDir = 'flyingthings3d/frames_' + data_type + 'pass'
dispDir = 'flyingthings3d/disparity'
Parts = ['A'... | StarcoderdataPython |
152935 | # Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... | StarcoderdataPython |
168771 | from clusto.drivers.devices.common.portmixin import *
from clusto.drivers.devices.common.ipmixin import *
from clusto.drivers.devices.common.snmpmixin import *
| StarcoderdataPython |
3279307 | class Solution:
# Brute Force (Accepted), O(n^2) time, O(n) space
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
res = []
for i, v in enumerate(nums):
s = 0
for v1 in nums[:i]:
s += v1 < v
for v2 in nums[i+1:]:
... | StarcoderdataPython |
4808503 | ###############################################################################
# RTSP server
# 2022 Initial Release
# <NAME>
###############################################################################
# Implementing GstRtspServer
# https://github.com/mad4ms/python-opencv-gstreamer-examples/blob/master/gst_rtsp_s... | StarcoderdataPython |
75548 | # Import needed libraries
from stix2 import TAXIICollectionSource, Filter
from taxii2client.v20 import Server, Collection
import json
import re
from openpyxl import Workbook
from openpyxl.styles import Font
from openpyxl.styles import Alignment
#_________________________________________________________________________... | StarcoderdataPython |
33268 | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 0.8.6
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% {"slideshow": {"slide_ty... | StarcoderdataPython |
3398685 | <filename>src/inflection.py
import lemminflect
import src.helpers as helpers
def inflect(string, mode):
words = string.split(" ")
for i, word in enumerate(words):
if word[0] == "[" and word[-1] == "]":
words[i] = word[1:-1]
elif len(words) > 1:
continue
# Lo... | StarcoderdataPython |
4826191 | """The tests for the MQTT binary sensor platform."""
import json
import unittest
from unittest.mock import Mock
from datetime import timedelta
import homeassistant.core as ha
from homeassistant.setup import setup_component, async_setup_component
from homeassistant.components import binary_sensor, mqtt
from homeassist... | StarcoderdataPython |
3363633 | <reponame>RubenBranco/SO2017
#!/usr/bin/python
# -*- coding:utf-8 -*-
import argparse
from zipfile import ZipFile
from multiprocessing import Semaphore
from threading import Thread
import os
import sys
class PZip:
def __init__(self, Files, mode, t, threads):
"""
Construtor de PZip.
Requir... | StarcoderdataPython |
142606 | """
Script for calculating the IPO index in each ensemble member
Author : <NAME>
Date : 17 September 2021
Version : 12
"""
### Import packages
import sys
import math
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.stats as stats
from mpl_toolkits.basemap im... | StarcoderdataPython |
24990 | from otree.api import Currency as c, currency_range
from . import pages
from ._builtin import Bot
from .models import Constants
class PlayerBot(Bot):
def play_round(self):
if self.round_number <= self.participant.vars['last_round']:
yield pages.Decision, {"decision_high": 1, "decision_low": 1}... | StarcoderdataPython |
3321377 | import multiprocessing
bind = "0.0.0.0:8000"
workers = multiprocessing.cpu_count() * 2 + 1
errorlog = '/tmp/logs/gunicorn/access.log'
loglevel = 'info'
accesslog = '/tmp/logs/gunicorn/error.log'
# UNCOMMENT BELOW IF USING SSL
#secure_scheme_headers = {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FO... | StarcoderdataPython |
1694877 | from functools import lru_cache
import importlib.util
# TODO: get_config should probably return a standardized config class
@lru_cache(maxsize=32)
def get_config(path):
spec = importlib.util.spec_from_file_location("config.kaori", path)
config = importlib.util.module_from_spec(spec)
spec.loader.exec_module... | StarcoderdataPython |
97652 | from src.platsec.compliance.prowler import (ProwlerExecutionRun, ProwlerConfig)
from src.platsec.compliance.prowler_exceptions import (
PipelineValidationPhaseException,
AwsBucketPathCreateException,
AwsProwlerFileException)
from src.platsec.compliance.prowler import (
get_prowler_config,
check_reco... | StarcoderdataPython |
1713104 | # Public Domain (-) 2010-2012 The Assetgen Authors.
# See the Assetgen UNLICENSE file for details.
| StarcoderdataPython |
3255598 | import sys
import os
import httplib2
import urllib.request as urllib2
import logging
class Downloader(object):
def __init__(self):
self.filepath = None
def get_filepath(self):
return self.filepath
def download(self, url, path, fallback_filename):
logging.debug("Downloading URL {}"... | StarcoderdataPython |
190810 | <filename>math3d_side.py
# math3d_side.py
class Side:
NEITHER = 'NEITHER'
BACK = 'BACK'
FRONT = 'FRONT' | StarcoderdataPython |
121273 | import pytest
from radix import Bin, Num
def test_2s_compl():
n1 = Bin(-13)
assert n1.twos_compl() == '10011'
n2 = Bin(19)
assert n2.twos_compl() == '010011'
n3 = Bin(-10.75)
assert n3.twos_compl() == '10101.01'
def test_1s_compl():
n1 = Bin(-25)
assert n1.ones_compl() == '10011... | StarcoderdataPython |
64250 | <reponame>mohammad-pourmirzay/Python-Resume<filename>app10.py
import termcolor
print(termcolor.colored("Hello, welcome to the question game", color = "green"))
print(termcolor.colored("Please specify the difficulty level of the questions", color ="green"))
difficulty_questions = int(input("Easy = 1, Medium = 2, Ha... | StarcoderdataPython |
38759 | import io, os, re
from os import path
from setuptools import find_packages
from distutils.core import setup
# pip's single-source version method as described here:
# https://python-packaging-user-guide.readthedocs.io/single_source_version/
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirn... | StarcoderdataPython |
3301229 | <gh_stars>0
__author__ = '<NAME> and <NAME>'
#purpose of this file is to register a player in a tournament
class Registration:
def __init__(self, tournament):
"""Initialize Registration with a Tournament"""
self.tournament = tournament
def register(self, player):
"""Register a player... | StarcoderdataPython |
1723457 | <filename>Main.py<gh_stars>0
'''
Multiple controllers:
'''
from flask import Flask
from rest_api import *
import os
app = Flask(__name__)
app.register_blueprint(api)
'''
@app.route("/")
def hello():
return "Hello World!"
'''
if __name__ == "__main__":
host = os.environ.get('IP', ... | StarcoderdataPython |
55227 | import click
from uumpa_ci_toolbox import common
from . import api
@click.group()
def kubectl():
pass
@kubectl.command()
@click.option('--version', required=True, help='Kubectl version to install, e.g. "v1.19.0"')
@click.option('--target-filename', default='/usr/local/bin/kubectl')
@click.option('--with-sudo'... | StarcoderdataPython |
1674301 | #
# Copyright 2021. Clumio, Inc.
#
from typing import Any, Dict, Mapping, Optional, Sequence, Type, TypeVar
from clumioapi.models import user_embedded
from clumioapi.models import user_links
T = TypeVar('T', bound='ReadUserResponse')
class ReadUserResponse:
"""Implementation of the 'ReadUserResponse' model.
... | StarcoderdataPython |
3229544 | <reponame>kulado/mailserver
from contextlib import contextmanager
from sqlalchemy import create_engine
from sqlalchemy.exc import IntegrityError
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm.exc import NoResultFound
def create_database(uri: str, base):
e... | StarcoderdataPython |
70748 | <filename>BackTracking/Permutations of a given string.py
class Solution:
def find_permutation(self, S):
S = sorted(S)
self.res = []
visited = [False] * len(S)
self.find_permutationUtil(S, visited, '')
return self.res
def find_permutationUtil(self, S, visited, str):
... | StarcoderdataPython |
1647069 | <gh_stars>1-10
from entsoe_client.Parsers.Parser import Parser, ParserFactory, XMLParser, ZipParser
| StarcoderdataPython |
84797 | <reponame>teodoramilcheva/softuni-software-engineering<gh_stars>0
first_line = input().split()
second_line = input().split()
third_line = input().split()
board_list = [
first_line,
second_line,
third_line
]
first = '1'
second = '2'
empty = '0'
first_win = [first] * 3
second_win = [second] * ... | StarcoderdataPython |
90989 | import pytest
import numpy as np
from jina.excepts import BadClientCallback
from jina.flow import Flow
def validate(x):
raise NotImplementedError
@pytest.mark.parametrize('restful', [False, True])
def test_client_on_error(restful):
# In this particular test, when you write two tests in a row, you are testi... | StarcoderdataPython |
4834838 | #!/usr/bin/python
import sys
import time
import os
import getpass
import getopt
import argparse
import re
import paramiko
import socket
import Queue
import threading
def sshDeploy(retry,hostname):
global projectName
global user
global password
global userInsightfinder
global licenseKey
global ... | StarcoderdataPython |
59739 | INSTALLED_APPS = ["athanor_staff"]
| StarcoderdataPython |
3353119 | <reponame>michael-hahn/django-lfs<gh_stars>100-1000
from django.apps import AppConfig
class LfsCatalogAppConfig(AppConfig):
name = 'lfs.catalog'
def ready(self):
from . import listeners # NOQA
| StarcoderdataPython |
15851 | <reponame>Neradoc/Adafruit_Board_Toolkit
# SPDX-FileCopyrightText: Copyright (c) 2021 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
import adafruit_board_toolkit.circuitpython_serial
comports = adafruit_board_toolkit.circuitpython_serial.repl_comports()
if not comports:
raise Exception("No... | StarcoderdataPython |
42591 |
from dash_extensions.enrich import Dash
from _app.layout import serve_layout
from _app.callback import register_callbacks
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
app = Dash(prevent_initial_callbacks=True,
external_stylesheets=external_stylesheets
)
register_c... | StarcoderdataPython |
177231 |
#Program 20
#Write a program to write roll no, name and marks of 'n' students in a data file "marks.dat"
#Name: <NAME>
#Class: 12
#Date of Execution: 26/08/2021
n=int(input("Enter the number of students you want to store data of in the data file:"))
f=open(r"C:\Python\Class 12 python\Lab Programs\BinaryFiles\marks.d... | StarcoderdataPython |
1784393 | login_data = {
"version": "0",
"id": "",
"password": "",
"term": "on",
"m": "0",
}
choose = {
"session_id": "",
"use_cge_new_cate": "1",
"page": "0",
"e": "0",
"grade": "2",
"grade2": "2",
"dept": "4104",
"use_cge_new_cate": "$use_cge_new_cate",
}
select = {
"se... | StarcoderdataPython |
151725 | <filename>docx/text/hyperlink.py
"""
Hyperlink-related proxy types.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from .run import Run
from ..shared import Parented
from ..runcntnr import RunItemContainer
class Hyperlink(RunItemContainer):
"""
Proxy object wr... | StarcoderdataPython |
3245270 | <filename>Demo/Tsearch.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
#author:iuyyoy
import sys,os
sys.path.append(sys.path[0]+'/..')
from Global.db_op import Db_op as DB
from Global.config import *
from Global.global_function import *
import jieba
from gensim import corpora, models, similarities
class Search(object)... | StarcoderdataPython |
35043 | '''
Created on 2018-12-21
Copyright (c) 2018 <NAME>
Generate code from a model and a jinja2 template.
'''
import logging
from pathlib import Path
from jinja2 import FileSystemLoader, Environment
from jinja2.exceptions import TemplateNotFound
from munch import munchify
from fashion.mirror import Mirror
# Module l... | StarcoderdataPython |
3361383 | <filename>2020_11_Cooper_Type/join_selected_glyph_names.py
print(" ".join(CurrentFont().selectedGlyphNames)) | StarcoderdataPython |
3355546 | # --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incor... | StarcoderdataPython |
163540 | <filename>library/pyjamas/Canvas2D.py<gh_stars>1-10
# Canvas wrapper component for Pyjamas
# Ported by <NAME> from Canvas component for GWT - Originally by <NAME> http://gwt.components.googlepages.com/
#
# Canvas API reference:
# http://developer.apple.com/documentation/AppleApplications/Reference/SafariJSRef/Classes/C... | StarcoderdataPython |
1683466 | <reponame>delaturo/pythonUtilities
from sort.sortAlgorithm import sortAlgorithm
class mergeSort(sortAlgorithm):
def __init__(self):
sortAlgorithm.__init__(self)
def getDescription(self):
return "Merge sort"
def sortMethod(self, arr):
if len(arr) > 1:
half = len(a... | StarcoderdataPython |
159401 | #!/usr/bin/env python3
# coding: utf-8
from plugin_util.console import get_current_shell, list_shells
from plugin_util.run import run_file, run_path, run, load
from plugin_util.usepip import execute_pip, install, uninstall, ensure_import
from plugin_util.urlimport import (
install_url_meta, remove_url_meta, instal... | StarcoderdataPython |
3265006 | import os
# no need to import gitmodules for ordinary modules,
# try to run this script it should work as is
from ordinary_submodule import d
def main():
print("This is git submodule 'c' called from " +
os.path.abspath(".") +
" and it is going to call main function from its ordinary submodule ... | StarcoderdataPython |
1764800 | class Solution:
def reverseVowels(self, s: str) -> str:
left = 0
right = len(s) - 1
vowels = set(['a', 'o','e','u','i','A','O','E','I','U'])
s = list(s)
while ( left < right):
if s[left] in vowels and s[right] in vowels:
s[left], s[right] = s[right... | StarcoderdataPython |
70432 | import typing
import dataclasses
# TODO get paper list
@dataclasses.dataclass
class Params():
service: typing.Final[int] = 2
pubyearfrom: typing.Optional[int] = None
pubyearto: typing.Optional[int] = None
material: typing.Optional[str] = None
issn: typing.Optional[str] = None
cdjournal: typing.Optional[... | StarcoderdataPython |
3256054 | from random import randint
from b0mb3r.services.service import Service
class Ingos(Service):
phone_codes = [7]
async def run(self):
await self.post(
"https://www.ingos.ru/api/v1/lk/auth/register/fast/step2",
headers={"Referer": "https://www.ingos.ru/cabinet/registration/perso... | StarcoderdataPython |
3333419 | # SQLite3 does not support parameterized table and field names,
# for CREATE TABLE and PRAGMA so we must use Python string formatting.
# Applying `check_identifier` to parameters prevents SQL injection.
import sqlite3
from typing import NamedTuple, Optional, Iterator, Any
DEFAULT_DB_PATH = ':memory:'
CONNECTION: Opti... | StarcoderdataPython |
1765312 | <filename>slap_dj/app_v2/db/utils.py<gh_stars>0
from itertools import combinations
from typing import Type, TypeVar, List, Any, Dict
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.db import models, IntegrityError
_M = TypeVar('_M', bound=models.Model)
def update(instance:... | StarcoderdataPython |
3232816 | '''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any late... | StarcoderdataPython |
3354500 | <filename>src/admin/explorer/to.py
# -*- coding: utf-8 -*-
# Copyright 2019 Green Valley Belgium NV
#
# 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/LICE... | StarcoderdataPython |
90863 | <filename>imagenet/SGD_GAF.py
import torch
from torch.optim.optimizer import Optimizer
from torch.optim.optimizer import required
import torch.nn.functional as F
class SGD_atan(Optimizer):
r"""Implements stochastic gradient descent (optionally with momentum).
Nesterov momentum is based on the formula from
... | StarcoderdataPython |
3214236 | <filename>third/test_system.py
import sys
import pytest
@pytest.mark.system
def test_platform() -> None:
assert sys.platform == 'darwin'
@pytest.mark.system
def test_python_version() -> None:
assert sys.version_info[:3] == (3, 7, 0) | StarcoderdataPython |
3391671 | <gh_stars>100-1000
"""
This is implementation of Ornstein-Uhlenbeck process.
"""
import numpy as np
import torch
from machina.utils import get_device
from machina.noise.base import BaseActionNoise
class OUActionNoise(BaseActionNoise):
"""
noise produced by Ornstein-Uhlenbeck process.
"""
def __init... | StarcoderdataPython |
145447 | <reponame>zhuxinqimac/Ramiel
#!/usr/bin/python
#-*- coding: utf-8 -*-
# >.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.
# Licensed under the Apache License, Version 2.0 (the "License")
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# --- File Name: main.py
# --- Creation Date: 07-09-2020
# --... | StarcoderdataPython |
1690762 | import sys
from binascii import *
fi = file(sys.argv[1]).read()
semantics = file(sys.argv[2]).read()
fo = open(sys.argv[3], "w+")
h={}; registers={}; context={}; mseq=0; dseq=1; T=True; F=False
def n2z( a ):
return ( '0' if a=='' else a )
def be2le( a ):
return a[6:8]+a[4:6]+a[2:4]+a[0:2]
def mark( p, s, t ):
... | StarcoderdataPython |
1701369 | from ray.rllib.algorithms.ddppo import ( # noqa
DDPPO as DDPPOTrainer,
DEFAULT_CONFIG,
)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.