id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1861037 | <reponame>fish-quant/sim-fish
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
"""
Functions to simulate spots patterns.
"""
import numpy as np
import bigfish.stack as stack
# TODO add a pattern with different densities per area
def simulate_ground_truth(n_spots=30, random_n_spots=False,
... | StarcoderdataPython |
299010 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class ManufacturersAppConfig(AppConfig):
name = 'manufacturers'
verbose_name = _('Manufacturers')
default_app_config = 'manufacturers.ManufacturersAppConfig'
| StarcoderdataPython |
248680 |
def test_example():
assert 20 > 3
| StarcoderdataPython |
229083 | import sys
import json
def gen_label(taxo, topic_wts):
if "root" in taxo:
if taxo["root"] in topic_wts:
print(" \"%s\" [ weight=%.4f ];" % (taxo["root"], topic_wts[taxo["root"]]))
else:
print(" \"%s\";" % (taxo["root"]))
if "children" in taxo:
for child in taxo... | StarcoderdataPython |
380629 | <reponame>andriidem308/python_practice
def decorator_type(Cls):
class NewCls(object):
def __init__(self, *args, **kwargs):
self.oInstance = Cls(*args, **kwargs)
def __getattribute__(self, s):
try:
x = super(NewCls, self).__getattribute__(s)
except... | StarcoderdataPython |
6486378 | <filename>cintas01/apps/movimientos/admin.py
from django.contrib import admin
from apps.movimientos.models import (Cinta,Alojadores,Movimiento)
admin.site.register(Cinta)
admin.site.register(Alojadores)
admin.site.register(Movimiento)
| StarcoderdataPython |
3229459 | import _global
_global._import()
import sys
from pysms import Sms
from pygsm.errors import GsmError, GsmConnectError, GsmModemError, GsmWriteError
try:
sms = Sms("/dev/ttyUSB0", logger = False)
strangth = sms.gsm.signal_strength()
print(strangth)
except GsmConnectError as err:
print ("connect error", ... | StarcoderdataPython |
5174518 | import base64
def encode(value):
return base64.urlsafe_b64encode(str(value)).rstrip('=')
def decode(value):
return base64.urlsafe_b64decode(str(value) + '=' * (4 - len(value) % 4))
def decode_dict(value):
text = decode(str(value))
output = {}
for pair in text.split('\r\n'):
if '=' in pai... | StarcoderdataPython |
1760132 | <reponame>Retraces/UkraineBot<gh_stars>1-10
/home/runner/.cache/pip/pool/87/a8/65/46c8c75345440a6c7fb21b2e2adcb806971af94ea0c9a196d612bb1adb | StarcoderdataPython |
3381449 | <reponame>afrozchakure/Python-Games
import pygame
import sys
import random # Pythons random library
pygame.init() # To initialize pygame
# Defining the width and height of the screen
WIDTH = 800 # Global variables
HEIGHT = 600
# Defining the color for player and enemy
RED = (255, 0, 0)
BLUE = (0, 0, 255)
YELLOW ... | StarcoderdataPython |
1951222 | # Copyright (c) 2020, <NAME>PORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | StarcoderdataPython |
8043082 | <filename>test/api/gen/default/test_iproc.py
import unittest
import numpy as np
import pandas as pd
import xarray as xr
from xcube.api.gen.default.iproc import DefaultInputProcessor
from xcube.util.timecoord import get_time_in_days_since_1970
class DefaultInputProcessorTest(unittest.TestCase):
def setUp(self):... | StarcoderdataPython |
43531 | <gh_stars>10-100
#!/usr/bin/env python
import roslib
roslib.load_manifest('turtlebot_actions')
import rospy
import os
import sys
import time
from turtlebot_actions.msg import *
from actionlib_msgs.msg import *
import actionlib
def main():
rospy.init_node("find_fiducial_pose_test")
# Construct action ac
ro... | StarcoderdataPython |
3328392 | <filename>PersonalFinance/PersonalFinance/accountDb.py
import sqlite3
import clr
import uuid
class insertData(object):
def __init__(self, gName):
conn = sqlite3.connect("test_finance.db")
curs = conn.cursor()
curs.execute('''CREATE TABLE IF NOT EXISTS tblGroup(
gui... | StarcoderdataPython |
353222 | <reponame>nebulx29/LearnPython
def multi_print(number = 3, word = "Hallo"):
for i in range(0, number):
print(str(i) + " " + word)
multi_print(1, "Hallo")
print("--")
multi_print()
print("--")
multi_print(2)
print("--")
multi_print(word = "Welt")
print("--")
multi_print(word = "Welt", nu... | StarcoderdataPython |
5008285 | from restio.state import ModelState, ModelStateMachine, Transition
class TestModelStateMachine:
def test_get(self):
next_state_existing = ModelStateMachine.transition(
Transition.GET_OBJECT, ModelState.UNBOUND
)
next_state_missing = ModelStateMachine.transition(
Tra... | StarcoderdataPython |
6479277 | """ Import all the nodes for STL tree """
from .nodes import *
| StarcoderdataPython |
9674664 | """Config flow to configure the AIS WIFI Service component."""
from homeassistant import config_entries
from homeassistant.core import callback
from .const import DOMAIN
from homeassistant.const import CONF_PASSWORD, CONF_NAME
from homeassistant.components.ais_dom import ais_global
import time
import voluptuous as vol... | StarcoderdataPython |
3293219 | from flask import render_template, redirect, url_for, request, flash
from flask_login import login_user, login_required, logout_user
from .forms import RegistrationForm, LoginForm
from . import auth
from ..import db
from ..models import User
# registration route
@auth.route('templates/auth/reqister',methods=['GET','P... | StarcoderdataPython |
3311998 | """
Example usage:
python event_average --wt <int value representing the window limit in seconds>
python event_average --wt 3
OR
DEFAULT
python event_average
"""
from __future__ import division
import random
import time
import sys
import argparse
class AverageWindow(object):
def __init__(self, window_limit):
... | StarcoderdataPython |
1835292 | #!/usr/bin/python2.7
from __future__ import division
import os
import urllib, cStringIO
import pymongo as pm
import numpy as np
import scipy.stats as stats
import pandas as pd
import json
import re
from PIL import Image
import base64
import sys
'''
To generate main dataframe from pymongo database, run, e.g.:
exp1... | StarcoderdataPython |
3465972 | <filename>Code/SVD.py
# -*- coding: utf-8 -*-
import numpy as np
from scipy.sparse.linalg import eigs
def calculate_SandV(A):
'''
Calculate right singular vectors V and obtain homography matrix H
'''
A_Transpose_A = np.matmul(np.transpose(A), A)
eigen_values, eigen_vectors = eigs(A_Transpose_A, 8... | StarcoderdataPython |
6412347 | <gh_stars>0
def ficha(nome = '<desconhecido>', gols = 0):
print(f'O jogador {nome} fez {gols} gol(s) no campeonato.')
print('-' * 20)
nome = input('Nome do jogador: ')
gols = input('Número de gols: ')
if gols.isnumeric and gols != '':
gols = int(gols)
else:
gols = 0
if nome != '':
ficha(nome, gols)
el... | StarcoderdataPython |
7218 | <reponame>mentaal/r_map
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import... | StarcoderdataPython |
117166 | import torch
def flipud(tensor):
"""
Flips a given tensor along the first dimension (up to down)
Parameters
----------
tensor
a tensor at least two-dimensional
Returns
-------
Tensor
the flipped tensor
"""
return torch.flip(tensor, dims=[0])
| StarcoderdataPython |
3481171 | """
Generating a txt file with the network architecture used in the experiment
Denoising_in_superresolution/src
@author: <NAME>
"""
import os
from tqdm import tqdm
import numpy as np
from matplotlib import pyplot as plt
import torch
import models as models
import lib.model_setup as model_setup
import lib.utils as u... | StarcoderdataPython |
4812471 | <reponame>p1r473/opencanary<filename>opencanary/__init__.py
__version__="0.6.3" | StarcoderdataPython |
4832616 | <reponame>kullo/server
import os
from fabric.api import *
env.hosts = ['kullo2.kullo.net']
env.user = 'root'
KULLOSERVER_DIR = '/opt/kulloserver'
@task(default=True)
def deploy():
local('make')
#TODO run tests
with cd(KULLOSERVER_DIR):
execute(update_preregistrations)
execute(update_hooks)
execute(update_me... | StarcoderdataPython |
8198512 | from vaccontrib.covid import get_reduced_vaccinated_susceptible_contribution_matrix_covid, get_reduced_population_contribution_matrix_covid
from vaccontrib.covid import get_next_generation_matrix_covid
from vaccontrib.main import get_reduced_vaccinated_susceptible_eigenvector, get_reduced_vaccinated_susceptible_contri... | StarcoderdataPython |
108338 | import yaml
import inspect
from pcl2depth import velo_points_2_pano
import scipy.io
import numpy as np
import os
from os.path import join
import sys
from tqdm import tqdm
import matplotlib.pyplot as plt
import cv2
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.pat... | StarcoderdataPython |
9673164 | <filename>2017/day24/port.py
#!/usr/bin/env python
import sys
def chainsum(chain):
s = 0
for part in chain:
s += part[0]
s += part[1]
print("DONE %d %d" % (s, len(chain)))
def findlink(part1, part2):
if part1[0] == part2[0] or part1[1] == part2[0]:
return part2[1]
if par... | StarcoderdataPython |
1657980 | <reponame>cuiliang0302/myblog
# Generated by Django 3.1.3 on 2020-11-22 14:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blog', '0014_auto_20201122_1420'),
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
6403938 | <reponame>avaddon/django-polymorphic-tree
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django
from django.db.models import Q
from django.test import TestCase
from polymorphic_tree.managers import PolymorphicMPTTModelManager
from .models import *
class PolymorphicTests(TestCase):
"""
... | StarcoderdataPython |
6602202 | <filename>code/wordclock/__init__.py
'''
The wordclock package
'''
__version__ = '2'
__author__ = '<NAME>'
__author_email__ = '<EMAIL>'
__url__ = 'https://github.com/marksidell/wordclock'
__license__ = '(c) 2021 <NAME>'
__description__ = 'The Word Clock'
| StarcoderdataPython |
11223451 | <gh_stars>0
# -*- coding: utf-8 -*-
# @Time : 2019/7/8 15:19
# @Author : <NAME>
| StarcoderdataPython |
317304 | from sys import argv
from io import FileIO
Test_file_path = "ex15_sample.txt"
def print_all(file: FileIO):
print(file.read())
def rewind(file: FileIO):
file.seek(0)
def print_line(count: int, file: FileIO):
print("%d:\t %s" %(count, file.readline()))
current_file = open(Test_file_path, "r... | StarcoderdataPython |
1879641 | # Copyright 2018 Owkin, 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 agreed to in writing,... | StarcoderdataPython |
6454028 | <reponame>tavioalves/computerscience-psu
# My first program - <NAME>
print("""<NAME>
<EMAIL>
OS X Yosemite
Computer Engineer""")
| StarcoderdataPython |
8089681 | <gh_stars>0
"""
Class to save/restore configuration from file
"""
# CM0004
from __future__ import annotations
import ast
import base64
import logging
import pickle
import xml
import xml.etree.ElementTree as ET
import xml.dom.minidom as DOM
from pathlib import Path
from typing import ClassVar, Dict, List, Optional, ... | StarcoderdataPython |
131944 | """ Management command to create an ApiAccessRequest for given users """
import logging
from contextlib import contextmanager
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.contrib.sites.models import Site
from django.core.management.base import BaseComman... | StarcoderdataPython |
6498952 | #!/usr/bin/env python
# -*- encoding: UTF-8 -*-
# Created by CaoDa on 2021/7/11 13:09
import json
import os
from typing import List
from myvc_app.db_info import DBInfo
from myvc_app.config import DATA_PATH
class DBs:
def __init__(self):
self.dbs = [] # type: List[DBInfo]
def get_db_info_by_id(self... | StarcoderdataPython |
1815351 | '''
@author: doronv
'''
import numpy as np
import math
import re
# read line from file split it according to separator and convert it to type
def processInputLine(inputFile, inputSeparator = ' ', inputNumber = None, inputType = int):
inputLine = inputFile.readline()
if inputNumber == None:
... | StarcoderdataPython |
1993893 | from braces.views import MultiplePermissionsRequiredMixin
from django.contrib import messages
from django.contrib.auth import get_permission_codename
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.sh... | StarcoderdataPython |
6496104 | import discord
from discord import embeds
from discord.ext import commands
import os,datetime,json,sys
import koreanbots
from variable import *
from channels.log_channels import *
from embed.help_embed import *
import other
class on(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.C... | StarcoderdataPython |
1626 | import requests
from sense_hat import SenseHat
import smbus
import time
while True:
try:
pressure=0
sense = SenseHat()
pressure = sense.get_pressure()
data = {'pressure':pressure}
print(pressure)
#send http request to sense serverless function with pressure
#data
r=req... | StarcoderdataPython |
1874777 | <gh_stars>0
#!/usr/bin/env python
#
# note total_ordering makes this Python 2.7 dependent.
#
import os
import time
import urllib
import re
import boto
from functools import total_ordering
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from optparse import make_optio... | StarcoderdataPython |
5180576 | <reponame>schmichael/firewall-admin<filename>firewall-admin/firewalladmin/lib/template.py
import commands, os
import cherrypy
from genshi.core import Stream
from genshi.output import encode, get_serializer
from genshi.template import Context, TemplateLoader
loader = TemplateLoader(
os.path.join(os.path.dirname(__... | StarcoderdataPython |
11372015 | <filename>BreaksPPU/PPU_Python/BaseDemo.py
"""
Demonstration of the use of basic logic primitives.
"""
import os
from BaseLogic import *
if __name__ == '__main__':
# Demonstration of basic logic primitives
a = 0
print ("not(0): ", NOT(a))
a = 0
b = 1
print ("nor(0,1): ", NOR(a, b))
a = 0
b = 1
print (... | StarcoderdataPython |
11359088 | # Example filename: deepgram_test.py
from deepgram import Deepgram
import asyncio, json
import pyaudio
import wave
# the file name output you want to record into
filename = "main.mp4"
# set the chunk size of 1024 samples
chunk = 1024
# sample format
FORMAT = pyaudio.paInt16
# mono, change to 2 if you want stereo
cha... | StarcoderdataPython |
8161907 | import argparse
import numpy as np
import cv2
# Code for parsing command line arguments
parser = argparse.ArgumentParser(description='Captures video from the webcam and saves it to a file')
parser.add_argument('output', type=str, help='name of the output file')
args = parser.parse_args()
cap = cv2.VideoCapture(0)
... | StarcoderdataPython |
6416180 | <reponame>BlackBoxOperator/GotchaTheNames
#!/usr/bin/env python3.6
# coding: utf-8
from tqdm import *
import numpy as np
import time, os, json, csv, re, sys
import shutil
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.... | StarcoderdataPython |
12802115 | #! /usr/bin/env python
"""
Script that uses the CLI module to set a number of attributes for a bulk
account list.
"""
"""
Copyright (c) since 2007, GECAD Technologies. All rights reserved.
For feedback and/or bugs in this script, please send an e-mail to:
"AXIGEN Team" <<EMAIL>>
"""
_CVSID='$Id: set-bulk-accounts.py,... | StarcoderdataPython |
9736708 | <filename>cntapp/migrations/0005_document_thumbnail.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cntapp', '0004_auto_20150410_1020'),
]
operations = [
migrations.AddF... | StarcoderdataPython |
9626373 | <filename>py/vtproto/throttlerservice_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: throttlerservice.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _me... | StarcoderdataPython |
6616457 | <gh_stars>1-10
length=10
width=5
area=length*width
perimeter=2*(length+width)
print(area)
print(perimeter) | StarcoderdataPython |
8129760 | # -*- coding: utf-8 -*-
#
# Convert unicode (encoded as utf-8) to the closest ascii equivalent.
#
# See README.md for more information.
#
# See LICENSE for licensing information.
#
#
# The basic idea is to assemble a regular expression that detects
# unicode that we know about. This happens the first time uni2ascii is
... | StarcoderdataPython |
6446060 | import random
from datetime import datetime
from web3 import Web3
from src.tasks.playlists import parse_playlist_event, lookup_playlist_record
from src.utils.db_session import get_db
from src.utils.playlist_event_constants import playlist_event_types_lookup
from src.utils import helpers
from src.challenges.challenge_ev... | StarcoderdataPython |
3406099 | from django.conf.urls import url
from resources import views
urlpatterns = [
url(r'^(?P<resource_id>[0-9]+)/(?P<action>likes|unlikes)$',
views.ResourceVoteView.as_view(), name='resource_vote'),
url(r'^create$', views.CommunityView.as_view(), name='resource_create'),
url(r'^ajax/community/(?P<commun... | StarcoderdataPython |
4937404 | <filename>LintCode/uncategorized/196. Missing Number/.ipynb_checkpoints/solution-checkpoint.py
class Solution:
"""
@param nums: An array of integers
@return: An integer
"""
def findMissing(self, nums):
# write your code here
nums.sort()
i = 0
while i < len(nums):
... | StarcoderdataPython |
112385 | <reponame>romybauch/IML.HUJI
import numpy as np
from IMLearn.learners.classifiers import Perceptron, LDA, GaussianNaiveBayes
from typing import Tuple
from utils import *
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from math import atan2, pi
def load_dataset(filename: str) -> Tuple[np.... | StarcoderdataPython |
304172 | # Generated by Django 2.2.1 on 2019-08-07 10:50
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Feed',
fields=[
('id', mode... | StarcoderdataPython |
9613145 | <reponame>ondrejholecek/fortimonitor
from GenericModel import GenericModel, NICCounters, NICDrops
class Model(GenericModel):
def init(self):
self.gen_ports()
self.np6 = [0]
def gen_ports(self):
hwnic_kernel = NICCounters(NICCounters.SRC_HWNIC, "kernel", NICCounters.SPD_IFACE)
xestats0_0 = NICCounte... | StarcoderdataPython |
315418 | import errno
import os
import stat
from unittest import mock
import pytest
from outrun.filesystem.service import LocalFileSystemService
from outrun.filesystem.caching.service import LocalCacheService
from outrun.filesystem.caching.filesystem import RemoteCachedFileSystem
from outrun.filesystem.caching.cache import Re... | StarcoderdataPython |
9735214 | <reponame>archibate/h2os
#!/usr/bin/env python
regs = 'bDSd'
vregs = ['ebx', 'edi', 'esi']
print('''#pragma once\n''')
print('''#include <l4/sys/syskip.h>\n''')
print('''#define _$E(x) x''')
def mksys(nx, ny):
print('''
#define _SYS%d%d(rett, func''' % (nx, ny) + \
''.join([', t%d, x%d' % (i,i) for i in ... | StarcoderdataPython |
40280 | # -*- coding: utf-8 -*-
from .fetcher import from_all
| StarcoderdataPython |
50095 | from __future__ import division
from __future__ import print_function
import os
import glob
import time
import random
import argparse
import numpy as np
import torch
import torchvision.models as models
import torch.autograd.profiler as profiler
import torch.nn as nn
import torch.nn.functional as F
import torch.optim a... | StarcoderdataPython |
8167550 | #!/usr/bin/python3
import argparse
import collections
from collections import defaultdict
import imageio
import numpy as np
from pathlib import Path
import pdb
from typing import Any, List, Mapping, Tuple
from mseg.utils.multiprocessing_utils import send_list_to_workers
from mseg.utils.txt_utils import generate_all_... | StarcoderdataPython |
6520216 | '''
Unittests/General/Mapping/hashable
__________________________________
Test suite for hashable, mapping object definitions.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
'''
# load modules/submodules
import uni... | StarcoderdataPython |
4888882 | <reponame>JessyLeal/flyfood<gh_stars>1-10
lista = ['oi', 'bem', 'meu']
a, b = lista.index('bem'), lista.index('meu')
lista[b], lista[a] = lista[a], lista[b]
print(lista) | StarcoderdataPython |
1734350 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
TESTS_DIR = os.path.dirname(__file__)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
INSTALLED_APPS = [
"django.contrib.sessions",
"django.contrib.auth",
"django.contrib.contenttyp... | StarcoderdataPython |
56758 | # -*- coding: utf-8 -*-
# Copyright (c) ©2019, Cardinal Operations and/or its affiliates. All rights reserved.
# CARDINAL OPERATIONS PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
# @author: <EMAIL>
# @date: 2019/10/03
import decimal
import math
import typing
from marshmallow.fields import Integer, Flo... | StarcoderdataPython |
4865986 | #selection by level
#.loc[row start idx : row end idx, column start name : column end name]
import pandas as pd
data = {'Name':['Nahid','Hassan', 'Mursalin', 'Rafi', 'Rakib'],
'Year':[2018,2018,2018,2018,2018],
'Income':['5 core','10 core','3 core','7 core','6 core'],
'Age':[21,22,21,22,23],
... | StarcoderdataPython |
3470031 | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_tldsearch
# Purpose: SpiderFoot plug-in for identifying the existence of this target
# on other TLDs.
#
# Author: <NAME> <<EMAIL>>
#
# Created: 31/08/2013
# Copyright... | StarcoderdataPython |
11286673 | <filename>tests/ast/cairo-keywords-for-names_test.py
import pytest
from utils import check_ast
from warp.yul.Renamer import MangleNamesVisitor
@check_ast(__file__)
def test_changing_names(ast):
return MangleNamesVisitor().map(ast)
| StarcoderdataPython |
3352432 | import pandas as pd
ATTRIBUTES = {
"type0": {"be", "bg", "ur", "vi"},
"type1": {"ga"},
"type2": {"mhr", "mt", "ug", "wo"},
"latin": {"ga", "mt", "vi", "wo"},
"cyrillic": {"be", "bg", "mhr"},
"arabic": {"ug", "ur"},
"all": {"be", "bg", "ga", "mhr", "mt", "ug", "ur", "vi", "wo"},
}
COMMON_LA... | StarcoderdataPython |
6526736 | from django.apps import AppConfig
class SchemesConfig(AppConfig):
name = 'schemes'
| StarcoderdataPython |
9775288 | <filename>20210916/demo.py
import re
from collections import Counter
import pdb
def words(text): return re.findall(r"w", text.lower())
with open("big.txt", "r") as f:
t = f.read()
def calculate_frequency(tokens):
frequency = {}
for t in tokens:
try:
frequency[t] += 1
except:
... | StarcoderdataPython |
9726253 | """
pylatch.processlatch のユニットテストが定義されています。
REFERENCES::
http://d.hatena.ne.jp/pythonco/20061015/p3
https://www.yoheim.net/blog.php?q=20160903
https://docs.python.jp/3/library/doctest.html
"""
import unittest as ut
import doctest as dc
import pylatch.processlatch as pl
class TestCountDownLatch(ut.TestCase):
"""p... | StarcoderdataPython |
3396257 | from django import forms
from django.forms.models import inlineformset_factory
from .models import Course, Module
ModuleFormSet = inlineformset_factory(
Course,
Module,
fields= ['title', 'description... | StarcoderdataPython |
6453113 | <reponame>ankitrajbiswal/SEM_5
n=input("Enter the number -> ")
s=0
for _ in iter(int, 1):
if n=='':
break
s+=int(n)
n=input("Enter the number -> ")
print (s) | StarcoderdataPython |
5059483 | # init file for the config module | StarcoderdataPython |
3489764 | #!/usr/bin/env python3
import os,sys
import ctypes
import time
from smvScope import lib61850
import json
from datetime import datetime
import types
from flask import Flask, Response, render_template, request
import socket
from struct import unpack
import threading
import binascii
application = Flask(__name__)
con... | StarcoderdataPython |
1797144 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import compas_ghpython.utilities
from compas.artists import PrimitiveArtist
from compas.colors import Color
from .artist import GHArtist
class PointArtist(GHArtist, PrimitiveArtist):
"""Artist for drawing... | StarcoderdataPython |
221971 | import pandas as pd
import numpy as np
from imblearn.metrics import specificity_score
from sklearn import metrics
def eval_precision(gt, pred, average='macro'):
if type(gt) is pd.core.frame.DataFrame or type(gt) is pd.core.frame.Series:
return metrics.precision_score(gt.fillna(0.0), pred.fillna(0.0), aver... | StarcoderdataPython |
3265949 | """This is a OCR with rule based model for finding question candidates.
"""
from .model import Model
from typing import List
from .popo import Question
from correlator.correlation import Correlation
from .popo import BaseQuestion
class OCRModel(Model):
def __init__(self) -> None:
super().__init__()
... | StarcoderdataPython |
6440894 | import abc
import json
from typing import Callable, Type, TypeVar, Generic, Any, Union
from amino import List, Either, __, Left, Eval, ADT, Right, Try, Path, Map, Lists
from amino.do import do, Do
from amino.boolean import false, true
from amino.json.decoder import decode_json_type
from ribosome.nvim.io.compute impor... | StarcoderdataPython |
4935287 | <filename>meson/post_install.py
#!/usr/bin/env python3
import os, sys, shutil, stat, subprocess
# get absolute input and output paths
input_path = sys.argv[1]
# make sure destination directory exists
os.makedirs(os.path.dirname(input_path), exist_ok=True)
for directory, subdirectories, files in os.walk(input_pa... | StarcoderdataPython |
6654007 | # SPDX-FileCopyrightText: 2020 <NAME>
#
# SPDX-License-Identifier: MIT
"""Decoder interfaces for SIRC protocol."""
class DecodeException(Exception):
"""Raised when a set of pulse timings are not a valid SIRC command."""
class SIRCDecodeException(DecodeException):
pass
class NECDecodeException(DecodeExcep... | StarcoderdataPython |
11383055 | import argparse
import os
import sys
import numpy as np
parser = argparse.ArgumentParser(description="run sphere synt test")
parser.add_argument("--cfg", default="configs/gdrn_sphere_synt/a6_cPnP_sphere.py", help="cfg path")
parser.add_argument("--ckpt", default="output/gdrn_sphere_synt/a6_cPnP_sphere/model_final.pth"... | StarcoderdataPython |
9731250 | '''
@ Author: <NAME>, songkai13 _at_ iccas.ac.cn
@ Notes : 1. Here I use RNN-LSTM to learn the pattern of our curves. We could see that the peaks is
relatively hard to learn. This is straightforward to understand. Physically, we could regrad
these bumps as rare events in the rate theory.
@... | StarcoderdataPython |
8196421 | <reponame>odemiral/Bluepost-Crawler
class Configuration(object):
def __init__(self):
#TODO: parse .us and en separately to give users option to change language and location.
self.bnet_diablo_url = 'http://us.battle.net/d3/en/forum/blizztracker/'
self.bnet_sc2_url = 'http://us.battle.net/s... | StarcoderdataPython |
9726438 | <reponame>pcaston/core
"""Class to hold all lock accessories."""
import logging
from pyhap.const import CATEGORY_DOOR_LOCK
from openpeerpower.components.lock import DOMAIN, STATE_LOCKED, STATE_UNLOCKED
from openpeerpower.const import ATTR_CODE, ATTR_ENTITY_ID, STATE_UNKNOWN
from openpeerpower.core import callback
fr... | StarcoderdataPython |
9625799 | <gh_stars>100-1000
import math
import diffrax
import jax
import jax.numpy as jnp
import jax.random as jrandom
import pytest
import scipy.stats as stats
_vals = {
int: [0, 2],
float: [0.0, 2.0],
jnp.int32: [jnp.array(0, dtype=jnp.int32), jnp.array(2, dtype=jnp.int32)],
jnp.float32: [jnp.array(0.0, dty... | StarcoderdataPython |
6703069 | import numpy as np
from src.activation_functions import ReLU, Softmax, LeakyReLU
from src.evaluation import plot_loss_and_accuracy, accuracy
from src.loss_functions import SquaredLoss
from src.neural_net.layers import InputLayer, Layer
from src.neural_net.network import NeuralNetwork
from src.preprocessing import to_ca... | StarcoderdataPython |
8068842 | <filename>Mundo3/Desafio085b.py
num = [[],[]]
valor = 0
for c in range(1, 8):
valor = int(input('Digite um numero: '))
if valor % 2 == 0:
num[0].append(valor)
else:
num[1].append(valor)
num[0].sort()
num[1].sort()
print(num)
| StarcoderdataPython |
5093063 | <reponame>rystrauss/bax<filename>bax/utils.py
import os
def set_jax_memory_preallocation(value: bool):
os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"] = "true" if value else "false"
def set_tf_memory_preallocation(value: bool):
from tensorflow import config
gpus = config.list_physical_devices("GPU")
if... | StarcoderdataPython |
11262644 | <reponame>strickergt128/tytus<filename>parser/team08/Tytus_SQLPARSER_G8/nodo_arbol.py
class Nodo_Arbol():
def __init__(self,valor,tipo):
self.valor=valor
self.tipo=tipo
self.hijos=[]
def agregarHijo(self,hijo):
self.hijos.insert(hijo) | StarcoderdataPython |
4934841 | import plotly.figure_factory as ff
import pandas as pd
import csv
df=pd.read_csv("data.csv")
fig=ff.create_distplot([df["Weight(Pounds)"].tolist()],["Weight"],show_hist=False)
fig.show() | StarcoderdataPython |
4834720 | import gng2
from pygraph.classes.graph import graph
from pygraph.algorithms.minmax import cut_tree
from pygraph.algorithms.accessibility import connected_components
from utils import __dict_reverse as dict_reverse
import itertools
import time
from numpy import array,sum,sqrt
class data_block:
"""This is ... | StarcoderdataPython |
3455794 | <reponame>Lookin44/KVINT_test_bot<filename>main.py
from connector.bot_for_telegram import main
main()
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.