id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
150743 | # processhandler.py
#
# Copyright (c) 2018, <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, mod... | StarcoderdataPython |
94529 | <reponame>luxe/unilang
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def buildfarm():
http_archive(
name="buildfarm" ,
build_file="//bazel/deps/buildfarm:build.BUILD" ,... | StarcoderdataPython |
1741708 | <gh_stars>0
#!/usr/bin/env python3
from time import sleep
import json
import opc
import sys
def curve(pixels, middle, width):
start = int(middle - width / 2)
for i in range(0, width):
value = point(i, width)
try:
pixels[i + start] = (value * 127, 0, 0)
except IndexError:
... | StarcoderdataPython |
3303007 | <filename>bert4one/modules/transformer.py
#! -*- coding: utf-8 -*-
# desc: Transformer 基础类
from typing import List
import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras import initializers
from tensorflow.keras.layers import Dropout, Add
from tensorflow.keras.models import Model
from bert4o... | StarcoderdataPython |
17480 | def get_cross_sum(n):
start = 1
total = 1
for i in range(1, n):
step = i * 2
start = start + step
total += start * 4 + step * 6
start = start + step * 3
return total
print(get_cross_sum(501)) | StarcoderdataPython |
3224378 | <filename>flags/tests/test_management_commands_disable_flag.py<gh_stars>100-1000
from io import StringIO
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase
from flags.models import FlagState
from flags.state import flag_disabled
clas... | StarcoderdataPython |
1608411 | import os
def analyze_dir(
dir_path: str
) -> dict:
return {
filename: os.path.getsize(os.path.join(dir_path, filename))
for filename in os.listdir(dir_path)
if os.path.isfile(os.path.join(dir_path, filename))
}
def main():
dir_path = './comprehensions/'
result = analyze_... | StarcoderdataPython |
34227 | <gh_stars>1-10
import getopt
import sys
import os
import logging.config
import time
import yaml
sys.path.append("../")
sys.path.append(os.path.abspath("."))
from core.app import APP
from core.utils.ciphersuites import CipherSuites
from core.utils.system_time import STime
from core.config.cycle_Info import ElectionPer... | StarcoderdataPython |
3328441 | import functools
import sys
from req_compile.importhook import import_hook
from req_compile.metadata import patch
import setuptools
import setuptools.extern
fake_import = functools.partial(import_hook, open)
with patch('builtins', '__import__', fake_import), \
patch('__builtin__', '__import__', fake_import):
... | StarcoderdataPython |
1763644 | #!/usr/bin/python3
import serial, subprocess, sys, yaml
BYTESIZE = { 5: serial.FIVEBITS, 6: serial.SIXBITS, 7: serial.SEVENBITS, 8: serial.EIGHTBITS }
PARITY = { 'N': serial.PARITY_NONE, 'E': serial.PARITY_EVEN, 'O': serial.PARITY_ODD, 'M': serial.PARITY_MARK, 'S': serial.PARITY_SPACE }
STOPBITS = { 1: serial.STOPBIT... | StarcoderdataPython |
4806544 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import
import os
import sys
import os.path
import shutil
import errno
import logging
import io
import hashlib
import simiki
from simiki.compat import unicode
logger = logging.getLogger(__name__)
COLOR_CODE... | StarcoderdataPython |
56990 | <gh_stars>1-10
from django.apps import AppConfig
class OtestConfig(AppConfig):
name = 'otest'
| StarcoderdataPython |
3344179 | <reponame>andresfsilva/eva-common-pyutils
# Copyright 2020 EMBL - European Bioinformatics Institute
#
# 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/LIC... | StarcoderdataPython |
125695 | print "Hi from test child" | StarcoderdataPython |
1653576 | <gh_stars>1-10
#! /usr/bin/env python
import sys
import types
from . import mybuiltins
def main():
for arg in sys.argv[1:]:
co, _ = mybuiltins.mycompile_file(arg)
mod = types.ModuleType('__main__')
exec(co, mod.__dict__)
if __name__ == '__main__':
main()
| StarcoderdataPython |
42363 | # from __future__ import absolute_import
# from __future__ import division
# from __future__ import print_function
# import _init_paths
# from opts import opts
import os
import json
import cv2
import collections
def xychange(a, w, h):
ans = [(a[0]+a[2]/2)/w, (a[1]+a[3]/2)/h, a[2]/w, a[3]/h]
ret... | StarcoderdataPython |
3326995 | import unittest
from Calculator.Calculator import Calculator
from CsvReader.CsvReader import CsvReader
class MyTestCase(unittest.TestCase):
def setUp(self) -> None:
self.calculator = Calculator()
def test_instantiate_calculator(self):
self.assertIsInstance(self.calculator, Calculator)
d... | StarcoderdataPython |
1643754 | <reponame>tajatwal/mac_apt
'''
Copyright (c) 2017 <NAME>
This file is part of mac_apt (macOS Artifact Parsing Tool).
Usage or distribution of this software/code is subject to the
terms of the MIT License.
'''
from plugins.helpers.macinfo import *
from plugins.helpers.writer import *
from plugins.helper... | StarcoderdataPython |
27327 | """
DO NOT MODIFY
Dataloder for parts 2 and 3
We will also call this file when loading test data
"""
import os
import glob
import io
from torchtext import data
class IMDB(data.Dataset):
name = 'imdb'
dirname = 'aclImdb'
def __init__(self, path, text_field, label_field, **kwargs):
fields = [('text... | StarcoderdataPython |
197730 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-04-04 21:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0143_auto_20180403_1255'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
122857 | # Copyright (c) Microsoft Corporation and Fairlearn contributors.
# Licensed under the MIT License.
from typing import Any, Callable, Dict, Optional
import logging
import numpy as np
logger = logging.getLogger(__name__)
_DEFAULT_NAME = 'metric'
_METRIC_FUNCTION_NONE = "Found 'None' instead of metric function"
_METR... | StarcoderdataPython |
3343037 | <gh_stars>1-10
from flask_restx.reqparse import RequestParser
offset_parser = RequestParser()
offset_parser.add_argument("offset", type=int, location="args", required=False)
offset_parser.add_argument("limit", type=int, location="args", required=False)
| StarcoderdataPython |
73566 | from dagster import (
DependencyDefinition,
InputDefinition,
Int,
Output,
OutputDefinition,
PipelineDefinition,
RunConfig,
lambda_solid,
solid,
)
from dagster.core.execution.api import create_execution_plan, execute_plan
from dagster.core.instance import DagsterInstance
def define_... | StarcoderdataPython |
1644515 | <filename>tests/test_iputils.py<gh_stars>1-10
# test_iputils.py - unit tests for the sbclassifier.iputils module
#
# Copyright (C) 2002-2013 Python Software Foundation; All Rights Reserved
# Copyright 2014 <NAME>.
#
# This file is part of sbclassifier, which is licensed under the Python
# Software Foundation License; f... | StarcoderdataPython |
3369005 | from imdbpie import Imdb
import json
imdb = Imdb(anonymize=True, cache=True)
for i in xrange(0, 9999999):
cnt = 0
movie_id = "tt" + str(i).zfill(7)
with open('reviews.json', 'w') as fp:
if imdb.title_exists(movie_id):
cnt += 1
title = imdb.get_title_by_id(movie_id)
print movie_id, title.title
reviews... | StarcoderdataPython |
3348239 | <reponame>albgar/legacy_aiida_plugin
#
# Simple parser for xyz file
#
def get_positions_from_xyz_file(file, natoms=None):
positions = []
with open(file,'r') as fh:
lines=fh.readlines()
number_of_atoms = len(lines)-2
if natoms is not None:
if natoms > number_of_atoms... | StarcoderdataPython |
3243948 | # -*- coding: utf-8 -*-
"""This module runs the database-backed PyBEL API."""
import csv
import logging
import pickle
import time
from functools import lru_cache
from io import StringIO
from operator import itemgetter
from typing import Dict, Iterable, List, Mapping, Optional
import networkx as nx
from flask import ... | StarcoderdataPython |
30945 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def distanceK(self, root, target, K):
"""
:type root: TreeNode
:type target: TreeNode
:type K: int
... | StarcoderdataPython |
3338550 | import pytest
from pyradios.utils import bool_to_string
@pytest.mark.parametrize(
"inp, expected",
[(True, "true"), (False, "false")]
)
def test_bool_to_string(inp, expected):
assert bool_to_string(inp) == expected
@pytest.mark.parametrize(
"inp, expected",
[
("a", pytest.raises(TypeErr... | StarcoderdataPython |
4840428 | # coding=utf-8
import urllib2
from hashlib import md5
from comm import cmdline
from comm import generic
poc_info = {
'VulId': '1102',
'Name': 'discuz! x3.0 /static/image/common/focus.swf 跨站脚本漏洞 POC',
'AppName': 'Discuz',
'AppPowerLink': 'http://www.discuz.net/',
'AppVersion': 'X3.0',
'VulType'... | StarcoderdataPython |
1627112 | from utils.embeds import send_executed_embed
class SetMusicCmd():
def __init__(self, client, manager):
self.client = client
self.manager = manager
async def run(self, message, args):
server_id = message.server.id
channel = message.channel
try:
if args:
... | StarcoderdataPython |
188920 | <gh_stars>0
# Localizable strings extracted by LocalizationDemo.tscn
tr("Space")
tr("Exclam")
tr("QuoteDbl")
tr("NumberSign")
tr("Dollar")
tr("Percent")
tr("Ampersand")
tr("Apostrophe")
tr("ParenLeft")
tr("ParenRight")
tr("Asterisk")
tr("Plus")
tr("Comma")
tr("Minus")
tr("Period")
tr("Slash")
tr("Colon")
tr("Semicolon"... | StarcoderdataPython |
1700989 | <filename>epiomix/__init__.py
#!/usr/bin/python
__version_info__ = (1, 0, 0)
__version__ = 'v%i.%i.%i' % __version_info__
| StarcoderdataPython |
3285984 | <reponame>sxjscience/jiant
"""
Assorted utilities for working with neural networks in AllenNLP.
"""
import codecs
import copy
import json
import logging
import os
from pkg_resources import resource_filename
import random
import time
from typing import Dict, Iterable, List, Optional, Sequence, Union
import glob
import n... | StarcoderdataPython |
3301074 | <reponame>rcy1314/TGRSS
import hashlib
from .base import SenderBase
from ..logging import Log
from ..utils import postData, default_user_agent
logger = Log(__name__).getlog()
class Mastodon(SenderBase):
def send(self, text):
url = self.config["base_url"].rstrip("/") + "/api/v1/statuses"
headers ... | StarcoderdataPython |
1696057 | import time
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.chrome.options import Options
def wait_for_load(driver):
elem = driver.find_element_by_tag_name('html')
count = 0
while True:
count += 1
if count > 20:
... | StarcoderdataPython |
178344 | <gh_stars>1-10
import os
import shutil
import unittest
from subprocess import check_call, CalledProcessError, PIPE
class TestHookedIsFunctional(unittest.TestCase):
def setUp(self):
super(TestHookedIsFunctional, self).setUp()
self.old_dir = os.getcwd()
os.mkdir("test_directory")
os... | StarcoderdataPython |
158386 | from rest_framework import status
def test_delete_list_entry(
api_client,
enable_premium_requirement,
profile_list_entry_factory,
user_factory,
):
"""
The owner of a list entry should be able to delete it if they have
an active premium subscription.
"""
password = "password"
us... | StarcoderdataPython |
1797164 | from rest_framework import serializers
from rest_framework.reverse import reverse
from onadata.libs.utils.decorators import check_obj
class FSXFormManifestSerializer(serializers.Serializer):
filename = serializers.ReadOnlyField(source='data_value')
hash = serializers.SerializerMethodField()
downloadUrl =... | StarcoderdataPython |
1790377 | import gym
import gym_flock
import argparse
import timeit
import numpy as np
parser = argparse.ArgumentParser(description="My parser")
parser.add_argument('-g', '--greedy', dest='greedy', action='store_true')
parser.add_argument('-e', '--expert', dest='expert', action='store_true')
parser.add_argument('-x', '--explore... | StarcoderdataPython |
1619181 | <gh_stars>1-10
Reverse Order - Print multiples of X from N to M
Two numbers M and N are passed as the input. A number X is also passed as the input. The program must print the numbers divisible by X from N to M (inclusive of M and N).
Input Format:
The first line denotes the value of M
The second line denotes the valu... | StarcoderdataPython |
145620 | <reponame>Rishabh570/refresher<filename>vsitapp/migrations/0006_add_django_vote_app_for_voting.py
# Generated by Django 2.0.2 on 2018-03-21 17:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vsitapp', '0005_add_model_method_remove_extra_manag... | StarcoderdataPython |
3279663 | # --------------------------------------------------------
# THOR
# Licensed under The MIT License
# Written by <NAME> (<EMAIL>)
# --------------------------------------------------------
from os.path import dirname, abspath
from ipdb import set_trace
import torch
from trackers.THOR_modules.wrapper import THOR_SiamFC,... | StarcoderdataPython |
1657474 | <reponame>mlaradji/CADO
import scipy.io as sio
import numpy as np
import scipy.sparse as sp
from writeMatrices import *
from leastSquares import solve_least_squares_problem
from createFairnessControlMeshCoefs import createFairnessControlMeshCoefs
from createGlobalControlMeshCoefs import createGlobalControlMeshCoefs
fr... | StarcoderdataPython |
3202011 | from src.params.NeuronTypes import *
class ParamsIzhikevich:
"""
This class contains Izhikevich parameters.
:param peak_potential: potential at which spikes terminate.
:type peak_potential: float
:param alpha_E: describes the timescale of recovery for excitatory neurons.
:type alpha_E: float... | StarcoderdataPython |
1799784 | <gh_stars>10-100
import os
import numpy as np
import torch
import shutil
import torchvision.transforms as transforms
from torch.autograd import Variable
from collections import defaultdict
from config import config
class AvgrageMeter(object):
def __init__(self):
self.reset()
def reset(self):
self.avg = 0... | StarcoderdataPython |
110925 | <filename>iioy/movies/external/genres.py
from typing import Type
from iioy.core.adapters import BaseAdapter
from iioy.core.interfaces import AdapterInterface, AdapterMethod
from iioy.movies.models import Genre
class GenreInterface(AdapterInterface):
def __init__(self, adapter_cls: Type[BaseAdapter], external_id)... | StarcoderdataPython |
4820690 | # Revert k items in queue
# Input:
# Queue: [1, 2, 3, 4, 5, 6]
# k = 4
#
# Output:
# [4, 3, 2, 1, 5, 6]
#
from typing import List
class Queue:
def __init__(self, values: List[int] = None):
self.values = values or []
def enqueue(self, value: int):
self.values.append(value)
def dequeue(se... | StarcoderdataPython |
174905 | <filename>src/scripts/drunkjudge.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
2017/06/26
RGB値それぞれの画像
python 2.7.13
opencv 3.XX
numpy 1.12.1
"""
import numpy as np
import cv2
import sys
def drunkjudge(file_name):
# 画像の読み込み
img_color = cv2.imread(file_name)
# RGB値をそれぞれ抽出
imgR = img_colo... | StarcoderdataPython |
1686325 | class UniqueProperty(ValueError):
def __init__(self, key, value, index, node='(unsaved)'):
self.property_name = key
self.value = value
self.index_name = index
self.node = node
def __str__(self):
msg = "Value '{0}' of property {1} of node {2} in index {3} is not unique"
... | StarcoderdataPython |
74869 | # -*- coding:utf-8 -*-
# from django.shortcuts import render
# from django.http import Http404
# from django.core.paginator import Paginator, EmptyPage
from django.core.cache import cache
from django.views.generic import ListView, DetailView
from silk.profiling.profiler import silk_profile
from .models import Post, Ca... | StarcoderdataPython |
163241 | import unittest
from player import Player
class PlayerTest(unittest.TestCase):
def setUp(self):
self.player_1 = Player()
def test_when_the_players_input_its_out_of_range(self):
previous_len = len(self.player_1.choices)
self.player_1.add_choice('C4')
last_len = len(se... | StarcoderdataPython |
1705795 | import time
from loguru import logger
from labs.tasks import add
my_task = add.delay(4, 4)
logger.debug(f"Task ready: {my_task.ready()}")
time.sleep(1)
logger.debug(f"Task ready: {my_task.ready()}")
logger.debug(f"Task result: {my_task.get()}")
| StarcoderdataPython |
4830629 | <gh_stars>0
"""2.2 Return Kth to Last: Implement an algorithm to find the kth to last element of a singly linked list.
"""
class LinkedList():
class Node():
def __init__(self, value):
self.value = value
self.next = None
def __init__(self, x=[]):
self.head = None
... | StarcoderdataPython |
1789941 | import emove_socket
import emove_json
JSON_FILE_PATH = '/home/pi/EMOVE/test_bpm.json'
SEND_URL = 'https://jphacks_noblesseoblige.serveo.net/bpm'
userID = '3120'
musicID = '7654'
def main():
emove_socket.main()
if __name__ == "__main__":
main() | StarcoderdataPython |
3294545 | <gh_stars>1-10
from pynput import keyboard
import time
def on_press(key):
try:
print('alphanumeric key {0} pressed'.format(
key.char))
except AttributeError:
print('special key {0} pressed'.format(
key))
def on_release(key):
print('{0} released'.format(
key))
if key == keyboard.Key.esc:
# Stop liste... | StarcoderdataPython |
1642581 |
'''
Combine the tracks, then split out the science fields
Treat the B and C config tracks separately
'''
import os
import sys
from glob import glob
from tasks import concat, split
# Which config to combine?
config_num = int(sys.argv[-1])
if config_num not in [0, 1]:
raise ValueError("config_num must be 0 or... | StarcoderdataPython |
168709 | <reponame>sudabon/ml-system-in-actions
import datetime
from typing import Dict
from pydantic import BaseModel
class PredictionLogBase(BaseModel):
log_id: str
log: Dict
class PredictionLog(PredictionLogBase):
created_datetime: datetime.datetime
class Config:
orm_mode = True
class OutlierL... | StarcoderdataPython |
4831774 | <filename>server/chatRoom.py
class ChatRoom():
def __init__(self, name, server_ip,server_port,server_socket):
self.name=name
self.server_ip = server_ip
self.server_port = server_port
self.clients_list_ip=[]
self.clients_list_port=[]
self.clients_list_name=[]
... | StarcoderdataPython |
14686 | #!/usr/bin/env python
from __future__ import print_function
import inspect
import logging
import os
import platform
import sys
from time import sleep
from flaky import flaky
import pytest
import requests
from jira_test_manager import JiraTestManager
# _non_parallel is used to prevent some tests from failing due to ... | StarcoderdataPython |
4802707 | <gh_stars>1-10
import torch
from torch import nn
import torch.nn.functional as F
import torchvision
import clip
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class Encoder(nn.Module):
"""
Encoder.
"""
def __init__(self, encoded_image_size=14):
super(Encoder, self).__... | StarcoderdataPython |
3362280 | <reponame>tzuryby/fuzzywuzzy
#!/usr/bin/env python
# encoding: utf-8
"""
process.py
Created by <NAME> on 2011-07-01.
Copyright (c) 2011 <NAME>. All rights reserved.
"""
from fuzz import *
import sys, os
import utils
#######################################
# Find Best Matchs In List Of Choices #
#####################... | StarcoderdataPython |
3250676 | <reponame>jiadaizhao/LintCode
class Solution:
"""
@param encodeString: an encode string
@return: a reversed decoded string
"""
def reverseAsciiEncodedString(self, encodeString):
# Write your code here
return ''.join(chr(int(encodeString[i:i + 2])) for i in range(len(encodeString) - 2... | StarcoderdataPython |
4832138 | import csv
def write_into_csv(info_list):
with open('student_info.csv','a',newline='') as csv_file:
writer = csv.writer(csv_file)
if csv_file.tell() == 0:
writer. writerrow(["name","age","contact_number","e-mail_id"])
writer.writerow(info_list)
conditi... | StarcoderdataPython |
1692192 | <filename>tests/test_install.py<gh_stars>0
import copy
import mock
import filecmp
import yaml
import pytest
import cfy_cluster_manager
from cfy_cluster_manager.main import (_generate_general_cluster_dict,
_generate_three_nodes_cluster_dict,
_... | StarcoderdataPython |
81541 | import sqlalchemy as sa
CERT = b"""-----<KEY>
-----END CERTIFICATE-----
"""
def test_ssl_args():
engine = sa.create_engine('redshift+psycopg2://test')
dialect = engine.dialect
url = engine.url
cargs, cparams = dialect.create_connect_args(url)
assert cargs == []
assert cparams.pop('host') =... | StarcoderdataPython |
135235 | """Get user queue stats API method."""
from ibsng.handler.handler import Handler
class getUserQueueStats(Handler):
"""Get user queue stats method class."""
pass
| StarcoderdataPython |
1607745 | """
refenrence from: https://learnopencv.com/video-stabilization-using-point-feature-matching-in-opencv/
"""
import cv2
import numpy as np
from scipy.signal import savgol_filter
fname = "./deep-stabilization/dvs/video/s_114_outdoor_running_trail_daytime/ControlCam_20200930_104820.mp4"
# fname = "./deep-stabilization/d... | StarcoderdataPython |
1600245 | <reponame>AssisRaphael/PageColector
import unittest
from urllib.parse import urlparse
import time
from .domain import *
from .scheduler import *
class DomainTest(unittest.TestCase):
def test_domain(self):
domain = Domain("xpto.com",10)
self.assertTrue(domain.is_accessible(),"Ao iniciar um servidor... | StarcoderdataPython |
3276713 | <filename>Leetcode/435. Non-overlapping Intervals/solution2.py
class Solution:
def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
if not intervals: return 0
intervals.sort(key=lambda x: x[1])
last = intervals[0]
result = 0
for interval in intervals[1:]:
... | StarcoderdataPython |
1615710 | # Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
from ..job import ImageDatasetJob
from digits.dataset import tasks
from digits.utils import subclass, override, constants
from flask_babel import lazy_gettext as _
# NOTE: Increment this every time the pickled object changes
PICKLE_VERSION = 1
@s... | StarcoderdataPython |
1644198 | #!/usr/bin/env python
from decimal import Decimal
import six
if six.PY3:
from functools import cmp_to_key
from agate.computations.base import Computation
from agate.data_types import Number
class Rank(Computation):
"""
Calculate rank order of the values in a column.
Uses the "competition" ranking... | StarcoderdataPython |
1601430 | from output.models.nist_data.atomic.byte.schema_instance.nistschema_sv_iv_atomic_byte_min_exclusive_4_xsd.nistschema_sv_iv_atomic_byte_min_exclusive_4 import NistschemaSvIvAtomicByteMinExclusive4
__all__ = [
"NistschemaSvIvAtomicByteMinExclusive4",
]
| StarcoderdataPython |
3383323 | #!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
Send a HEAD request::
curl -I http://localhost
Send a POST request::
curl -d "foo=bar&bin=baz" http://localhost
"""
from http.server import BaseHTTPRequestH... | StarcoderdataPython |
3338376 | import pandas as pd
#定义资料集并打印出
left = pd.DataFrame({'A': ['A0', 'A1', 'A2'],
'B': ['B0', 'B1', 'B2']},
index=['K0', 'K1', 'K2'])
right = pd.DataFrame({'C': ['C0', 'C2', 'C3'],
'D': ['D0', 'D2', 'D3']},
index=['K0', 'K2', 'K3'])
print... | StarcoderdataPython |
1676380 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from __future__ import division
from collections import defaultdict
from datetime import datetime, timedelta
from itertools import islice
from math import ceil, sqrt
from time import time as timestamp
import req... | StarcoderdataPython |
1748936 | from typing import List
class Solution:
def fib(self, N: int) -> int:
if N == 0:
return 0
for i in range(1, N + 1):
if i == 1:
a, b = 0, 1
else:
a, b = b, a + b
return b
if __name__ == "__main__":
s = Solution()
... | StarcoderdataPython |
1647455 | <reponame>filippostz/MISP-TIE<filename>misp_tie.py
#!/usr/bin/env python3
#Written by mohlcyber v.0.1
#Edited by filippostz
import requests
import sys
import time
from datetime import datetime
import urllib
from urllib.request import urlopen
from pymisp import ExpandedPyMISP
from dxlclient.client import DxlClient
fro... | StarcoderdataPython |
3201404 | # pylint:disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from .base import compare_template, SimpleTestCase
class SelectTest(SimpleTestCase):
maxDiff = None
def test_rendered(self):
template = """
{% load carbondesign %}
{% Select form.choice %}
"""
expected... | StarcoderdataPython |
3276037 | <gh_stars>1-10
from django.conf.urls.defaults import *
import views
urlpatterns = patterns('',
# Reminder
url(r'^reminder', views.reminder, name="reminder"),
)
| StarcoderdataPython |
3209001 | <reponame>wmantly/sshuttle-gui
import socket
from sshuttle.firewall import subnet_weight
from sshuttle.linux import nft, nft_get_handle, nonfatal
from sshuttle.methods import BaseMethod
class Method(BaseMethod):
# We name the chain based on the transproxy port number so that it's
# possible to run multiple c... | StarcoderdataPython |
3366741 | <reponame>adobe-type-tools/robofont-scripts<gh_stars>1-10
__copyright__ = __license__ = """
Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
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 ... | StarcoderdataPython |
1615769 | from PSpeedChatQuestTerminal import decodeSCQuestMsg
from PSpeedChatQuestTerminal import decodeSCQuestMsgInt
from otp.speedchat.SCDecoders import * | StarcoderdataPython |
1768258 | <filename>sms/tasks.py
from __future__ import absolute_import
from celery import shared_task
@shared_task(ignore_result=True)
def message_send(message_id):
from .models import SMSMessageOut
smsmessage = SMSMessageOut.objects.get(pk=message_id)
smsmessage._send()
| StarcoderdataPython |
87766 | <filename>scripts/portal/map915020100_PT.py<gh_stars>1-10
# Ariant Treasure Vault Entrance (915020100) => Ariant Treasure Vault
if 2400 <= chr.getJob() <= 2412 and not sm.hasMobsInField():
sm.warp(915020101, 1)
elif sm.hasMobsInField():
sm.chat("Eliminate all of the intruders first.") | StarcoderdataPython |
3266368 | <reponame>bopopescu/Lauecollect
#!/usr/bin/env python
"""
Grapical User Interface for FPGA Timing System.
Author: <NAME>
Date created: 2019-03-26
Date last modified: 2019-05-29
"""
__version__ = "1.1" # p0_shift, cleanup
from logging import debug,info,warn,error
import wx
from Panel import BasePanel
class Timing_Cal... | StarcoderdataPython |
146738 | <reponame>JiwooKimAR/MWP-solver-with-pretrained-language-model<gh_stars>1-10
import numpy as np
class BatchSampler:
def __init__(self, data_size, batch_size, drop_remain=False, shuffle=False):
self.data_size = data_size
self.batch_size = batch_size
self.drop_remain = drop_remain
sel... | StarcoderdataPython |
131359 | <filename>tools/c7n_mailer/tests/common.py<gh_stars>0
# Copyright 2017 Capital One Services, 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... | StarcoderdataPython |
1772921 | <reponame>slaily/deep-learning-bits
import string
import numpy as np
samples = ['The cat sat on the mat.', 'The dog ate my homework.']
# All printable ASCII characters
characters = string.printable
token_index = dict(zip(range(1, len(characters) + 1), characters))
max_length = 50
results = np.zeros((len(samples), ma... | StarcoderdataPython |
1749600 | #------------------------------------------------------------------------------
# Copyright 2016, 2017, Oracle and/or its affiliates. All rights reserved.
#
# Portions Copyright 2007-2015, <NAME>. All rights reserved.
#
# Portions Copyright 2001-2007, Computronix (Canada) Ltd., Edmonton, Alberta,
# Canada. All rights r... | StarcoderdataPython |
1738486 | <reponame>arvelt/measure-time
#!/usr/bin/env python
from distutils.core import setup
setup(name='measuretime',
version='0.0.2',
description='',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/arvelt/measure-time',
packages=['measuretime'],
license = "MIT License",
... | StarcoderdataPython |
1601082 | import siliconcompiler
chip = siliconcompiler.Chip('hello_world')
chip.write_manifest('hello_world.json')
| StarcoderdataPython |
178291 | <filename>source/bazel/deps/sfml/get.bzl<gh_stars>10-100
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def sfml():
http_archive(
name="sfml" ,
build_file="//bazel/deps/... | StarcoderdataPython |
1606095 | $NetBSD: patch-setup.py,v 1.1 2020/01/08 21:25:31 adam Exp $
Avoid files outside PYSITELIB.
--- setup.py.orig 2020-01-08 21:21:42.000000000 +0000
+++ setup.py
@@ -49,7 +49,6 @@ config['extras_require'] = {
}
config['tests_require'] = ['nose']
config['test_suite'] = 'nose.collector'
-config['data_files'] = [('', ['... | StarcoderdataPython |
3313519 | # Generated by Django 2.1.2 on 2018-12-07 16:39
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="... | StarcoderdataPython |
3377576 | <reponame>kknet/hikyuu<gh_stars>1000+
#!/usr/bin/python
# -*- coding: utf8 -*-
# cp936
#
# The MIT License (MIT)
#
# Copyright (c) 2021 hikyuu.org
#
# Create on: 2021-03-23
# Author: fasiondog
import os, sys, subprocess
import requests, json
from hkucmd import HKUShell
from hikyuu.util.check import hku_catch
g_ser... | StarcoderdataPython |
4807654 | # Copyright 2021 D-Wave 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 required by applicable law or agreed to in w... | StarcoderdataPython |
3386727 | #!/usr/bin/env python
# This is the priliminary control script that will talk
# with the competition rostopics
from __future__ import print_function
import roslib
roslib.load_manifest('enph353_gazebo')
import sys
import rospy
import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge... | StarcoderdataPython |
1746743 | # -*- coding: utf-8 -*-
"""Output module for the TLN format.
For documentation on the TLN format see: http://forensicswiki.org/wiki/TLN
"""
from __future__ import unicode_literals
from dfdatetime import posix_time as dfdatetime_posix_time
from plaso.lib import errors
from plaso.lib import py2to3
from plaso.lib impo... | StarcoderdataPython |
127054 | <gh_stars>1-10
#!/home/local/users/jw/bin/python2.7
# Author: jywang <EMAIL>
#=========================================================================
# Make FastqTable According to list of fastq names
#=========================================================================
from optparse import OptionParser
import... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.