id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
178966 | import socket
import select
import re
from Debug import errlog_add
from ConfigHandler import cfgget
from SocketServer import SocketServer
class InterCon:
CONN_MAP = {}
def __init__(self):
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.conn.settimeout(4)
@staticmethod
... | StarcoderdataPython |
3370939 | <filename>mla/utils/__init__.py<gh_stars>1000+
# coding:utf-8
from .main import *
| StarcoderdataPython |
1773510 | <filename>src/data/scraping/scrape_match_search_pages.py<gh_stars>0
from bs4 import BeautifulSoup as bs
from os import listdir
import codecs
import pandas as pd
import re
path = "../../../data/external/search_pages/"
search_pages = []
dfs = []
def get_match_compnent_ids(soup, search_string):
links = soup.find_all(... | StarcoderdataPython |
3239953 | <reponame>wrwrwr/turtle-trans
"""
Some common utilities.
"""
from turtle import Turtle
def turtle_subclass(name):
"""
Creates a subclass of Turtle with the given name.
"""
return type(name, (Turtle,), {})
def translate_methods(cls, translations):
"""
Creates aliases for method names.
"""... | StarcoderdataPython |
1720314 | <filename>buffer_overflow_1/example_solve.py
#!/usr/bin/env python
import pwn
import sys
REMOTE_ADDR = "127.0.0.1"
REMOTE_PORT = "1337"
def get_challenge():
if pwn.args.REMOTE:
return pwn.remote(REMOTE_ADDR, REMOTE_PORT)
else:
return pwn.process("./chal")
chal = get_challenge()
chal.sendlin... | StarcoderdataPython |
4823633 |
import os, sys, atexit, signal, time, errno, psutil
from .config import config
def _daemonize():
try:
pid = os.fork()
if pid > 0:
# exit first parent
sys.exit(0)
except OSError as e:
sys.stderr.write('fork #1 failed: {} ({})\n'.format(e.errno, e.s... | StarcoderdataPython |
3227789 | <reponame>grnydawn/errand
"""Errand compiler module
"""
import os, sys, abc, re
from errand.util import which, shellcmd
class Compiler(abc.ABC):
"""Parent class for all compiler classes
"""
def __init__(self, path, flags):
self.path = path
self.flags = flags
self.version = None
... | StarcoderdataPython |
91211 | <reponame>naritapandhe/Microsoft-Malware-Classification-Challenge
from pyspark.sql import SparkSession
from pyspark.mllib.linalg import SparseVector, VectorUDT, Vectors
from pyspark.sql.types import *
from pyspark.ml.classification import RandomForestClassifier
from pyspark.ml.evaluation import MulticlassClassification... | StarcoderdataPython |
109645 | <reponame>febiponwin/Swift_mobile_Verification
from flask import Flask, render_template, request
import sqlite3 as sql
import operation
import image_mail
app = Flask(__name__)
@app.route('/')
def home():
return render_template('home.html')
@app.route('/enternew')
def new_student():
return re... | StarcoderdataPython |
1789236 | <gh_stars>0
class Signal:
def __init__(self) -> None:
self._slots = []
def connect(self, slot):
self._slots.append(slot)
def remove_slot(self, slot):
self._slots.remove(slot)
def emit(self, *args, **kwargs):
for slot in self._slots:
slot(*args, **kwargs)
| StarcoderdataPython |
1628039 | <filename>stellar_sdk/base_transaction_envelope.py
from abc import abstractmethod
from typing import Generic, List, TypeVar, Union
from . import xdr as stellar_xdr
from .decorated_signature import DecoratedSignature
from .exceptions import SignatureExistError
from .keypair import Keypair
from .network import Network
f... | StarcoderdataPython |
3367242 | <reponame>pcaston/core
"""Errors for the Hue component."""
from openpeerpower.exceptions import OpenPeerPowerError
class HueException(OpenPeerPowerError):
"""Base class for Hue exceptions."""
class CannotConnect(HueException):
"""Unable to connect to the bridge."""
class AuthenticationRequired(HueExceptio... | StarcoderdataPython |
3372617 | #
# Copyright 2020 <NAME>
# 2020 <NAME>
#
# ### MIT license
#
# 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, ... | StarcoderdataPython |
3294314 | from __future__ import division
from __future__ import print_function
import datetime
import json
import logging
import os
import pickle
import time
import numpy as np
import optimizers
import torch
from config import parser
from models.base_models import NCModel, LPModel
from utils.data_utils import load_data
from u... | StarcoderdataPython |
59350 | import discord
from discord.ext import commands
from discord.utils import get
class c211(commands.Cog, name="c211"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name='Scorn_Operative_Turncoat', aliases=['c211','Scorn_Operative_17'])
async def example_embed(self, ctx):
... | StarcoderdataPython |
3355878 | #!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_file(pluginname, "login/applyTheme/css/StyleSheet.css", "FE system")
| StarcoderdataPython |
3273637 | <reponame>locationlabs/jsonschema-types
"""
Factory for schema-based types.
"""
import sys
from inflection import camelize, underscore
from jsonschema.compat import urlsplit
from jsonschematypes.model import (
Attribute,
SchemaAwareDict,
SchemaAwareList,
SchemaAwareString,
DEFAULT,
DESCRIPTION... | StarcoderdataPython |
1674601 | <reponame>karilint/TaxonManager
# Generated by Django 3.2.9 on 2022-04-30 12:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('front', '0004_taxonomicunit_expert'),
]
operations = [
migrations.AlterField(
model_name='expert... | StarcoderdataPython |
112436 | import fiona as fio
def get_features_list(vector_file, feature_key_name):
"""Function creates feature list in the multipolygon based on the given unique property (feature_key_name)
such as ID.
:param vector_file: multipolygon file,
:param feature_key_name: unique key for features differentiation,
... | StarcoderdataPython |
5346 | <reponame>PK-100/Competitive_Programming
import math
def square(n):
tmp=round(math.sqrt(n))
if tmp*tmp==n:
return False
else:
return True
def semprime(n):
ch = 0
if square(n)==False:
return False
for i in range(2, int(math.sqrt(n)) + 1):
while n%i==0:
... | StarcoderdataPython |
40078 | """
Script to export a PyTorch-based Pyrado policy to C++
"""
import numpy as np
import torch as to
from rcsenv import ControlPolicy
from pyrado.policies.linear import LinearPolicy
from pyrado.policies.rnn import RNNPolicy
from pyrado.spaces.box import BoxSpace
from pyrado.utils.data_types import EnvSpec
from pyrado.p... | StarcoderdataPython |
1639614 | <reponame>unk1nd0n3/bitbucket-creds-checker
# -*- coding: utf-8 -*-
# __version__ = '0.2'
import json
def read_json_file(path):
"""
Func for store json formatted data to local file
:param path: string
:return: none
"""
try:
return json.loads(open(path).read())
except IOError:
... | StarcoderdataPython |
3214718 | <reponame>ericgroom/simplefrench
from django.contrib import admin
from .models import Tip
# Register your models here.
admin.site.register(Tip) | StarcoderdataPython |
1672590 | <reponame>biochimia/hc2000
import importlib
def _resolve(resource):
if isinstance(resource, basestring):
return importlib.import_module(resource)
return resource
def register_for_resource(plugin, resource):
resource = _resolve(resource)
# TODO: There isn't really a need for plugin lists to li... | StarcoderdataPython |
1616127 |
"""
Details of all the experiments we run.
We do not seek to tune these parameters too much.
The parameters here work for baselines.
"""
def get_experiment(params):
if params['env_name'] in ['HalfCheetah-v2','HalfCheetah-v1']:
params['h_dim'] = 32
params['layers'] = 2
params['sensings'] = 100
params['learn... | StarcoderdataPython |
151720 | <reponame>rohitit09/store_app<filename>storeapp/apps/store/models.py
from django.db import models
from apps.user.models import StoreUser
# Create your models here.
class Category(models.Model):
name=models.CharField(max_length=255)
def __str__(self):
return self.name
class Meta:
verbose_na... | StarcoderdataPython |
1666562 | <filename>pythonExercicios/ex005.py
#Crie um programa que leia um número Real qualquer pelo teclado e mostre na tela a sua porção inteira.
import math
num = float(input('Digite um número: '))
print("A parte real do número {} é {}".format(num,math.trunc(num))) | StarcoderdataPython |
4814935 | #!/usr/bin/python
#/****************************************************************************
# route_plan_class
# Copyright (c) 2016, <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ar... | StarcoderdataPython |
37946 | import os
import json
import pickle
import collections
import numpy as np
from s2and.consts import CONFIG
DATA_DIR = CONFIG["main_data_dir"]
OUTPUT_DIR = os.path.join(DATA_DIR, "s2and_mini")
if not os.path.exists(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR)
# excluding MEDLINE because it has no clusters
DATASETS = [
"a... | StarcoderdataPython |
3284651 | import numpy as np
import torch
import torch.nn as nn
import functools
import open3d
from torch.autograd import Function
from .base_model import BaseModel
from ...utils import MODEL
from ..modules.losses import filter_valid_label
from ...datasets.augment import SemsegAugmentation
if open3d.core.cuda.device_count() > ... | StarcoderdataPython |
3225054 | <gh_stars>1-10
from datetime import timedelta
from webargs import fields
from . import BaseView, use_args, use_kwargs
from ..models.event import Event as EventModel
from ..schemas.event import Event as EventSchema, EventMatch
from .utils import get_or_404
eventlist_args = {
"fromdate": fields.Date(required=False)... | StarcoderdataPython |
197042 | #
# Copyright (c) 2012-2020 Snowflake Computing Inc. All right reserved.
#
from __future__ import division
import json
import os
from collections import namedtuple
from logging import getLogger
from .constants import HTTP_HEADER_VALUE_OCTET_STREAM, SHA256_DIGEST, FileHeader, ResultStatus
from .encryption_util import... | StarcoderdataPython |
1786110 | <gh_stars>100-1000
# ***************************************************************************************
# Title: LabAdvComp/parcel
# Author: <NAME>
# Date: May 26, 2016
# Code version: 0.1.13
# Availability: https://github.com/LabAdvComp/parcel
# ********************************************************************... | StarcoderdataPython |
156107 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Creation date: 13 February 2020
Last modified: 11 December 2020
Author: <NAME>; <EMAIL>
Affiliation: Helmholtz Zentrum Geesthacht
Collaborators: <NAME> - Aarhus University
Description:
This python script is written for Agisoft PhotoScan Professional v1... | StarcoderdataPython |
1750451 | <reponame>sstoefe/python-gerrit-api
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author: <NAME>
from requests import Session
from requests.adapters import HTTPAdapter
from gerrit.utils.exceptions import (
NotAllowedError,
ValidationError,
AuthError,
UnauthorizedError,
NotFoundError,
ConflictE... | StarcoderdataPython |
4814030 | from typing import Dict
import attr
@attr.s
class NaiveBayesClassifierFreqs:
"""Naive Bayes classification table frequency values entry
NaiveBayesClassifierFreqs contains the frequency values for whether a particular domain is found in viral, plasmid
or chromosomal sequence."""
name: str = attr.ib()... | StarcoderdataPython |
69473 | <reponame>aleksandromelo/Exercicios
cont = ('zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez')
n = int(input('Digite um número entre 0 e 10: '))
print(f'Você digitou o número {cont[n]}.')
| StarcoderdataPython |
1614296 | <filename>projectenv/lib/python2.7/site-packages/gulp/__init__.py
# -*- coding: utf-8 -*-
from functools import wraps
import logging
import time as t
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '0.1.0'
def debug_log(lvl=logging.DEBUG, logger_name=None):
def enable(f):
logger = logging.get... | StarcoderdataPython |
4823454 | from logging import Logger
from typing import Optional
from pluggy import PluginManager
from preacher.compilation.request import create_request_compiler
from preacher.compilation.verification import create_description_compiler
from preacher.compilation.verification import create_predicate_compiler
from preacher.compi... | StarcoderdataPython |
1609821 | ##Create principal and thickened contours=name
##digitalterrainmodelraster=raster
##vzorec=stringif(("ELEV" % 25)=0,1,0)
##contourinterval=number5.0
##contours=output vector
outputs_GDALOGRCONTOUR_1=processing.runalg('gdalogr:contour', digitalterrainmodelraster,contourinterval,'ELEV',None,None)
outputs_QGISFIELDCALCULA... | StarcoderdataPython |
1752090 | from ipywidgets import Output
from IPython.display import display, HTML
class AboutTab(object):
def __init__(self):
# self.tab = Output(layout={'height': '600px'})
self.tab = Output(layout={'height': 'auto'})
self.tab.append_display_data(HTML(filename='doc/about.html'))
| StarcoderdataPython |
3398135 | <gh_stars>0
# Thanks to <NAME> for his file which show us
# how to make Tornado runs fine with Django and other WSGI Handler.
# => https://github.com/bdarnell/django-tornado-demo/blob/master/testsite/tornado_main.py
import json
import django.core.handlers.wsgi
from django.apps import AppConfig
from django.conf import... | StarcoderdataPython |
3219675 | <gh_stars>1-10
"""Provide API for transaction model scheme."""
import sqlalchemy
from complainer.db import metadata
transaction = sqlalchemy.Table(
'transactions',
metadata,
sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True),
sqlalchemy.Column('quote_id', sqlalchemy.String(120), nullable=Fa... | StarcoderdataPython |
179412 | #import sys, os
#from importlib import import_module
from fast_calc import rbp
def run(a,b):
return rbp(a, b)
def fcn2( a ):
a.id = a.id2
return a
| StarcoderdataPython |
1657065 | <filename>setup.py
from setuptools import setup
setup(
use_scm_version=True,
setup_requires=["setuptools_scm"],
entry_points={"console_scripts": ["rexpy = rexpy.__main__:cli"]}
)
| StarcoderdataPython |
1777072 | from django.db import models
from django.utils.timezone import now
import datetime
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from esmond.util import datetime_to_unixtime, remove_metachars, max_datetime, atencode
class DeviceTag(models.Model):
"""... | StarcoderdataPython |
3234897 | import argparse
import os
from guacamol.assess_distribution_learning import assess_distribution_learning
from guacamol.utils.helpers import setup_default_logger
from .generator import RandomSmilesSampler
if __name__ == "__main__":
setup_default_logger()
parser = argparse.ArgumentParser(
description=... | StarcoderdataPython |
134230 | # -*- coding: utf-8 -*-
from ._compat import FileNotFoundError
class TimezoneNotFound(FileNotFoundError):
pass
| StarcoderdataPython |
3388868 | # flake8: noqa
from .loader import Loader
| StarcoderdataPython |
1772287 | <reponame>chunzhang-hub/PaddleHub
# coding=utf-8
import os
import time
from collections import OrderedDict
import cv2
import numpy as np
from ace2p.processor import get_direction, get_3rd_point, get_affine_transform
__all__ = ['reader']
def _box2cs(box, aspect_ratio):
x, y, w, h = box[:4]
return _xywh2cs(x... | StarcoderdataPython |
3373902 | import cv2
def pixel_diff(path1, path2):
image1 = cv2.imread(path1)
image2 = cv2.imread(path2)
image1 = cv2.resize(image1, None, fx=.5, fy=.5)
image2 = cv2.resize(image2, None, fx=.5, fy=.5)
difference = cv2.subtract(image1, image2)
# difference = cv2.resize(difference, None, fx=.5, fy=.5)
c... | StarcoderdataPython |
11895 | import jax
import elegy
import unittest
import numpy as np
import jax.numpy as jnp
import optax
class MLP(elegy.Module):
"""Standard LeNet-300-100 MLP network."""
n1: int
n2: int
def __init__(self, n1: int = 3, n2: int = 4):
super().__init__()
self.n1 = n1
self.n2 = n2
... | StarcoderdataPython |
3382779 | from vkbottle.framework.bot import Bot
from vkbottle.types.message import Message
from vkbottle.framework.blueprint.bot import Blueprint
| StarcoderdataPython |
1733048 | import os
import astropy.units as u
from astropy.coordinates import SkyCoord
from banzai.stages import Stage
from banzai import logs
class PointingTest(Stage):
"""
A test to determine whether or not the poiting error on the frame
(as determined by a WCS solve) is within tolerance.
"""
# Typical... | StarcoderdataPython |
3225156 | import copy
import csv
import os
import json
from functools import reduce
import collections
from lxml import etree
import nltk
import numpy
import networkx
nltk.download('punkt')
"""
## examples
# parse OAB exam, return generator of OABQuestion instances
oab = parse_xml('/home/bruno/git/oab-exams/OAB/raw/2010-01.xm... | StarcoderdataPython |
3209671 | from .tictactoe import main
main()
| StarcoderdataPython |
138255 | # Generated by Django 2.2.24 on 2022-01-23 01:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("petition", "0041_merge_20211212_2109"),
]
operations = [
migrations.AddField(
model_name="generatedpetition",
name=... | StarcoderdataPython |
1611995 | <gh_stars>1-10
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for L{twisted.names.srvconnect}.
"""
from twisted.internet import defer, protocol
from twisted.names import client, dns, srvconnect
from twisted.names.common import ResolverBase
from twisted.names.error import DNSNam... | StarcoderdataPython |
57142 | """"
Parte 5: Criando Colisões
"""
#Importações necessárias para a criação da janela
import pygame
from pygame.locals import *
from sys import exit
from random import randint
#Inicialização das váriaveis e funções do pygame
pygame.init()
#Criação da tela
width = 640
height = 480
x = width/2
y = height/2
#Criando ... | StarcoderdataPython |
13547 | import telnetlib
import time
def send_command_telnetlib(ipaddress, username, password, enable_pass, command):
t = telnetlib.Telnet("192.168.100.1")
t.read_until(b"Username:")
t.write(username.encode("ascii") + b"\n")
t.read_until(b"Password:")
t.write(password.encode("ascii") + b"\n")
t.writ... | StarcoderdataPython |
3322904 | <gh_stars>10-100
#!/usr/bin/env python3
# TBD
type Config struct {
XXX map[string]interface{} `yaml:",inline"`
}
// avoid recursion in UnmarshalYAML
type configAlias Config
func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
a := (*configAlias)(c)
if err := unmarshal(a); err != nil {... | StarcoderdataPython |
51699 | import math
import copy
from functools import reduce
def matches(line, rules, rule):
# this is the base case
if "\"" in rule:
if len(line) > 0 and line[0] == rule[1]:
return [1]
else:
return []
# rule = ['1', '2']
rule = rule.split(" ")
# this stores the possible offsets ... | StarcoderdataPython |
1686540 | import ctypes as c
import struct
from typing import List
from . import constants as const
from .fields.data_types import XmpEmpty
from . import utils
from .struct_header import ProtocolHeader
class Request:
def __init__(
self,
class_name: str,
indices: List[int],
cmd_type: int,
... | StarcoderdataPython |
127218 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-22 17:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('goods', '0030_auto_20171222_1557'),
]
operations = [
migrati... | StarcoderdataPython |
82401 | <gh_stars>0
"""Twe following script is meant for being used for the TWITTER API-V2.
The least tweepy version to use is 4.01"""
import tweepy
from credentials import *
import logging
import pymongo
# create a connection to the mongodb running in the mongo container of the pipeline
mongo_client = pymongo.MongoClient("m... | StarcoderdataPython |
1797848 | class Solution:
def maxChunksToSorted(self, arr: List[int]) -> int:
maxNum = count = 0
for i, a in enumerate(arr):
maxNum = max(maxNum, a)
if maxNum == i:
count += 1
return count
| StarcoderdataPython |
3315000 | ########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | StarcoderdataPython |
3388332 | <reponame>chyroc/pylark
# Code generated by lark_sdk_gen. DO NOT EDIT.
"""Feishu/Lark Open API Python Sdk, Support ALL Open API and Event Callback."""
from pylark.api_service_acs import LarkACSService
from pylark.api_service_acs_access_record_list import (
GetACSAccessRecordListReq,
GetACSAccessRecordListRespI... | StarcoderdataPython |
3211683 | <gh_stars>1-10
"""Constants are defined here"""
TO_DO = 'TO_DO'
IN_PROGRESS = 'IN_PROGRESS'
DONE = 'DONE'
| StarcoderdataPython |
83168 | from typing import Dict, Any
from pyNastran.op2.op2_interface.random_results import (
RADCONS, RAECONS, RASCONS, RAPCONS, RAFCONS, RAGCONS, RANCONS,
RADEATC, RAEEATC, RASEATC, RAPEATC, RAFEATC, RAGEATC, RANEATC,
ROUGV1, RADEFFM, SRSS, ABS, NRL,
AutoCorrelationObjects, PowerSpectralDensityObjects, RootM... | StarcoderdataPython |
3365280 | <reponame>spacetelescope/instrument-interface-library<filename>catkit/emulators/thorlabs/TSP01.py
import ctypes
c_void_p = ctypes.POINTER(ctypes.c_void_p)
c_int_p = ctypes.POINTER(ctypes.c_int)
c_double_p = ctypes.POINTER(ctypes.c_double)
class TSP01Emulator(ctypes.Structure):
_fields_ = [("serial_number", ctyp... | StarcoderdataPython |
1684219 | # Natural Language Toolkit: Semantic Interpretation
#
# Author: <NAME> <<EMAIL>>
#
# Copyright (C) 2001-2013 NLTK Project
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Utility functions for batch-processing sentences: parsing and
extraction of the semantic representation of the root node of ... | StarcoderdataPython |
155100 | <gh_stars>1-10
import re
import textwrap
from pathlib import Path
from patterns.configuration.edit import GraphConfigEditor
def test_round_trip(tmp_path: Path):
s = """
title: graph
functions:
- webhook: out # eol comment
# node 1
- node_file: node_1.py
inputs:
in: out... | StarcoderdataPython |
153123 | """
This script generates multiple learning curves for different training sets.
It launches a script (e.g. trn_lrn_crv.py) that train ML model(s) on various training set sizes.
"""
from __future__ import print_function, division
import warnings
warnings.filterwarnings('ignore')
import os
import sys
from pathlib impo... | StarcoderdataPython |
3257265 | <filename>runtests/python_lua/lua_lexer.py
from _tbnf.FableSedlex.sedlex import *
import typing
import typing_extensions
import dataclasses
_sedlex_rnd_379 = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42... | StarcoderdataPython |
90684 | <gh_stars>0
# coding=utf-8
import unicodedata
class Config(object):
# 定义构造方法
def __init__(self): #__init__() 是类的初始化方法;它在类的实例化操作后 会自动调用,不需要手动调用;
# 设置属性
self.stopwords = [" ", " ", " ", ",", ",", ".", "。", "、", "!", "!", "?", "?", ";", ";", "~", "~", "·", "·", ".", "…", "-",
"#_", "—... | StarcoderdataPython |
3211415 | <filename>Handler/data_handler.py
import yaml
import types
import pandas as pd
from Handler.mongo_handler import MongoHandler
from Utils.utils import Log
yaml.warnings({'YAMLLoadWarning': False})
with open("config.yaml", "rt", encoding="utf-8") as stream:
CONFIG = yaml.load(stream)['StockCrawler']
class DataHandl... | StarcoderdataPython |
1622341 | <filename>src/tandlr/urls.py
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from tandlr.registration.views import confirm
admin.autodi... | StarcoderdataPython |
1624103 | import requests
from bs4 import BeautifulSoup
import csv
file = open('movie.csv', mode='w', newline='')
writer = csv.writer(file)
writer.writerow(["title","img_src"])
MOVIE_URL = 'https://movie.naver.com/movie/running/current.nhn'
movie_html = requests.get(MOVIE_URL)
movie_soup = BeautifulSoup(movie_html.text,"html.p... | StarcoderdataPython |
1770489 | class Solution:
def isInterleave(self, s1: str, s2: str, s3: str) -> bool:
len1 = len(s1)
len2 = len(s2)
len3 = len(s3)
if len1 + len2 != len3:
return False
dp = [[False] * (len2 + 1) for i in range(len1 + 1)]
dp[0][0] = True
for i in range(1, len1... | StarcoderdataPython |
164967 | <filename>release/scripts/presets/camera/GoPro_Hero3_Black.py
import bpy
bpy.context.camera.sensor_width = 6.16
bpy.context.camera.sensor_height = 4.62
bpy.context.camera.lens = 2.77
bpy.context.camera.sensor_fit = 'AUTO'
| StarcoderdataPython |
1676390 | <reponame>slamavl/quantarhei<filename>quantarhei/wizard/benchmarks/bm_001.py
# -*- coding: utf-8 -*-
import quantarhei as qr
def main():
with qr.energy_units("1/cm"):
mol1 = qr.Molecule([0.0, 12000.0])
mol2 = qr.Molecule([0.0, 12100.0])
mol3 = qr.Molecule([0.0, 12100.0])
... | StarcoderdataPython |
4808273 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class PickUpInfo(object):
def __init__(self):
self._pick_up_address = None
self._pick_up_code = None
self._pick_up_shop_name = None
self._pick_up_type = None
sel... | StarcoderdataPython |
1748950 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Tassel(Package):
"""TASSEL is a software package to evaluate traits associations,
e... | StarcoderdataPython |
112221 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Praise'
db.create_table('staff_directory_praise', (
('id', self.gf(
... | StarcoderdataPython |
3238385 | <filename>src/clusterfuzz/_internal/tests/core/bot/untrusted_runner/file_impl_test.py
# Copyright 2019 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.or... | StarcoderdataPython |
151647 | # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this open-source project.
""" Define the functions to load data. """
import os
import json
import argparse
import numpy as np
def load_data(data_dir, interval=100, data_type='2D'):
music_data, d... | StarcoderdataPython |
136831 | import json
import requests
class Actions(object):
__module__ = 'trello'
def __init__(self, apikey, token=None):
self._apikey = apikey
self._token = token
def get(self, idAction, display=None, entities=None, fields=None, member=None, member_fields=None, memberCreator=None, memberCreator_f... | StarcoderdataPython |
166178 | servo_a_pw = [[-90.0, 2463]
[-86.4, 2423]
[-72.0, 2263]
[-56.6, 2093]
[-43.2, 2013]
[-28.8, 1793]
[-14.4, 1646]
[0.0, 1436]
[14.4, 1276]
[28.8, 1096]
[43.2, 916]
[56.... | StarcoderdataPython |
3266469 | <reponame>JKamlah/ocromore<filename>test_code/test_pytesseract.py
# ! /usr/bin/python3.6
# -*- coding: utf-8 -*-
"""
This is a script for testing different python3.6/python features
and basic functionality, just to learn python from scratch and by doing.
I intend to stick to the PEP-8 coding guidelines.
"""
import os
... | StarcoderdataPython |
56969 | <filename>strawberryfields/backends/fockbackend/circuit.py
# Copyright 2018 Xanadu Quantum Technologies 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/licens... | StarcoderdataPython |
3233697 | import numpy as np
import torch
import random
def find_index(y_traj, y_rand):
for idx, label in enumerate(y_rand[0]):
if label == y_traj[0]:
return idx
def sample_balanced_data(cactus_partition):
for idx, cluster in enumerate(list(cactus_partition.values())):
# Sample fixed elemen... | StarcoderdataPython |
65697 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework.viewsets import GenericViewSet
from rest_framework import mixins
from irekua_database import models
from irekua_rest_api import serializers
from irekua_rest_api import utils
from irekua_rest_api.permissions import IsAdmin
from irekua... | StarcoderdataPython |
4801397 | # *****************************************************************************
#
# 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 fi... | StarcoderdataPython |
6875 | <filename>src_taxonomy/bubble_tree_map.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import random
from ete2 import Tree, TreeStyle, NodeStyle, faces, AttrFace, CircleFace, TextFace
def layout(node):
if not node.is_root():
# Add node name to laef nodes
#N = AttrFace("name", fsize=14, fgcolor="black")
#faces... | StarcoderdataPython |
39756 | <filename>laba/user.py
from flask import g, session
import pymysql
import redis
import random
import string
from json import loads, dumps
from exceptions.userException import *
from hashlib import sha256
class User():
__changed = {}
_values = {}
__loggedIn = True
__initialized = False
__health ... | StarcoderdataPython |
73235 | """ This module defines the paths that GPUVerify will use
to run the various tools that GPUVerify Depends on.
These paths must be absolute paths.
"""
import os
import sys
# THIS IS A TEMPLATE FOR DEVELOPMENT. MODIFY THE PATHS TO SUIT YOUR BUILD
# ENVIRONMENT. THEN COPY THIS FILE INTO THE ROOT GPUVERIFY DIRECT... | StarcoderdataPython |
4816128 | from collections import defaultdict
from functools import wraps
from lru import LRU
import math
BoundCache = defaultdict(lambda: LRU(3000))
class Color:
ZERO = (0, 0, 0, 0)
WHITE = (0, 0, 1, 3500)
EMPTIES = (ZERO, None)
@classmethod
def dead(kls, color):
return color in kls.EMPTIES or c... | StarcoderdataPython |
3318894 | """
Created on Saturday 22 feb 04:53:34 2020
@author: nkalyan🤠
'''Implementing test cases on Python Scripts on strings and file '''
"""
import unittest
from HW05_nikhil_kalyan import reverse_string, find_second, get_lines, sub_string
class ReverseTest(unittest.TestCase):
""" test reverse ... | StarcoderdataPython |
3306070 | # -*- coding:utf-8 -*-
import logging
import sqlparse
from django.forms import model_to_dict
from sqlparse.tokens import Keyword
import pandas as pd
from sql.engines.goinception import GoInceptionEngine
from sql.models import DataMaskingRules, DataMaskingColumns
import re
import traceback
logger = logging.getLogger(... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.