id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1856733 | <reponame>Vincexodus/TeamsTextMessenger<filename>main.py<gh_stars>0
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from sel... | StarcoderdataPython |
8100530 | packetFunctions = {}
commands = {}
rawPacketFunctions = []
onStart = []
onConnection = []
onConnectionLoss = []
onQueryConnection = []
onClientRemove = []
onInitialConnection = []
onStop = []
class PacketHook(object):
def __init__(self, packet_type, packet_subtype):
self.pktType = packet_type
self... | StarcoderdataPython |
1935738 | import importlib
from types import ModuleType
class TestImports:
"""
Just some basic usage of importlib.
"""
def test_import_model(self):
module = importlib.import_module("aktorz.model.v0_1_0")
assert type(module) == ModuleType
def test_module_from_class(self):
from ak... | StarcoderdataPython |
8087661 | # -*- coding: utf-8 -*-
# Copyright (c) 2018 <NAME>
# Licensed under the 2-clause BSD License
"""Supporting tools for BDA calculation."""
import numpy as np
from astropy import constants as const
from astropy.coordinates import Angle
from astropy import units
# define some HERA-specific constants
hera_latitude = Angl... | StarcoderdataPython |
297220 | import discord
from discord.ext import commands
from discord import Embed
import asyncio
import random
class howfast(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def howfast(self, ctx):
first = Embed(description='3',colo... | StarcoderdataPython |
3521547 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not ... | StarcoderdataPython |
1758828 | <filename>lstm/src/data/hebrew/add_poss_wiki_annotation.py
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
file_name = sys.argv[1]
for l in open(file_name):
fiel... | StarcoderdataPython |
1885917 | <reponame>jakpra/treeconstructive-supertagging
'''
@author: <NAME> (jakpra)
@copyright: Copyright 2020, <NAME>
@license: Apache 2.0
'''
import sys
import glob
from collections import Counter, defaultdict
import json
import math
import pandas
from decimal import Decimal, ROUND_HALF_UP
from matplotlib import pyplot a... | StarcoderdataPython |
9741832 | from combine.indicator.combination_indicator import CombinationIndicator
import math
class Ochiai(CombinationIndicator):
def similarity(self, master_set: set, servant_set: set) -> float:
intersection = set.intersection(master_set, servant_set)
sqrt = math.sqrt(len(master_set)) * math.sqrt(len(ser... | StarcoderdataPython |
180999 | from django.views.generic.base import TemplateView
class BaseMatchEntryView(TemplateView):
def __init__(self, template_name):
self.template_name = template_name
def get_context_data(self, **kwargs):
context = super(BaseMatchEntryView, self).get_context_data(**kwargs)
return context
| StarcoderdataPython |
306586 | <filename>GeneticAlgorithm/CityChromosome.py
import random
class CityChromosome:
def __init__(self, cities):
"""
Crea un cromosoma de ciudades gen
:param cities: arreglo de CityGen
"""
self.cities = cities
self.score = self.evaluate_fitness()
self.mutation_rate = 0.01
#
def evaluate_fitness(self):... | StarcoderdataPython |
11344403 | <reponame>userlocalhost2000/st2contrib
"""
Copyright 2016 Brocade Communications Systems, 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 re... | StarcoderdataPython |
215717 | import sys
from collections import defaultdict
if len(sys.argv) > 2:
print(f"Usage: python3 {sys.argv[0]} <filename>")
sys.exit(1)
d = defaultdict(list)
with open(sys.argv[1], "r") if len(sys.argv) == 2 else sys.stdin as f:
for line in f:
label, value = [float(x) for x in line.split()]
d[... | StarcoderdataPython |
12808642 | import logging
from textwrap import dedent
import bibtexparser
from django import forms
from django.forms import BaseFormSet
from django.forms import formset_factory
from django.urls import reverse_lazy
from django.utils.functional import lazy
from util.project_allocation_mapper import ProjectAllocationMapper
from .m... | StarcoderdataPython |
6641801 | <reponame>okwrtdsh/3D-ResNets-PyTorch
import csv
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(self, val, ... | StarcoderdataPython |
79671 | <gh_stars>0
#!/usr/bin/env python3
from tiden.apps.app import App
from tiden.apps.nodestatus import NodeStatus
from tiden.util import *
class Mysql(App):
tmp_pwd_log_tag = "A temporary password is generated for root@localhost:"
account_tmpl = [
"CREATE USER '__USER__'@'__HOST__' IDENTIFIED BY '__PWD... | StarcoderdataPython |
323015 | from collections import defaultdict
N = int(input())
i = 1
# comitiva = {
# 'anoes': 0,
# 'elfos': 0,
# 'humanos': 0,
# 'magos': 0,
# 'hobbits': 0
# }
comitiva = {}
comitiva = defaultdict(lambda : 0, comitiva) # Ele fornece um valor padrão para a chave que não existe.
while i <= N:
nome_rac... | StarcoderdataPython |
9794402 | import controllers
import models
import tests
| StarcoderdataPython |
6464504 | <reponame>xbfighting/ChZhShChWeb
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render
from .models import Question
from django.urls import reverse
from django.views import generic
class IndexView(generic.ListView):
template_name = 'polls/index.html'
context_object_name = ... | StarcoderdataPython |
1740232 | <filename>src/loaders.py
from functools import partial
from itertools import product
import multiprocessing as mp
import os
from attrdict import AttrDict
import numpy as np
import torch
import torchvision.transforms as transforms
from PIL import Image
import pandas as pd
from torch.utils.data import Dataset, DataLoade... | StarcoderdataPython |
11204678 | <gh_stars>0
import logging.config
logging.config.fileConfig('logging.conf')
def main():
from mixtape import updater, botfather_commandlist
print(botfather_commandlist)
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
| StarcoderdataPython |
12817249 | <reponame>coderMaruf/leetcode-1
'''
Description:
Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
1 None 2 abc... | StarcoderdataPython |
80378 | # output: ok
assert(max(1, 2, 3) == 3)
assert(max(1, 3, 2) == 3)
assert(max(3, 2, 1) == 3)
assert(min([1]) == 1)
assert(min([1, 2, 3]) == 1)
assert(min([1, 3, 2]) == 1)
assert(min([3, 2, 1]) == 1)
exception = False
try:
min()
except TypeError:
exception = True
assert(exception)
exception = False
try:
max... | StarcoderdataPython |
4875580 | <reponame>akshaynot/farmedorganic
from django.shortcuts import render
from django.urls import reverse
from allauth.account.adapter import DefaultAccountAdapter
#Custom allauth adapter:
class AccountAdapter(DefaultAccountAdapter):
def get_login_redirect_url(self, request):
return reverse('profile')
de... | StarcoderdataPython |
3225279 | <gh_stars>0
import base64
import uuid
from dataclasses import dataclass
TOKENS_DB = {}
@dataclass
class Provider:
id: str
name: str
@dataclass
class UserToken:
access_token: str
refresh_token: str
provider: Provider
class TokenRepository:
def __init__(self, db=TOKENS_DB):
self._to... | StarcoderdataPython |
1707998 | <reponame>eillarra/evan
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Permission(models.Model):
"""
Event auth model.
Higher permission levels inherit lower per... | StarcoderdataPython |
215382 | from django.contrib import admin
from catalog.models import Category, Item, Tag, Image
@admin.register(Item)
class ItemAdmin(admin.ModelAdmin):
list_display = ('name', 'is_published', 'text', 'image_tmb')
list_editable = ('is_published',)
list_display_links = ('name', 'text')
filter_horizontal = ('ta... | StarcoderdataPython |
49790 | import re
import subprocess
import getpass
# for testing purposes only.
EDITOR="gedit"
class Project:
"""
Used to model Project objects.
Attributes
-----------
project_path : Path
Used to indicate the path of the project folder.
number : int
Project number.
py_paths : li... | StarcoderdataPython |
6621585 | <filename>stage1/rubberdecode.py
#!/usr/bin/env python3
"""Decode the Rubber Ducky inject.bin compiled script"""
import struct
import sys
# Build a (opcode, modifier)-to-char dictonary
OM2C = {
(0x1e, 0): '1', (0x1e, 2): '!',
(0x1f, 0): '2', (0x1f, 2): '@',
(0x20, 0): '3', (0x20, 2): '#',
(0x21, 0): '4... | StarcoderdataPython |
5065505 | from machine.corpora import (
DictionaryTextAlignmentCorpus,
DictionaryTextCorpus,
MemoryText,
MemoryTextAlignmentCollection,
ParallelTextCorpus,
)
def test_texts_no_texts() -> None:
source_corpus = DictionaryTextCorpus()
target_corpus = DictionaryTextCorpus()
parallel_corpus = Parall... | StarcoderdataPython |
6470011 | from pathlib import Path
import os
import pytest
import shutil
from etl.ingest import ETLExecutor
@pytest.fixture
def tmp_image_file(src_root):
file = os.path.join(os.path.dirname(__file__), 'images', 'test.tiff')
copied_file = os.path.join(src_root, 'test.tiff')
shutil.copyfile(file, copied_file)
... | StarcoderdataPython |
5067249 | """
"""
from typing import Type
from fastapi import FastAPI
from fastapi_utils.inferring_router import InferringRouter
from .controller_utils import (TEMPLATE_PATH_KEY, VER_KEY, ControllerBase,
_get_leaf_controllers,
_register_controller_to_router, _http_m... | StarcoderdataPython |
9696145 | <reponame>Maxcutex/pm_api
import factory
from faker import Faker
from faker.providers import internet, company, job, date_time, lorem, address
from app.models import UserEmployment, UserEmploymentSkill
from app.utils import db
from factories.skill_category_factory import SkillFactory
from factories.user_factory import... | StarcoderdataPython |
9713188 | import unittest
from unittest.mock import patch
import programytest.externals as Externals
from programy.bot import Bot
from programy.config.bot.bot import BotConfiguration
from programy.processors.post.translate import TranslatorPostProcessor
from programytest.client import TestClient
class MockClientContext(object)... | StarcoderdataPython |
1986882 | from django.urls import path
from .views import keyword_search_lots, category, keyword_search_auctions
urlpatterns = [
path('lots', keyword_search_lots, name='keyword_search_lots'),
path('auctions', keyword_search_auctions, name='keyword_search_auctions'),
path('<str:category>', category, name='category'... | StarcoderdataPython |
11287294 | <gh_stars>10-100
from tkinter import *
raiz=Tk()
raiz.title("Ventana de Prueba")
raiz.resizable(0,0) #ancho y alto
raiz.iconbitmap("Iconos\system.ico")
raiz.geometry("750x550")#Tamaño de la venta
raiz.config(bg="white")
raiz.mainloop() #Bucle Infinito
| StarcoderdataPython |
5171266 | <gh_stars>0
from typing import cast
import requests
from listens.abc import MusicGateway as MusicGatewayABC
from listens.definitions import MusicProvider
from listens.definitions.exceptions import SpotifyError
class SpotifyGateway(MusicGatewayABC):
base_url = 'https://api.spotify.com/v1'
auth_url = 'https:/... | StarcoderdataPython |
5104676 | <reponame>rnyberg/pyfibot
# -*- coding: utf-8 -*-
from nose.tools import eq_
import bot_mock
from pyfibot.modules import module_wolfram_alpha
config = {"module_wolfram_alpha":
{"appid": "3EYA3R-WVR6GJQWLH"}} # unit-test only APPID, do not abuse kthxbai
bot = bot_mock.BotMock(config)
def test_simple():
... | StarcoderdataPython |
4949286 | '''
@author: hinfsynz
@created: 12/08/2019
@note: this file is used to segment the poems from <<shijing>> and <<chuci>> to words
'''
import jieba
import os, fnmatch
from os import path
def main():
dict_files = fnmatch.filter(os.listdir('./input/'), '*_clean.txt')
for dict_file in dict_files:
print('S... | StarcoderdataPython |
244444 | from store.templates import store_obj
def pet_obj(pet, nostore=False):
pet_obj = {
"id": pet.external_id,
"name": pet.name,
"species": pet.species,
"breed": pet.breed,
"age": pet.age,
"price": str(pet.price),
"recei... | StarcoderdataPython |
9713900 | import os
from flask import Flask, render_template, jsonify, Markup, redirect, url_for, request
import requests, time
import imghdr
from dotenv import load_dotenv
try:
from urllib.parse import quote
except ImportError:
from urllib import quote
app = Flask(__name__)
APP_ROOT = os.path.join(os.path.dirname(__file__)... | StarcoderdataPython |
11394675 | <reponame>Gerald-Gui/UCAS-Data-Structure<filename>OJ_Assignment/Ch06-Binary_Tree/1037.6.37.py
class stack:
def __init__(self):
self.base = []
def push(self, data):
self.base.append(data)
def pop(self):
return self.base.pop()
def top(self):
return self.base[len(self.base) ... | StarcoderdataPython |
11203753 | import logging
from typing import List, Dict, Optional
from bridge.types import Model, ModelVersion, Artifact, ModelEndpoint
from bridge.constants import LATEST_STAGE_NAME
from bridge.constants import DEPLOY_URL_TAG
from bridge.constants import DEPLOY_STATE_TAG
from bridge.registry import ModelRegistry
from bridge.util... | StarcoderdataPython |
9728599 | <reponame>KOLANICH/hyper-engine
#! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import math
from scipy import stats
from .nodes import *
def wrap(node, transform):
if transform is not None:
return MergeNode(transform, node)
return node
def uniform(start=0.0, end=1.0, transform=None, nam... | StarcoderdataPython |
3450260 | <gh_stars>0
from pavo_cristatus.tests.doubles.module_fakes.module_fake_class import ModuleFakeClass
from trochilidae.interoperable_with_metaclass import interoperable_with_metaclass_future
__all__ = ["ModuleFakeClassWithCallableAndDefault"]
class ModuleFakeClassWithCallableAndDefault(interoperable_with_metaclass_fut... | StarcoderdataPython |
8158301 | """Custom manage.py command."""
from django.core.management.base import BaseCommand
from openfoodfact.utils import req_and_clean
from products.models import Product
class Command(BaseCommand):
"""Custom manage.py command to build database."""
help = "Fetch data from OpenFoodFact API and build database"
... | StarcoderdataPython |
9714525 | <filename>huxley/advisors/urls.py<gh_stars>0
# Copyright (c) 2011-2013 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD License found in README.md.
from django.conf.urls import patterns, url
urlpatterns = patterns('huxley.advisors.views',
url(r'^welcome', 'welcome', name='advisor_welcome')... | StarcoderdataPython |
4983449 | """
Copyright 2018-2019 Skyscanner Ltd
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... | StarcoderdataPython |
11236626 | import logging
import os
from logging import StreamHandler, Formatter
from docker.errors import \
APIError, \
DockerException
from docker_build.configuration.exception import \
InvalidBuildConfigurations
from docker_build.configuration.loader import FileLoader, MainConfigFileLoader
from docker_build.config... | StarcoderdataPython |
3402652 | <filename>read_afad.py
def main():
img_paths = []
ages = []
genders = []
c = 0
with open('AFAD-Full.txt', 'r') as f:
for line in f:
striped_line = line.strip()
_, age, gender, *_ = striped_line.split('/')
genders.append(1 if gender == '111' else 0)
ages.append(int(age))
img_p... | StarcoderdataPython |
3474225 | <reponame>Alex-rf/recipe-app
def add(x,y):
"""Add two numbers together"""
return x+y
| StarcoderdataPython |
6460543 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import argparse
import datetime
import time
import sys
from typing import List
# MIT License
#
# Copyright (c) 2019-2020 karx1
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),... | StarcoderdataPython |
6440437 | # -*- coding: utf-8 -*-
# vim: ts=4 sw=4 tw=100 et ai si
#
# Copyright (C) 2019-2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
# Author: <NAME> <<EMAIL>>
"""
This module provides various functions impelementing the 'wult' and 'ndl' tools deployment.
"""
import os
import sys
import time
import zipfil... | StarcoderdataPython |
8058083 | <gh_stars>0
#----------------------------------------------------------------------------
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Created By : <NAME>
# Created Date: 2022/March/20
# version ='1.0'
# -------------------------------------------------------... | StarcoderdataPython |
11201688 | # RUN: %PYTHON %s | FileCheck %s
from mlir.ir import *
from mlir.dialects import arith
from mlir.dialects import func
from mlir.dialects import scf
from mlir.dialects import builtin
def constructAndPrintInModule(f):
print("\nTEST:", f.__name__)
with Context(), Location.unknown():
module = Module.create()
... | StarcoderdataPython |
3570489 | import random
import os
import numpy as np
import pickle
import ast
from glob import glob
from sklearn.ensemble import RandomForestClassifier
from shutil import copyfile
data_dir_grounding = os.path.dirname(__file__)
data_dir_knowledge = os.path.join(data_dir_grounding,"knowledge")
data_dir_base_knowledge = os.path.jo... | StarcoderdataPython |
1881953 | """
This is common code used by the New Relic plugin.
"""
import datetime
import json
import logging
import numbers
import sys
import time
import urllib2
import urlparse
import dateutil
from wavefront.metrics_writer import WavefrontMetricsWriter
from wavefront import command
from wavefront import utils
# http://bug... | StarcoderdataPython |
4863273 | <reponame>ameyap13/SDN-Load-Balancer<gh_stars>1-10
# Copyright 2011-2012 <NAME>
#
# 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 ... | StarcoderdataPython |
3348298 | <gh_stars>10-100
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
from hypothesis import given
import hypothesis... | StarcoderdataPython |
254744 | <gh_stars>0
import logging
import os
import socket
import pytest # type: ignore
from redical import create_connection, create_redical, create_redical_pool
LOG = logging.getLogger('tests')
@pytest.fixture
def redis_uri():
redis_uri = os.environ['REDICAL_REDIS_URI']
return redis_uri
@pytest.fixture(scope='sessi... | StarcoderdataPython |
117210 | <reponame>Waye/we-care<filename>exploration/app.py<gh_stars>1-10
import json
import os
from flask import Flask, jsonify, request
from flask_cors import CORS
class User():
def __init__(self, ID, Email=""):
self.ID = ID
self.Email = Email
app = Flask(__name__, static_url_path='', static_folder='s... | StarcoderdataPython |
5137367 | <filename>manage.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import click
from quokka import create_app
from quokka.ext.blueprints import blueprint_commands
from quokka.core.db import db
app = create_app()
if app.config.get("LOGGER_ENABLED"):
logging.basicConfig(
level=getattr(logging,... | StarcoderdataPython |
1904044 | <gh_stars>1-10
from random import randint
from numpy import array
from numpy import argmax
from pandas import concat
from pandas import DataFrame
import csv
import numpy as np
from tensorflow.keras.models import Sequential, load_model
from tensorflow.keras.layers import LSTM
from tensorflow.keras.layers import... | StarcoderdataPython |
49716 | <reponame>ad3002/Lyrebird<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#@created: 07.09.2010
#@author: <NAME>
#@contact: <EMAIL>
"""
"""
from collections import defaultdict
from collections import Counter
import math
from trseeker.tools.ngrams_tools import process_list_to_kmer_index
cl... | StarcoderdataPython |
6553156 | import functools
import numpy as np
import os
import cv2
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.modules.rrdb import RRDBNet
from utils.loss import AdversarialLoss, PerceptualLoss, BBL
from utils.modules.discriminator import Discriminator_VGG_192
class Generator(RRDBNet):
d... | StarcoderdataPython |
227408 | <filename>G/GeoHash/geohash.py
from math import log10
__base32 = '0123456789bcdefghjkmnpqrstuvwxyz'
__decodemap = { }
for i in range(len(__base32)):
__decodemap[__base32[i]] = i
del i
def decode_exactly(geohash):
lat_interval, lon_interval = (-90.0, 90.0), (-180.0, 180.0)
lat_err, lon_err = 90.0, 180.0
... | StarcoderdataPython |
3470962 | <filename>ina3221example.py
"""Sample code and test for barbudor_ina3221"""
import time
import sys, ina3221
from machine import Pin, I2C
# Circuitpython routine
# i2c_bus = board.I2C()
# ina3221 = INA3221(i2c_bus)
# i2c
i2c = I2C(scl=Pin(5), sda=Pin(4)) #D1 = SCL, D2 = SDA
# ina226
ina = ina3221.INA3221... | StarcoderdataPython |
8428 | <reponame>jdelic/authserver
#!/usr/bin/env python3 -u
# -* encoding: utf-8 *-
import argparse
import asyncore
import json
import logging
import signal
import sys
import os
from types import FrameType
from typing import Tuple, Sequence, Any, Union, Optional, List, Dict
from concurrent.futures import ThreadPoolExecutor... | StarcoderdataPython |
3338882 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .ctdet import CtdetTrainer
from .ddd import DddTrainer
from .exdet import ExdetTrainer
from .multi_pose import MultiPoseTrainer
from .ctdet_angle import CtdetAngleTrainer
from .multi_dota_four import Multi... | StarcoderdataPython |
124720 | from .pyct_icp import * | StarcoderdataPython |
4958352 | from setuptools import setup
setup(name='YafraPython',
version='1.0',
description='OpenShift Yafra Python App',
author='<NAME>',
author_email='<EMAIL>',
url='http://www.python.org/sigs/distutils-sig/',
install_requires=['Flask>=0.10', 'xlwt>=0.7.5', 'reportlab>=3.0', 'MarkupSafe>=0... | StarcoderdataPython |
3515270 | <reponame>kefatong/ops
# coding:utf8
import re
import os
import stat
import json
import Queue
import hashlib
import ansible
import ansible.runner
import ansible.playbook
from ansible import callbacks
from ansible import utils
from flask import flash, redirect, url_for
def command_runner(user, command, inventory, vi... | StarcoderdataPython |
4895854 | <gh_stars>100-1000
"""Starlark transition support for Apple rules."""
def _current_apple_platform(apple_fragment, xcode_config):
"""Returns a struct containing the platform and target os version"""
cpu = apple_fragment.single_arch_cpu
platform = apple_fragment.single_arch_platform
xcode_config = xcode_... | StarcoderdataPython |
371061 | <reponame>seckcoder/lang-learn
#!/usr/bin/env python
import sys
for line in sys.stdin:
line = line.strip()
if line:
phrase, cnt = line.split('\t')
if phrase == "life and death":
print cnt
break
| StarcoderdataPython |
6551176 | from capstone.x86_const import *
from dis import irdis, IR, Ins, Imm, Reg, Mem
syscall_table = {
1: '_terminate',
2: 'transmit',
3: 'receive',
4: 'fdwait',
5: 'allocate',
6: 'deallocate',
7: 'random',
}
def find_syscall_funcs(pt):
for func in pt.funcs():
ir = irdis(func.dis())... | StarcoderdataPython |
3281962 | <reponame>nikhil-neogy/Scraping-from-ArXiv
import os
import urllib3
http = urllib3.PoolManager()
def download(url, file_path=None, chunk_size=65536):
print("Downloading", file_path, "...")
optional_headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67... | StarcoderdataPython |
11343050 | with open('./template.sbatch','r') as f:
sbatch_template = f.read()
def sbatch_generator(arg_map):
new_sbatch = sbatch_template.format(arg_map['log_file'], arg_map['seed'], arg_map['save_file_path'], arg_map['test_map'], arg_map['out_file'], arg_map['dim_model'])
with open(arg_map['file_name'], 'w') as f:
... | StarcoderdataPython |
206274 | <filename>nicos_virt_mlz/panda/setups/ana_heusler.py<gh_stars>10-100
description = 'PANDA Heusler-analyzer'
group = 'lowlevel'
includes = ['monofoci', 'monoturm', 'panda_mtt']
extended = dict(dynamic_loaded = True)
devices = dict(
ana_heusler = device('nicos.devices.tas.Monochromator',
description = 'PA... | StarcoderdataPython |
9760764 | <gh_stars>10-100
from test_plus.test import TestCase
from core.tests.factories import ServiceFactory, ServiceCategoryFactory
class TestServiceCategory(TestCase):
def test_factory(self):
category = ServiceCategoryFactory()
assert category.name
assert category.slug
assert category.... | StarcoderdataPython |
1877032 | <gh_stars>0
#!/usr/local/bin/python3
name = "<NAME>"
email = "<EMAIL>"
language = "Python"
biostack = "Genomics"
slack = "@Maruf"
print("{}, {}, {}, {}, {}".format(name, email, language, biostack, slack))
| StarcoderdataPython |
8088731 | <reponame>vikkre/hvz<filename>e2etests/test_frontend.py
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from page import Page
import time
PAGE_URL = 'http://web'
def test_page(selenium):
selenium.get(PAGE_URL)
p = Page(selenium)
assert 'HVZ - B... | StarcoderdataPython |
296894 | <filename>pypingcli/sockets/client.py
# chat_client.py
import sys, socket, select, os
import globals
import pypingcli.util
from pypingcli.cryptoManager.keyManager import KeyManager
def chat_client(argHost=None):
host = argHost if argHost is not None else pypingcli.util.safeInput(message="Enter host address to co... | StarcoderdataPython |
1980794 | <filename>app/view.py
from flask import Blueprint, render_template
from flask_wtf import FlaskForm
from wtforms import FileField
from flask_uploads import configure_uploads, IMAGES, UploadSet
from app import app
from celery import Celery
@app.route('/',methods=['GET','POST'])
def index():
return render_template('... | StarcoderdataPython |
3523462 | import csv
import numpy as np
def voltage2energy( volt, curveX, curveY ):
np.interp(volt, curveX, curveY)
| StarcoderdataPython |
6701419 | # Copyright (c) 2016 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
from UM.Tool import Tool
from UM.Scene.Selection import Selection
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Application import Application
from UM.Preferences import Preferences
from cura.Setti... | StarcoderdataPython |
3305157 | <reponame>MetaArchive/metaarchive-qa-tools
#!/usr/bin/env python
"""
BagIt and LOCKSS: "Bad" Filename Finder
by <NAME>
last updated 2013-08-19
This tool will recursively scan a directory for filenames that violate a set
of naming standards meant to prevent problems when ingesting collections into
LOCKSS over HTTP. Th... | StarcoderdataPython |
8122912 | <filename>src/pinyiniser/data/cc_cedict_parser.py
"""Only gets pinyin"""
import sys
#define functions
#builds a dictionary with a simp character as the key
#the key accesses a dictionary of attributes - pinyin only in this case
#dictionary[key]['pinyin'] accesses a list
def parse_lines(lines):
dictionary = {}
... | StarcoderdataPython |
6489824 | <filename>listings/migrations/0007_auto_20200515_0000.py
# Generated by Django 2.2.4 on 2020-05-15 07:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('listings', '0006_auto_20200514_2358'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
8070335 | <filename>examples/more/plot_colorpoints.py<gh_stars>0
"""
========================
Multiple Colour Scatter!
========================
Why show only one colour, when you can display more!
In the basic colour example, we showed one parameter being used
to give colour information. However, you can pick a different colou... | StarcoderdataPython |
1602070 | """photo_renamer
A simple script to rename your ugly and inconsistently named pictures, to something usable.
"""
from argparse import ArgumentParser, FileType
from datetime import datetime
from exif import Image
from os import rename
from os.path import basename, dirname, join, splitext
from sys import exit
def pars... | StarcoderdataPython |
4861873 | <filename>src/scraping/clients/ctwitter.py
import time
import hashlib
from selenium import webdriver
from utils import get_profile
class TwitterClient:
def __init__(self, np_posts=5, np_comments=10):
self.np_posts = np_posts
self.np_comments = np_comments
self.results = {
'net... | StarcoderdataPython |
11290913 | class QuitSignal(Exception):
""" Used to get out of command loops with a quit command. """
# pylint: disable=unnecessary-pass
pass
class Command():
""" A generic base class for handling user inputs.
"""
def __init__(self, io, reading_tip_service):
self._io = io
self._reading_ti... | StarcoderdataPython |
8098091 | <gh_stars>1-10
# Copyright 2016 <NAME>
# Governed by the license described in LICENSE.txt
import libtcodpy as libtcod
import time
import config
import log
import algebra
import map
PANEL_Y = config.SCREEN_HEIGHT - config.PANEL_HEIGHT
MSG_X = config.BAR_WIDTH + 2
LIMIT_FPS = 20
_frame_index = 0
_twenty_frame_estima... | StarcoderdataPython |
3359602 | import json
import unittest
from os import path
import xarray as xr
from granule_ingester.processors import TileSummarizingProcessor
from granule_ingester.processors.reading_processors import GridMultiVariableReadingProcessor
from granule_ingester.processors.reading_processors.GridReadingProcessor import GridReadingPr... | StarcoderdataPython |
4927298 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Utility for download text from web.
"""
import typing
import logging
import urllib.parse
import urllib.request
import urllib.error
import http.client
from .downloader import Downloader, DownloadStringResult, DownloadError
from .cachers import BaseCacher
logging.get... | StarcoderdataPython |
4827951 | from traditional_ml.neural_network.predict import nn_predict
from traditional_ml.neural_network.loss import nn_loss
from traditional_ml.neural_network.rand_weight_init import rand_init_weight
from traditional_ml.neural_network.optimize import optimize_theta
| StarcoderdataPython |
8127103 | <filename>aplicaciones_informaticas/backend/migrations/0024_reports_upcomingpatientfeedmessage.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-09 15:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migra... | StarcoderdataPython |
3571334 | from playhouse.flask_utils import object_list
from cajitos_site.blog import blog
from flask import request, render_template, flash, redirect, url_for, abort, current_app
from flask_babel import _
from flask_login import login_required, current_user
from cajitos_site.blog.forms import PostForm, UpdatePostForm, Comment... | StarcoderdataPython |
6685228 | <gh_stars>0
"""empty message
Revision ID: 1b69eb43d002
Revises: <PASSWORD>
Create Date: 2019-03-24 15:59:37.598587
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1b69eb43d002'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade()... | StarcoderdataPython |
6697877 | #!/usr/bin/env python3
'''
Created on 02.01.2019
@author: ED
'''
if __name__ == '__main__':
pass
import time
from PyTrinamic.connections.ConnectionManager import ConnectionManager
from PyTrinamic.evalboards.TMC4671_eval import TMC4671_eval
from PyTrinamic.ic.TMC4671.TMC4671 import TMC4671 as TMC4671... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.