id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
9745155 | # USAGE
# python /home/nmorales/cxgn/DroneImageScripts/ImageProcess/RemoveBackground.py --image_path /folder/mypic.png --outfile_path /export/mychoppedimages/outimage.png
# import the necessary packages
import argparse
import imutils
import cv2
import numpy as np
import math
# construct the argument parse and parse t... | StarcoderdataPython |
11367794 | <reponame>tdiprima/code
class itemproperty(object):
def __init__(self, fget=None, fset=None, fdel=None, doc=None):
if doc is None and fget is not None and hasattr(fget, "__doc__"):
doc = fget.__doc__
self._get = fget
self._set = fset
self._del = fdel
self.__doc__... | StarcoderdataPython |
6610117 | <filename>bbcprc/old/files.py
import contextlib
import os
def with_suffix(root, suffix=None):
for f in os.listdir(root):
if not suffix or f.endswith(suffix):
yield os.path.join(root, f)
@contextlib.contextmanager
def delete_on_fail(fname, mode='wb', open=open, delete=True):
with open(fna... | StarcoderdataPython |
11207087 | # Copyright 2022 Google 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 applicable law or agreed to in writing, ... | StarcoderdataPython |
24685 | <gh_stars>1-10
import gzip
import numpy as np
import os
import pandas as pd
import shutil
import sys
import tarfile
import urllib
import zipfile
from scipy.sparse import vstack
from sklearn import datasets
from sklearn.externals.joblib import Memory
if sys.version_info[0] >= 3:
from urllib.request import urlretrie... | StarcoderdataPython |
4925091 | from typing import Optional
from .event import Event
from .event import NONAME
from .output import Output, ConsoleOutput, FileOutput
class Core(Output):
project: str
env: str
console_output: Optional[ConsoleOutput]
file_output: Optional[FileOutput]
"""
Core 维护着日志系统的输出器(包括命令行输出器和文件输出器),保持全局配置... | StarcoderdataPython |
306285 | <gh_stars>10-100
class TestDemo:
print('testing')
| StarcoderdataPython |
16705 | from systems.plugins.index import BaseProvider
import os
class Provider(BaseProvider('task', 'upload')):
def execute(self, results, params):
file_path = self.get_path(self.field_file)
if not os.path.exists(file_path):
self.command.error("Upload task provider file {} does not exist".... | StarcoderdataPython |
3241909 | <reponame>shantanusharma/bigmler<filename>bigmler/whizzml/dispatcher.py
# -*- coding: utf-8 -*-
#
# Copyright 2016-2020 BigML
#
# 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://ww... | StarcoderdataPython |
6626215 | # Copyright (c) 2015 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'test-compile-as-managed',
'type': 'executable',
'msvs_settings': {
'VCCLCompilerTool': {
... | StarcoderdataPython |
3251813 | # See https://github.com/confluentinc/confluent-kafka-python
from confluent_kafka.admin import AdminClient, NewTopic
app_settings = {
"bootstrap.servers": "TODO",
"topics": [
"topic1",
"topic2",
],
}
a = AdminClient({"bootstrap.servers": app_settings["bootstrap.servers"]})
# Note: In ... | StarcoderdataPython |
4884236 | <reponame>ezekielkibiego/projects254
# Generated by Django 2.2.24 on 2022-02-12 12:17
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Project',
fields=[
... | StarcoderdataPython |
6422045 | <reponame>gembcior/FortressTools<filename>src/fortresstools/command/__init__.py<gh_stars>0
from .base import UnsupportedExecutor
from .dir import *
from .git import *
from .cmake import *
from .pip import *
from .venv import *
from .rsync import *
from .svn import *
from .test import *
| StarcoderdataPython |
6618548 | <reponame>baggakunal/learning-python<filename>src/prime_number.py
from math import sqrt
def is_prime(num: int) -> bool:
if num < 2:
return False
for i in range(2, int(sqrt(num)) + 1):
if num % i == 0:
return False
return True
def main():
print([n for n in range(101) if is... | StarcoderdataPython |
3458579 | from svbench.io_tools import *
from svbench.quant_tools import *
from svbench.loaders import * | StarcoderdataPython |
9659937 | <reponame>MaciejTe/integration
# Copyright 2021 Northern.tech AS
#
# 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 r... | StarcoderdataPython |
5128469 | from .alexnet import AlexNetV1, AlexNetV2, AlexNetV3
from .resnet import ResNet
from .resnet2plus1d import ResNet2Plus1d
from .resnet3d import ResNet3d
from .resnet3d_csn import ResNet3dCSN
from .resnet3d_slowfast import ResNet3dSlowFast
from .resnet3d_slowonly import ResNet3dSlowOnly
from .resnet_tin import ResNetTIN
... | StarcoderdataPython |
8034011 | <reponame>marici/recipebook
# -*- coding: utf-8 -*-
'''
The MIT License
Copyright (c) 2009 Marici, 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 limi... | StarcoderdataPython |
6665419 | <reponame>sbruch/xe-ndcg-experiments<filename>lib.py<gh_stars>1-10
import math
import numpy as np
import random
import lightgbm as gbm
class SplitConfig(object):
def __init__(self, population_pct, sample_size, transformations=None):
"""Creates a split configuration.
Args:
population_pct: (float) T... | StarcoderdataPython |
372799 | #!/usr/bin/env python3
# pylint: disable=missing-docstring,too-many-public-methods
import pathlib
import shutil
import tempfile
import time
import unittest
import uuid
from typing import List, Optional # pylint: disable=unused-import
import zmq
import persizmq
import persizmq.filter
class TestContext:
def __i... | StarcoderdataPython |
9696920 | # ai.py
#
# Author: <NAME>
# Created On: 21 Feb 2019
import numpy as np
from . import astar
SEARCH_TARGET = 0
MOVE = 1
class AI:
def __init__(self, player):
self.player = player
self.path = []
self.state = SEARCH_TARGET
self.weight_self = 3
self.weight_enemy = 6
se... | StarcoderdataPython |
6537889 | #!/usr/bin/env python2
import random
import math
import copy
from Spell import *
class Pokemon:
def __init__(self, name, baseHp, lifePerLevel, attack, attackPerLevel, baseDef, defencePerLevel, spells, elements):
self.level = 1
self.exp = 0
self.name = name
self.baseHp = baseHp
... | StarcoderdataPython |
6502011 | from attr import Factory, NOTHING
from prettyprinter.prettyprinter import pretty_call_alt, register_pretty
def is_instance_of_attrs_class(value):
cls = type(value)
try:
cls.__attrs_attrs__
except AttributeError:
return False
return True
def pretty_attrs(value, ctx):
cls = type(... | StarcoderdataPython |
11287236 | # -*- coding: utf-8 -*-
# Copyright (c) 2019 - 2021 Geode-solutions
#
# 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, co... | StarcoderdataPython |
6649675 | <reponame>ethansaxenian/RosettaDecode
LONGMONTHS = (1, 3, 5, 7, 8, 10, 12) # Jan Mar May Jul Aug Oct Dec
def fiveweekendspermonth2(start=START, stop=STOP):
return [date(yr, month, 31)
for yr in range(START.year, STOP.year)
for month in LONGMONTHS
if date(yr, month, 31).timetuple(... | StarcoderdataPython |
328889 | from manim import *
class s08b_Algorithms_Activity(Scene):
def construct(self):
# Actors.
title = Text("Algorithms")
subtitle = Text("(Activity)").scale(0.75)
# Positioning.
title.shift(0.50*UP)
subtitle.next_to(title, DOWN)
# Animations.
actors = [title, subtitle]
for actor in actors:
... | StarcoderdataPython |
6656577 | # Copyright (c) 2012-2021, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon Elastic File System"
prefix = "elasticfilesystem"
class Action(BaseAction):
def __init__(self, action: str = None) -> No... | StarcoderdataPython |
1850660 | <filename>libs/helpers.py
from ncclient import manager
from lxml import etree
def get_running_config(ip, port, uname, pw, device_params):
session = manager.connect(host=ip, port=port, username=uname, password=pw, device_params=device_params, hostkey_verify=False)
config = session.get_config(source='running').d... | StarcoderdataPython |
3519367 | # -*- coding:utf-8 -*-
from conf import *
from utils import *
import abc
class CNNModel(metaclass=abc.ABCMeta):
def __init__(self, param):
# input_shape = x_train.shape[1:]
self.param = param
self.train_poison = None
self.test_poison = None
self.classifier = None
def ... | StarcoderdataPython |
115214 | <filename>yj_anova_test.py
#coding:utf-8
from scipy import stats
import numpy as np
from pandas import Series,DataFrame
from openpyxl import load_workbook
import math
import uuid
import os
def chart(data_ws,result_ws):
pass
def _produc_random_value(mean,stdrange):
b = np.random.uniform(*stdrange)
a = b/ma... | StarcoderdataPython |
4886512 | <gh_stars>0
""" Swagger documentation. """
INDEX = {
"responses": {
"200": {
"description": "A greeting."
}
},
}
| StarcoderdataPython |
8060658 | # -*- coding: utf-8 -*-
from django.shortcuts import HttpResponse, render_to_response
from django.http import HttpResponseRedirect
from django.contrib.admin.views.decorators import staff_member_required
from django.utils.translation import ugettext as _
from grappelli.models.bookmarks import Bookmark, BookmarkItem
fr... | StarcoderdataPython |
9605754 | <reponame>mohibeyki/remoteAPI<filename>remoteAPI/exceptions.py
#!/usr/bin/env python3
from rest_framework import status
class ServiceError(Exception):
"""
Base class for microservice errors
Typically a Http response is generated from this.
"""
def __init__(self, type, message, suggested_http_stat... | StarcoderdataPython |
389815 | <filename>DD/IP/TEMPLATES/Session 3/propContours.py
############################################
## PROJECT CELL
## Image Processing Workshop
############################################
## Import OpenCV
import numpy
import cv2
############################################
## Read the image
img = cv2.imread('map.png')... | StarcoderdataPython |
6544032 | import pandas as pd
import numpy as np
import altair as alt
import streamlit as st
import sys, argparse, logging
import json
def spell(spell_inputs):
mana = spell_inputs
x_col = st.selectbox("Select x axis for line chart", mana.columns)
xcol_string = x_col + ":O"
if st.checkbox("Show as continuous?",... | StarcoderdataPython |
1819465 | #!/usr/bin/env Python3
'''
TypeLoader backend functionality
'''
| StarcoderdataPython |
3460864 | <reponame>danmar3/twodlearn<gh_stars>0
# ***********************************************************************
# General purpose optimizer
#
# Wrote by: <NAME> (<EMAIL>)
# Modern Heuristics Research Group (MHRG)
# Virginia Commonwealth University (VCU), Richmond, VA
# http://www.people.vcu.edu/~mmanic/
... | StarcoderdataPython |
178866 | def _longest_common_subsequence(s1: str, s2: str) -> int:
"""
Let m and n be the lengths of two strings.
Build L[m+1][n+1] from the bottom up.
Note: L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1]
Runtime: O(mn)
Space Complexity: O(mn)
"""
m, n = len(s1), len(s2)
L = [[0] ... | StarcoderdataPython |
1845176 | <gh_stars>0
import asterid as ad
def asterid_dm_to_dendropy_dm(D, ts):
pdm = dendropy.PhylogeneticDistanceMatrix()
pdm.taxon_namespace = dendropy.TaxonNamespace()
pdm._mapped_taxa = set()
for i in range(len(ts)):
for j in enumerate(ts):
si = ts[i]
sj = ts[j]
... | StarcoderdataPython |
3254314 | <filename>cogs/misc.py
import datetime
import asyncio
import strawpy
import random
import re
import sys
import subprocess
from PythonGists import PythonGists
from appuselfbot import bot_prefix
from discord.ext import commands
from cogs.utils.checks import *
'''Module for miscellaneous commands'''
class Misc:
de... | StarcoderdataPython |
1786879 | <filename>polyA/fill_consensus_position_matrix.py
from typing import Dict, List, Tuple
from .matrices import ConsensusMatrixContainer
from .performance import timeit
@timeit()
def fill_consensus_position_matrix(
row_count: int,
column_count: int,
start_all: int,
subfams: List[str],
chroms: List[s... | StarcoderdataPython |
5089534 | <reponame>lelechen63/idinvert_pytorch
import numpy as np
import cv2, PIL.Image
# show image in Jupyter Notebook (work inside loop)
from io import BytesIO
from IPython.display import display, Image
def show_img_arr(arr, bgr_mode = False):
if bgr_mode is True:
arr = cv2.cvtColor(arr, cv2.COLOR_BGR2RGB)
... | StarcoderdataPython |
8016443 | <filename>caldavclientlibrary/protocol/url.py
##
# Copyright (c) 2007-2016 Apple 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 of the License at
#
# http://www.apache.org/licenses/L... | StarcoderdataPython |
3525205 | <filename>prepare_verbs.py
import jsonpickle as jp
from utils import open_file, write_file, collator
jp.set_encoder_options('simplejson', sort_keys=True, indent=4, ensure_ascii=False)
content = open_file('input/monlam_verbs.json')
json = jp.decode(content)
dadrag = open_file('input/dadrag_syllables.txt').strip().spli... | StarcoderdataPython |
1744126 | import io
from typing import BinaryIO, Optional
from .base import CIOType, CFixedType
from .buffer import c_buffer
from ..encoding import auto_decode
__all__ = [
'CStringType',
'c_str',
'CSizedStringType',
'c_sized_str',
]
def _auto_encode(s: str, encoding) -> bytes:
return s.encode(encoding if ... | StarcoderdataPython |
6703249 | # Copyright (c) 2015-2021 <NAME> and contributors.
# mc3 is open-source software under the MIT license (see LICENSE).
__all__ = [
'ROOT',
'ignore_system_exit',
'parray',
'saveascii', 'loadascii',
'savebin', 'loadbin',
'isfile',
'burn',
'default_parnames',
]
import os
import sys
imp... | StarcoderdataPython |
8148429 | import sys
# ######################
if len(sys.argv) != 2:
print "need an input file"
exit(1)
f = open(sys.argv[1])
transitions = {}
starting = None
for line in f:
line = line.strip()
if "=>" in line:
line = line.split("=>")
start = line[0].strip()
end = line[1].strip()
... | StarcoderdataPython |
11395308 | <reponame>ali493/pyro
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 6 15:27:04 2016
@author: alex
"""
import numpy as np
###########################
# Load libs
###########################
from AlexRobotics.dynamic import Manipulator
from AlexRobotics.control import linear
from AlexRobotics.control import Com... | StarcoderdataPython |
1634639 | <filename>crnn/metrics/__init__.py
# -*- coding: utf-8 -*-
# @Time : 2021/2/22 17:17
# @Author : JianjinL
# @eMail : <EMAIL>
# @File : __init__
# @Software : PyCharm
# @Dscription: 准确率指标
from crnn.metrics.sequenceAcc import SequenceAccuracy
from crnn.metrics.editDistanceAcc import EditDistance
from c... | StarcoderdataPython |
1727202 | <filename>src/dashView/initializeData.py
from src.kMerAlignmentData import KMerAlignmentData
from src.kMerPCAData import KMerPCAData
from src.kMerScatterPlotData import KMerScatterPlotData
from src.processing import Processing
import src.layout.plot_theme_templates as ptt
import plotly.express as px
from src.secStruct... | StarcoderdataPython |
3228869 | from django.db import models
class LiveQuerySet(models.query.QuerySet):
def delete(self):
# Override Django's built-in default.
self.soft_delete()
def soft_delete(self):
self.update(live=False)
def hard_delete(self):
# Default Django behavior.
super(LiveQuerySet,... | StarcoderdataPython |
6514485 | import kabusapi
url = "localhost"
port = "18081" # 検証用, 本番用は18080
# 初期設定 PUSH配信にトークン・パスワードは不要
api = kabusapi.Context(url, port, )
# 受信用関数 情報が受信される度にここが呼ばれる
@api.websocket
def recieve(msg):
print(msg)
# ここで処理を行う
# 受信開始
api.websocket.run()
| StarcoderdataPython |
6599444 | <filename>cola/amt_connector/publish_hits.py
'''publish batches of HITs on MTurk'''
import time
import json
import configparser
import os
import aws_config
from slurk_link_generator import insert_names_and_tokens
RESULTS = []
SLIDES = ['https://raw.githubusercontent.com/nattari/cola_instructions/master/cola_inst_001... | StarcoderdataPython |
1829195 | <filename>setup.py
#!/usr/bin/env python
import sys
import os
from setuptools import setup
from tempita_lite import __version__ as version
setup(name='Tempita-lite',
version=version,
description="A very small text templating language",
long_description="""\
Tempita-lite is a small templating langua... | StarcoderdataPython |
6667061 | from PIL import Image
import math
import sys
def getbytes(bitData):
byteLength = math.ceil(len(bitData)/4)
byteData = bytearray(byteLength)
bitConvert = [0] * 4
for i in range(byteLength):
bitConvert[0] = bitData[4*i]
bitConvert[1] = (bitData[4*i + 1])<<2
bitConvert[2] = (bitDat... | StarcoderdataPython |
9713342 | from theplease.specific.git import git_support
@git_support
def match(command):
return (' rm ' in command.script and
'error: the following file has local modifications' in command.output and
'use --cached to keep the file, or -f to force removal' in command.output)
@git_support
def get_n... | StarcoderdataPython |
3389102 | <gh_stars>1-10
from ulauncher.api.client.Extension import Extension
from ulauncher.api.client.EventListener import EventListener
from ulauncher.api.shared.event import KeywordQueryEvent, ItemEnterEvent
from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem
from ulauncher.api.shared.action.RenderR... | StarcoderdataPython |
113659 | from geneal.genetic_algorithms._binary import BinaryGenAlgSolver
from geneal.genetic_algorithms._continuous import ContinuousGenAlgSolver
| StarcoderdataPython |
1771868 | <reponame>FreibergVlad/port-scanner<filename>test/core/layers/inet/ip/test_ip_packet.py
from unittest import TestCase
from nally.core.layers.inet.ip.ip_diff_service_values import IpDiffServiceValues
from nally.core.layers.inet.ip.ip_ecn_values import IpEcnValues
from nally.core.layers.inet.ip.ip_fragmentation_flags im... | StarcoderdataPython |
8061460 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import zbar
import requests
from PIL import Image
from io import BytesIO
from numpy import array, uint8
import base64
import urllib
import json
import logging
scanner = zbar.Scanner()
def decode(string):
try:
return str(
base64.urlsafe_... | StarcoderdataPython |
1989811 | import argparse
import os
import time
import data_generator
from rpy2.robjects.packages import importr
import rpy2.robjects as robjects
from threading import Thread
R = robjects.r
import rpy2.robjects.numpy2ri
rpy2.robjects.numpy2ri.activate()
import numpy as np
parser = argparse.ArgumentParser(description='Descrip... | StarcoderdataPython |
267139 | <gh_stars>0
# Rinobot-plugin python helpers
# API docs at http://github.com/rinocloud/rinobot-plugin
# Authors:
# <NAME> <<EMAIL>>
from .plugin import *
| StarcoderdataPython |
6440160 | # Generated by Django 3.2.7 on 2021-10-24 00:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('room', '0010_auto_20211023_2132'),
('asks', '0007_auto_20211021_2149'),
]
operations = [
migrations... | StarcoderdataPython |
8128309 | x = None
y = None
z = None
import time
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
x = 10
y = 20
z = 12
mc.player.setPos(x, y, z)
while True:
x, y, z = mc.player.getPos()
mc.setBlock(x, y, z, 35.1)
time.sleep(.2)
| StarcoderdataPython |
328230 | <reponame>ShawYN/StyleGAN_Image_Detecting
import torch
import torch.nn as nn
import torchvision
import numpy as np
from .BasicModule import BasicModule
print("PyTorch Version: ",torch.__version__)
print("Torchvision Version: ",torchvision.__version__)
__all__ = ['ResNet50', 'ResNet101','ResNet152']
def Co... | StarcoderdataPython |
5195037 | <gh_stars>0
try:
from urllib.parse import urlparse, ParseResult
except ImportError:
from urlparse import urlparse, ParseResult
from twilio.rest import Client as TwilioClient
from twilio.rest.api import Api as TwilioApi
from twilio.base.exceptions import TwilioRestException
from twilio.base import deserialize, value... | StarcoderdataPython |
3495668 | import random
import wsnsimpy.wsnsimpy_tk as wsp
SOURCE = 35
###########################################################
class MyNode(wsp.Node):
tx_range = 100
##################
def init(self):
super().init()
self.recv = False
##################
def run(self):
if self.id... | StarcoderdataPython |
11299147 | from django.urls import include, path
from django.views.generic import ListView, DetailView
from places.models import Chain, Place
app_name = "places"
urlpatterns = [
path("chains/", ListView.as_view(model=Chain), name="chain_list"),
path("chain/<slug:slug>", DetailView.as_view(model=Chain), name="chain_deta... | StarcoderdataPython |
374591 | import logging
import yfinance
class StockDataProvider:
def download_between_dates(self, ticker, interval, start, end):
logging.debug("Requesting ticker {}".format(ticker))
opts = dict(
tickers=ticker, interval=interval, start=start, end=end, progress=False
)
return yf... | StarcoderdataPython |
3532962 | # 幅優先探索
H, W = map(int, input().split())
S = [input() for _ in range(H)]
def f(i, j):
t = [[-1] * W for _ in range(H)]
t[i][j] = 0
q = [(i, j)]
while q:
y, x = q.pop(0)
if y - 1 >= 0 and S[y - 1][x] != '#' and t[y - 1][x] == -1:
t[y - 1][x] = t[y][x] + 1
q.appen... | StarcoderdataPython |
8146253 | <filename>refactor_csp.py
# -*- coding: utf-8 -*-
import os
import shutil
import glob
from bs4 import BeautifulSoup
# ビールの絵文字
created_marc = u"\U0001F37A"
# 寿司の絵文字
completed_marc = u"\U0001F363"
def main():
current_dir = os.getcwd()
target_htmls = []
for f in get_all_html_files(current_dir):
if(f... | StarcoderdataPython |
1659284 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 CERN.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Base provider tests."""
import pytest
from flask_babelex import lazy_gettext as _
from invenio... | StarcoderdataPython |
3262349 | <filename>py/gps_building_blocks/cloud/workflows/futures_test.py
# python3
# coding=utf-8
# Copyright 2020 Google 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.apach... | StarcoderdataPython |
11283613 | <gh_stars>0
# Read in an Apple II ROM, do some optional modifications,
# then write out the bytes as an Arduino header file
# <NAME>, May 2016
from convert_roms_arduino import *
dir = '/Users/chris/AppleII/ROMs/'
inputFile = 'AppleIIPlus-341-0020-ApplesoftBasicAutostartMonitorF800-2716.bin'
# inputFile = 'Apple IIe CD... | StarcoderdataPython |
6407328 | import shutil
from pathlib import Path
import gdown
import tqdm
URLS = [
'https://drive.google.com/uc?export=download&id=0BwmD_VLjROrfTHk4NFg2SndKcjQ', # CNN stories
'https://drive.google.com/uc?export=download&id=0BwmD_VLjROrfM1BxdkxVaTY2bWs', # Daily Mail stories
]
DOWNLOAD_PATH = Path('downloaded')
TARG... | StarcoderdataPython |
352706 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-14 01:34
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20160413_2209'),
]
operations = [
migrations.Alte... | StarcoderdataPython |
6600184 | <filename>tests/integration/conftest.py
import pytest
from dotlock import resolve
@pytest.fixture(name='aiohttp_resolved_requirements')
async def resolve_aiohttp_requirements(event_loop):
requirements = [
resolve.Requirement(
info=resolve.RequirementInfo.from_specifier_str('aiohttp', '==3.1.2... | StarcoderdataPython |
8169289 | #!/usr/bin/python
#coding:utf-8
# ***************************************************************
# 绘制正态分布曲线
# author: pruce
# email: <EMAIL>
# date: 20180919
# ***************************************************************
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
de... | StarcoderdataPython |
202550 | #MenuTitle: Make bottom left node first
# -*- coding: utf-8 -*-
__doc__="""
Makes the bottom left node in each path the first node in all masters
"""
def left(x):
return x.position.x
def bottom(x):
return x.position.y
layers = Glyphs.font.selectedLayers
for aLayer in layers:
for idx, thisLayer in enumerate(a... | StarcoderdataPython |
6549123 | """Faça um programa que leia o ano de nascimento de um jovem e informe,
de acordo com a sua idade:
- Se ele ainda vai se alistar ao serviço militar
- Se é a hora de se alistar
- Se já passou do tempo do alistamento
Seu programa também deverá mostrar o tempo que falta ou que passou do prazo.
"""
import datetime
import ... | StarcoderdataPython |
6657613 | <reponame>M155K4R4/Tensorflow
# Copyright 2017 The TensorFlow Authors. 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
... | StarcoderdataPython |
4979848 | from typing import Pattern
from recognizers_text import RegExpUtility
from ...resources.chinese_date_time import ChineseDateTime
from ..parsers import DateTimeParser
from ..base_merged import MergedParserConfiguration
from .duration_parser import ChineseDurationParser
from .date_parser import ChineseDateParser
from .... | StarcoderdataPython |
5096573 | <filename>Core/BehaviorImports.py
from Core.Behavior.SimpleBehavior.SimpleBehavior import SimpleBehavior
from Core.Behavior.SimpleBehavior.BlinkBehavior.BlinkBehavior import BlinkBehavior
from Core.Behavior.SimpleBehavior.BlinkBehavior.BlinkBehaviorEaseIn import BlinkBehaviorEaseIn
from Core.Behavior.SimpleBehavior.B... | StarcoderdataPython |
93672 | <reponame>andrewt-cville/fb_recruiting<gh_stars>0
import requests
import json
def get_defYears():
return ['2002', '2003', '2004', '2005', '2006', '2007', '2008','2009','2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020']
def get_header():
return {'user-agent':'Mozilla/5.0 (M... | StarcoderdataPython |
3503043 | <filename>francoralite/apps/francoralite_front/views/errors.py
from django.shortcuts import render
from django.utils.translation import gettext as _
def handler403(request, exception=None):
return render(request, 'error.html', {
'exception': exception or _('Accès interdit.'),
}, status=403)
def hand... | StarcoderdataPython |
6698741 | import pytest
import torch
from blackhc.project.utils import cpu_memory
@pytest.mark.forked
def test_cpu_mem_limit():
# 128 MB (128/4M float32)
tensor = torch.empty((128, 1024, 1024 // 4), dtype=torch.float32)
tensor.resize_(1)
cpu_memory.set_cpu_memory_limit(0.25)
# 512 MB (128/4M float32)
... | StarcoderdataPython |
5083473 | <gh_stars>0
import logging
from decimal import Decimal
from textwrap import dedent
from dbnd import log_duration, log_metrics
from dbnd_snowflake.snowflake_values import SnowflakeController
logger = logging.getLogger(__name__)
# TODO: Add support for QUERY_TAG
# I.e. Subclass SnowflakeOperator and set session para... | StarcoderdataPython |
3277658 | from collections import defaultdict
from django.views.decorators.http import require_http_methods
from django.http import JsonResponse
from .models import Website
from .models import Category
# Create your views here.
@require_http_methods(["GET"])
def add_website(request):
pass
@require_http_methods(["GET"]... | StarcoderdataPython |
389440 | <filename>Lib/site-packages/pygments/lexers/nimrod.py
"""
pygments.lexers.nimrod
~~~~~~~~~~~~~~~~~~~~~~
Lexer for the Nim language (formerly known as Nimrod).
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.le... | StarcoderdataPython |
279423 | import math
math.exp(99)
| StarcoderdataPython |
3313312 | # <NAME> (<EMAIL>)
# A (slightly modified) implementation of the Recurrent Convolutional Neural Network (RCNN) found in [1].
# [1] <NAME>., <NAME>., <NAME>., and <NAME>. 2015. Recurrent convolutional
# neural networks for text classification. In AAAI, pp. 2267-2273.
# http://www.aaai.org/ocs/index.php/A... | StarcoderdataPython |
116775 | <gh_stars>10-100
from functools import wraps
from graphql_jwt.utils import get_credentials
from graphql_jwt.shortcuts import get_user_by_token
def jwt_token_decorator(view_func):
@wraps(view_func)
def wrapped_view(request, *args, **kwargs):
token = get_credentials(request, **kwargs)
if token i... | StarcoderdataPython |
11225283 | from flask import Flask, request, jsonify
from pymongo import MongoClient
from os import getenv
from dotenv import load_dotenv
load_dotenv()
app = Flask(__name__)
app.secret_key = getenv('APP_SECRET_KEY')
client = MongoClient(getenv('MONGO_URI'))
users = client.linksbase.users
@app.route('/')
def index():
retur... | StarcoderdataPython |
5092915 | import sys
from ifind.search import Query
from ifind.search.engines.whooshtrec import Whooshtrec
from whoosh.index import open_dir
from whoosh.qparser import QueryParser
whoosh_path = sys.argv[1]
stopwords_path = sys.argv[2]
page = 3
page_len = 10
search_engine = Whooshtrec(whoosh_index_dir=whoosh_path,
... | StarcoderdataPython |
6702042 | <reponame>ReanGD/rofi-proxy
#!/bin/python
import sys
import json
req = {"help": "Press <span foreground=\"red\">Alt+1</span> or <span foreground=\"red\">Alt+2</span>"}
sys.stdout.write(json.dumps(req) + "\n")
sys.stdout.flush()
for line in sys.stdin:
j = json.loads(line)
if j["name"] != "key_press":
... | StarcoderdataPython |
232275 | class Solution:
def maximalRectangle(self, matrix: List[List[str]]) -> int:
dp = [[0] * len(matrix[0]) for i in range(len(matrix))]
for row_i, row in enumerate(matrix):
for col_i, col in enumerate(row):
if col == "0":
dp[row_i][col_i] = 0
... | StarcoderdataPython |
6448459 | from django.db import models
from django.utils.translation import gettext_lazy as _
# Contact entity
class Contact(models.Model):
name = models.CharField(default='NO_NAME', max_length=50, error_messages={
'max_length': _("Your name is too long"),
'blank': _("You need to fill your name"),
'... | StarcoderdataPython |
5034577 | <reponame>chathu1996/hacktoberfest2020<filename>Python/AIspeech.py<gh_stars>10-100
import pyttsx3 #pip install pyttsx3
import speech_recognition as sr #pip install speechRecognition
import datetime
import wikipedia #... | StarcoderdataPython |
11315959 | import numpy as np
from generic.tf_utils.evaluator import Evaluator
class GuesserWrapper(object):
def __init__(self, guesser):
self.guesser = guesser
self.evaluator = None
def initialize(self, sess):
self.evaluator = Evaluator(self.guesser.get_sources(sess), self.guesser.scope_name)... | StarcoderdataPython |
11308499 | <reponame>daviferreira/defprogramming
# coding: utf-8
import uuid
from django.db.models import signals
from django.template.defaultfilters import slugify
from .models import Author, Quote, Tag
def author_pre_save(signal, instance, sender, **kwargs):
if not instance.uuid:
instance.uuid = uuid.uuid4().hex... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.