text stringlengths 0 1.05M | meta dict |
|---|---|
from frt_server.tests import TestMinimal
from frt_server.tables import Family, Font
from sqlalchemy.orm import joinedload
import json
import os
class UfoLoadingTestCase(TestMinimal):
def setUp(self):
super().setUp()
self.login_as('eve@evil.com', 'eveisevil')
family = Family(family_name=... | {
"repo_name": "HPI-SWA-Lab/BP2016H1",
"path": "frt_server/tests/test_ufo_loading.py",
"copies": "1",
"size": "3178",
"license": "mit",
"hash": -5021213436701986000,
"line_mean": 33.9230769231,
"line_max": 103,
"alpha_frac": 0.6236626809,
"autogenerated": false,
"ratio": 3.384451544195953,
"conf... |
from frt_server.tests import TestMinimal
from sqlalchemy import func
from frt_server.tables import User
class LoginTestCase(TestMinimal):
def test_valid_login(self):
response = self.login('eve@evil.com', 'eveisevil')
self.assertEqual(response[1], 200)
def test_invalid_login(self):
resp... | {
"repo_name": "HPI-SWA-Lab/BP2016H1",
"path": "frt_server/tests/test_login.py",
"copies": "1",
"size": "1385",
"license": "mit",
"hash": 3646039837932710400,
"line_mean": 40.9696969697,
"line_max": 109,
"alpha_frac": 0.6548736462,
"autogenerated": false,
"ratio": 3.6447368421052633,
"config_tes... |
from fruitynutters.cart.models import Cart
# Util
def get_session_cart(session):
# If there is no cart id in the session, create a cart and save its id to
# the session.
if not session.get('cart_id'):
cart = Cart()
cart.save()
session['cart_id'] = cart.id
return cart
# ... | {
"repo_name": "brew/fruitynutters",
"path": "webapps/fruitynutters/util.py",
"copies": "1",
"size": "2207",
"license": "mit",
"hash": 7810289209198469000,
"line_mean": 31.9402985075,
"line_max": 82,
"alpha_frac": 0.5074762121,
"autogenerated": false,
"ratio": 3.5654281098546043,
"config_test": ... |
from fsa import Nfa
import copy
import pdb
from transition import *
from error import *
from nameGenerator import IndexNameGenerator
from state import State
class FstState(State):
def __init__(self, name):
State.__init__(self, name)
def __str__(self):
output = ""
for transitionLis... | {
"repo_name": "jpbarrette/moman",
"path": "finenight/python/fst.py",
"copies": "1",
"size": "4040",
"license": "mit",
"hash": -8651193796492075000,
"line_mean": 24.7324840764,
"line_max": 107,
"alpha_frac": 0.5579207921,
"autogenerated": false,
"ratio": 4.261603375527426,
"config_test": false,
... |
from fsa import *
from nameGenerator import *
class IncrementalAdfa(Dfa):
"""This class is an Acyclic Deterministic Finite State Automaton
constructed by a list of words.
"""
def __init__(self, nameGenerator = None):
if nameGenerator is None:
nameGenerator = IndexNameGenerator()
... | {
"repo_name": "datamade/moman",
"path": "finenight/iadfa.py",
"copies": "1",
"size": "4186",
"license": "mit",
"hash": 3152843284105244000,
"line_mean": 28.6879432624,
"line_max": 119,
"alpha_frac": 0.6070234114,
"autogenerated": false,
"ratio": 4.364963503649635,
"config_test": false,
"has_n... |
from fsa import *
import copy
def create(start, finals, edges):
states = {}
for e in edges:
if e[1] is None:
states.setdefault(e[0], ({}, []))[1].append(e[2])
else:
states.setdefault(e[0], ({}, []))[0][e[1]] = e[2]
states.setdefault(e[2], ({}, []))
stat... | {
"repo_name": "datamade/moman",
"path": "finenight/utils.py",
"copies": "1",
"size": "3562",
"license": "mit",
"hash": -8249069639410096000,
"line_mean": 30.2456140351,
"line_max": 89,
"alpha_frac": 0.569904548,
"autogenerated": false,
"ratio": 3.6646090534979425,
"config_test": false,
"has_n... |
from fscloud import FsCloud
from environmentinfo import *
from commonutils import *
import threading
def fs_cloud_2_dict(obj):
result = {}
result.update(obj.__dict__)
return result
def dict_2_fs_cloud(fs_dict):
#fs_cloud = FsCloud(cloud_id=fs_dict.get("cloud_id"),azName=fs_dict.get('azName'),dc=fs_di... | {
"repo_name": "Hybrid-Cloud/cloud_manager",
"path": "code/cloudmanager/fscloudpersist.py",
"copies": "3",
"size": "2563",
"license": "apache-2.0",
"hash": 1257525483067427600,
"line_mean": 32.7236842105,
"line_max": 108,
"alpha_frac": 0.5559890753,
"autogenerated": false,
"ratio": 3.4776119402985... |
from fsdict import FSDict
import feedgenerator
from urllib import quote_plus
import os.path
from feeddirectives import Latest
from feednodes import latest
from sphinx.addnodes import toctree
from docutils import nodes
#global
feed_entries = None
#constant unlikely to occur in a docname and legal as a filename
MAGIC_... | {
"repo_name": "zerotired/manticore-ext",
"path": "src/zt/manticore/sphinxcontrib/feed/__init__.py",
"copies": "1",
"size": "8134",
"license": "bsd-2-clause",
"hash": 6681136646537362000,
"line_mean": 32.6115702479,
"line_max": 113,
"alpha_frac": 0.6256454389,
"autogenerated": false,
"ratio": 3.79... |
from FSelement import Element
import datetime
class Folder(Element):
root = None
def __init__(self, name, parent):
if parent == None:
if Folder.root == None:
Folder.root = self
parent = self
else: raise Exception()
self.__content = [];
Element.__init__(self... | {
"repo_name": "tobiasmuehl/FileSystem",
"path": "FSfolder.py",
"copies": "1",
"size": "1627",
"license": "unlicense",
"hash": -3647355002068216000,
"line_mean": 23.2388059701,
"line_max": 140,
"alpha_frac": 0.5745073892,
"autogenerated": false,
"ratio": 3.5692307692307694,
"config_test": false,... |
from FSError import *
class ProtectFlags:
FIBF_DELETE = 1
FIBF_EXECUTE = 2
FIBF_WRITE = 4
FIBF_READ = 8
FIBF_ARCHIVE = 16
FIBF_PURE = 32
FIBF_SCRIPT = 64
flag_txt = "HSPArwed"
flag_num = len(flag_txt)
flag_none = 0xf # --------
empty_string = "-" * flag_num
def __init__(self, mask=0):
... | {
"repo_name": "alpine9000/amiga_examples",
"path": "tools/external/amitools/amitools/fs/ProtectFlags.py",
"copies": "1",
"size": "2478",
"license": "bsd-2-clause",
"hash": 1417604206992610600,
"line_mean": 20.9380530973,
"line_max": 64,
"alpha_frac": 0.4778046812,
"autogenerated": false,
"ratio":... |
from FSEvents import *
import objc
import sys
import os
import stat
import errno
def T_or_F(x):
if x:
return "TRUE"
else:
return "FALSE"
class Settings (object):
__slots__ = (
'sinceWhen',
'latency',
'flags',
'array_of_paths',
'pr... | {
"repo_name": "dylanvee/pyobjc-framework-FSEvents",
"path": "Examples/watcher.py",
"copies": "2",
"size": "8744",
"license": "mit",
"hash": -748516633193887500,
"line_mean": 28.049833887,
"line_max": 129,
"alpha_frac": 0.565073193,
"autogenerated": false,
"ratio": 3.875886524822695,
"config_tes... |
from fs import ResourceType
from fs.base import FS
from fs.info import Info
from fs.mode import Mode
from fs.subfs import SubFS
from fs.time import datetime_to_epoch
from materials_commons.api import Client, MCAPIError
class MCFS(FS):
def __init__(self, project_id, apitoken, base_url):
super(MCFS, self)._... | {
"repo_name": "materials-commons/mcfs",
"path": "materials_commons/mcfs/mcfs.py",
"copies": "1",
"size": "2012",
"license": "mit",
"hash": 1586011188738673700,
"line_mean": 29.4848484848,
"line_max": 80,
"alpha_frac": 0.5516898608,
"autogenerated": false,
"ratio": 3.6849816849816848,
"config_te... |
from fsm.FSM import STATE, EVENT, FSM
# pylint: skip-file
# flake8: noqa
# authenticate
# autocommit
# check_query_response
# close
# connected
# init_query
# isolation
# parse_auth_response
# parse_greeting
# query
# query_complete
# read_data_packet
# read_descriptor_packet
# ready
# transaction
# transaction_done
# ... | {
"repo_name": "robertchase/spindrift",
"path": "spindrift/mysql/fsm_protocol.py",
"copies": "1",
"size": "2812",
"license": "mit",
"hash": -3024580423106565600,
"line_mean": 60.1304347826,
"line_max": 234,
"alpha_frac": 0.6899004267,
"autogenerated": false,
"ratio": 3.2735739231664724,
"config_... |
from fsm.fsmspec import FSMSpecification
class START(object):
"""
Example node plugin for automated test suite testing only.
We adopt a convention of NODE names in ALL-CAPS and
edge names in lower-case.
This represents a START node.
"""
def get_path(self, node, state, request, **kwargs):
... | {
"repo_name": "derdmitry/socraticqs2",
"path": "mysite/fsm/fsm_plugin/testme.py",
"copies": "3",
"size": "2994",
"license": "apache-2.0",
"hash": -136316236786729440,
"line_mean": 28.6435643564,
"line_max": 78,
"alpha_frac": 0.5868403474,
"autogenerated": false,
"ratio": 3.9342969776609724,
"co... |
from FSM import FSM
def parse(s):
rgp = RegExParser(s)
fsm = rgp.parse()
return fsm
class RegExParser:
def __init__(self, s):
self.i=0;
self.s = s
def next(self):
self.i += 1
def token(self):
if self.i < len(self.s):
return self.s[self.i]
e... | {
"repo_name": "Irishmanluke/FSMGraphSimulator",
"path": "FSMRegEx.py",
"copies": "1",
"size": "1501",
"license": "mit",
"hash": -5762459689710625000,
"line_mean": 19.8472222222,
"line_max": 49,
"alpha_frac": 0.4237175217,
"autogenerated": false,
"ratio": 3.868556701030928,
"config_test": false,... |
from fsm import *
from diary import *
import time
import os
class Application:
@staticmethod
def create_diary():
"""
In this function we create the table of transitions between programs states and get info about the user.
"""
states_dict = {}
states_dict[Application._... | {
"repo_name": "dubovyk/Finite-State-Machine",
"path": "Examples/Diary/main.py",
"copies": "1",
"size": "15373",
"license": "mit",
"hash": 904382216965844000,
"line_mean": 45.726443769,
"line_max": 328,
"alpha_frac": 0.5916867235,
"autogenerated": false,
"ratio": 4.085304278501196,
"config_test"... |
from fsm import *
import cocos
import pyglet
from pyglet.window import key
width = 700
height = 700
class RotatingText(cocos.text.Label):
def __init__(self, text='', pos=(0, 0)):
super(RotatingText, self).__init__(text=text, position=pos, font_size=32)
self.schedule(self.update)
def update(... | {
"repo_name": "dubovyk/Finite-State-Machine",
"path": "Examples/2D-Game/main.py",
"copies": "1",
"size": "1491",
"license": "mit",
"hash": -8834158461654186000,
"line_mean": 27.1320754717,
"line_max": 81,
"alpha_frac": 0.665325285,
"autogenerated": false,
"ratio": 3.411899313501144,
"config_tes... |
from .fsm import Transition
class CharacterTransition(Transition):
"""
A transition that checks if the data is equal to a character.
"""
def __init__(self, source, target, character):
"""
Create the transition.
"""
super(CharacterTransition, self).__init__(source, tar... | {
"repo_name": "CtrlC-Root/cse3341",
"path": "Core/cse3341/generator.py",
"copies": "1",
"size": "2687",
"license": "mit",
"hash": -6081819725521614000,
"line_mean": 32.1728395062,
"line_max": 77,
"alpha_frac": 0.6122069222,
"autogenerated": false,
"ratio": 5.108365019011407,
"config_test": fals... |
from fsm.models import ActivityLog
FSM_NAMES_TO_RESET_ON_RECYCLE = ['live_chat']
def quit_edge(self, edge, fsmStack, request, **kwargs):
"""
Edge method that terminates this live-session.
"""
for studentState in fsmStack.state.linkChildren.all():
studentState.linkState = None # detach from o... | {
"repo_name": "raccoongang/socraticqs2",
"path": "mysite/ct/fsm_plugin/live.py",
"copies": "2",
"size": "5604",
"license": "apache-2.0",
"hash": 4994816948992068000,
"line_mean": 34.025,
"line_max": 99,
"alpha_frac": 0.6316916488,
"autogenerated": false,
"ratio": 3.977288857345635,
"config_test... |
from fsm.models import ActivityLog
def quit_edge(self, edge, fsmStack, request, **kwargs):
"""
Edge method that terminates this live-session.
"""
for studentState in fsmStack.state.linkChildren.all():
studentState.linkState = None # detach from our state
studentState.save()
return... | {
"repo_name": "derdmitry/socraticqs2",
"path": "mysite/ct/fsm_plugin/live.py",
"copies": "1",
"size": "5005",
"license": "apache-2.0",
"hash": 4395845462270979600,
"line_mean": 34.2464788732,
"line_max": 80,
"alpha_frac": 0.6385614386,
"autogenerated": false,
"ratio": 4.04607922392886,
"config_... |
from fsm.models import FSM
class FSMSpecification(object):
"""
Convenience class for specifying an FSM graph, loading it.
"""
def __init__(self, name, title, nodeDict=None, edges=None,
pluginNodes=(), attrs=('help', 'path', 'data', 'doLogging'),
fsmGroups=(), **kwargs... | {
"repo_name": "derdmitry/socraticqs2",
"path": "mysite/fsm/fsmspec.py",
"copies": "3",
"size": "2754",
"license": "apache-2.0",
"hash": 297000078969346900,
"line_mean": 30.6551724138,
"line_max": 77,
"alpha_frac": 0.5464778504,
"autogenerated": false,
"ratio": 4.11044776119403,
"config_test": f... |
from fs.mountfs import MountFS
from fs.memoryfs import MemoryFS
import unittest
class TestMountFS(unittest.TestCase):
def test_auto_close(self):
"""Test MountFS auto close is working"""
multi_fs = MountFS()
m1 = MemoryFS()
m2 = MemoryFS()
multi_fs.mount('/m1', m1)
... | {
"repo_name": "pscottdevos/pyfilesystem",
"path": "fs/tests/test_mountfs.py",
"copies": "13",
"size": "3012",
"license": "bsd-3-clause",
"hash": 4835134561254373000,
"line_mean": 35.2891566265,
"line_max": 105,
"alpha_frac": 0.5966135458,
"autogenerated": false,
"ratio": 3.5064027939464495,
"co... |
from fs.multifs import MultiFS
from fs.memoryfs import MemoryFS
import unittest
from six import b
class TestMultiFS(unittest.TestCase):
def test_auto_close(self):
"""Test MultiFS auto close is working"""
multi_fs = MultiFS()
m1 = MemoryFS()
m2 = MemoryFS()
multi_fs.addfs('... | {
"repo_name": "Konubinix/pyfilesystem",
"path": "fs/tests/test_multifs.py",
"copies": "2",
"size": "2690",
"license": "bsd-3-clause",
"hash": -6196274587328129000,
"line_mean": 30.6470588235,
"line_max": 61,
"alpha_frac": 0.5423791822,
"autogenerated": false,
"ratio": 3.0464326160815403,
"confi... |
from fsopy.receiver_operating_characteristic import th_roc_glq, th_roc_num
from matplotlib import pyplot as plt
# ook modulation
mod_order = 2
# signal to noise ratio in dB
snr_db = 10
# number of transmitted symbols
n_samples = 20
# number of points to make the ROC
n_thresh = 1000
# number of terms for the GL qua... | {
"repo_name": "mirca/fsopy",
"path": "fsopy/examples/plot_th_roc.py",
"copies": "1",
"size": "1042",
"license": "mit",
"hash": -4262960377614389000,
"line_mean": 19.84,
"line_max": 81,
"alpha_frac": 0.6593090211,
"autogenerated": false,
"ratio": 2.4691943127962084,
"config_test": false,
"has_... |
from fsspec import AbstractFileSystem
from fsspec.utils import tokenize
class AbstractArchiveFileSystem(AbstractFileSystem):
"""
A generic superclass for implementing Archive-based filesystems.
Currently, it is shared amongst `ZipFileSystem`, `LibArchiveFileSystem` and
`TarFileSystem`.
"""
d... | {
"repo_name": "intake/filesystem_spec",
"path": "fsspec/archive.py",
"copies": "1",
"size": "2150",
"license": "bsd-3-clause",
"hash": -5313211158361647000,
"line_mean": 30.6176470588,
"line_max": 93,
"alpha_frac": 0.508372093,
"autogenerated": false,
"ratio": 4.118773946360153,
"config_test": ... |
from fsspec import callbacks
def test_callbacks():
empty_callback = callbacks.callback()
assert empty_callback.call("something", "somearg") is None
simple_callback = callbacks.callback(something=lambda arg: arg + 2)
assert simple_callback.call("something", 2) == 4
multi_arg_callback = callbacks.... | {
"repo_name": "intake/filesystem_spec",
"path": "fsspec/tests/test_callbacks.py",
"copies": "1",
"size": "1604",
"license": "bsd-3-clause",
"hash": -1276764259013274000,
"line_mean": 29.8461538462,
"line_max": 87,
"alpha_frac": 0.683915212,
"autogenerated": false,
"ratio": 3.828162291169451,
"c... |
from FSString import FSString
class FileName:
root_path_aliases = (u'', u'/', u':')
def __init__(self, name, is_intl=False):
# check that name is a FSString
if not isinstance(name, FSString):
raise ValueError("FileName's name must be a FSString")
self.name = name
self.is_intl = is_intl
... | {
"repo_name": "alpine9000/amiga_examples",
"path": "tools/external/amitools/amitools/fs/FileName.py",
"copies": "1",
"size": "2553",
"license": "bsd-2-clause",
"hash": -6440572641906118000,
"line_mean": 24.0294117647,
"line_max": 73,
"alpha_frac": 0.5393654524,
"autogenerated": false,
"ratio": 3.... |
from fst import FST
import string, sys
from string import ascii_lowercase
from fsmutils import compose
'''
Jiajie Sven Yan
'''
def letters_to_numbers():
"""
Returns an FST that converts letters to numbers as specified by
the soundex algorithm
"""
# Let's define our first FST
f1 = FST('soundex-generate')
# Indic... | {
"repo_name": "svenyan/coursework_114_foundamentals_of_compling",
"path": "finite_state_transducer/soundex.py",
"copies": "1",
"size": "3464",
"license": "mit",
"hash": 100853326257288030,
"line_mean": 26.712,
"line_max": 93,
"alpha_frac": 0.6091224018,
"autogenerated": false,
"ratio": 2.35326086... |
from ftd2xx import ftd2xx
class N64CartDev:
CMD_READ = [0x01]
CMD_WRITE = [0x02]
EMBED_RAM_ADDR = 0x00000000
EMBED_RAM_LEN = 0x1000
SDRAM_ADDR = 0x10000000
SDRAM_LEN = 0x4000000
CART_SRAM_ADDR = 0x28000000
CART_ROM_ADDR = 0x30000000
BURST_LEN = 0x20000
def __init__(self):
... | {
"repo_name": "jeffkub/n64-cart-reader",
"path": "old/scripts/n64_cart_dev.py",
"copies": "1",
"size": "2458",
"license": "mit",
"hash": -4492301761316927000,
"line_mean": 25.1489361702,
"line_max": 84,
"alpha_frac": 0.5504475183,
"autogenerated": false,
"ratio": 3.367123287671233,
"config_test... |
from ft.db.dbtestcase import DbTestCase
from passerine.db.common import ProxyObject
from passerine.db.uow import Record
from passerine.db.entity import entity
from passerine.db.mapper import link, CascadingType, AssociationType
@link('left', association=AssociationType.ONE_TO_ONE, cascading=[CascadingType.PERSIST, Cas... | {
"repo_name": "shiroyuki/passerine",
"path": "test/ft/db/test_session.py",
"copies": "1",
"size": "8360",
"license": "mit",
"hash": 1877045009132612400,
"line_mean": 34.2784810127,
"line_max": 116,
"alpha_frac": 0.6344497608,
"autogenerated": false,
"ratio": 3.6925795053003534,
"config_test": t... |
from ft.db.dbtestcase import DbTestCase
from passerine.db.session import Session
from passerine.db.repository import Repository
from passerine.db.common import ProxyObject
from passerine.db.entity import entity
from passerine.db.manager import Manager
from passerine.db.mapper import AssociationType, link
@ent... | {
"repo_name": "shiroyuki/passerine",
"path": "test/ft/db/test_mapper_link.py",
"copies": "1",
"size": "3406",
"license": "mit",
"hash": 3146313114451779600,
"line_mean": 32.7326732673,
"line_max": 127,
"alpha_frac": 0.4718144451,
"autogenerated": false,
"ratio": 4.30050505050505,
"config_test":... |
from ft.db.dbtestcase import DbTestCase, skip
from passerine.db.session import Session
from passerine.db.repository import Repository
from passerine.db.common import ProxyObject
from passerine.db.entity import entity
from passerine.db.manager import Manager
from passerine.db.mapper import Associatio... | {
"repo_name": "shiroyuki/passerine",
"path": "test/ft/db/test_driver_mongodriver.py",
"copies": "1",
"size": "4392",
"license": "mit",
"hash": -3108521364417545700,
"line_mean": 29.0890410959,
"line_max": 82,
"alpha_frac": 0.3938979964,
"autogenerated": false,
"ratio": 4.327093596059114,
"confi... |
from ftest import TestCase
from ftest import TestProcess
import signal
class TestCaseImpl(TestCase):
def __init__(self):
TestCase.__init__(self, "test_02")
self.server1 = None
self.server2 = None
self.client1 = None
def ramp_up(self):
# Create server and client proces... | {
"repo_name": "jpellikk/ebnlib",
"path": "test/ftests/cases/test_02.py",
"copies": "1",
"size": "1385",
"license": "mit",
"hash": 7882216581142411000,
"line_mean": 29.1086956522,
"line_max": 117,
"alpha_frac": 0.6267148014,
"autogenerated": false,
"ratio": 4.0144927536231885,
"config_test": tru... |
from ftfy import fix_text, fix_text_segment
from ftfy.fixes import unescape_html
import pytest
def test_entities():
example = '&\n<html>\n&'
assert fix_text(example) == '&\n<html>\n&'
assert fix_text_segment(example) == '&\n<html>\n&'
assert fix_text(example, unescape_html=True) ... | {
"repo_name": "LuminosoInsight/python-ftfy",
"path": "tests/test_entities.py",
"copies": "1",
"size": "2022",
"license": "mit",
"hash": -662582638079974100,
"line_mean": 43.7555555556,
"line_max": 84,
"alpha_frac": 0.631082423,
"autogenerated": false,
"ratio": 2.9837037037037035,
"config_test":... |
from ftfy import guess_bytes
from ftfy.bad_codecs.utf8_variants import IncrementalDecoder
import pytest
TEST_ENCODINGS = [
'utf-16', 'utf-8', 'sloppy-windows-1252'
]
TEST_STRINGS = [
'Renée\nFleming', 'Noël\nCoward', 'Señor\nCardgage',
'€ • £ • ¥', '¿Qué?'
]
@pytest.mark.parametrize("string", TEST_STRI... | {
"repo_name": "LuminosoInsight/python-ftfy",
"path": "tests/test_bytes.py",
"copies": "1",
"size": "1624",
"license": "mit",
"hash": -5933866879196363000,
"line_mean": 31.22,
"line_max": 78,
"alpha_frac": 0.6579764122,
"autogenerated": false,
"ratio": 3.222,
"config_test": true,
"has_no_keywo... |
from ftpdata.models import Candidate, Committee
from summary_data.models import Candidate_Overlay, District, Committee_Overlay
from fec_alerts.models import newCommittee, f1filer
from summary_data.utils.term_reference import get_election_year_from_term_class, get_term_class_from_election_year
from summary_data.utils.pa... | {
"repo_name": "sunlightlabs/read_FEC",
"path": "fecreader/summary_data/utils/overlay_utils.py",
"copies": "1",
"size": "11848",
"license": "bsd-3-clause",
"hash": -7563190967634687000,
"line_mean": 35.5709876543,
"line_max": 241,
"alpha_frac": 0.6190074274,
"autogenerated": false,
"ratio": 3.5859... |
from ftplib import FTP, error_perm, all_errors, error_temp
import io
import logging
from ..storage import Storage
logger = logging.getLogger(__name__)
class FTPStorage(Storage):
def __init__(self, root_dir='/historisation', host='localhost', username=None, password=None):
super(Storage, self).__init__()... | {
"repo_name": "opendatasoft/ods-cookbook",
"path": "historisation/historisation/storages/ftp.py",
"copies": "1",
"size": "2290",
"license": "mit",
"hash": 1338464288513369900,
"line_mean": 23.8913043478,
"line_max": 98,
"alpha_frac": 0.5323144105,
"autogenerated": false,
"ratio": 3.72964169381107... |
from ftplib import FTP, error_perm
import os
from os.path import dirname
import re
from transmat.util import do_it
LIST_RE = re.compile('^(\S+).*\s+(20\d\d|\d\d\:\d\d)\s(.*?)$')
class FTPSession(object):
"""An object representing a session with an FTP server.
This attempts to implement a robust session. ... | {
"repo_name": "cpressey/transmat",
"path": "src/transmat/remote.py",
"copies": "1",
"size": "6155",
"license": "unlicense",
"hash": -3599429425810284000,
"line_mean": 33.0055248619,
"line_max": 77,
"alpha_frac": 0.5127538587,
"autogenerated": false,
"ratio": 4.253628196268141,
"config_test": fa... |
from ftplib import FTP
from differ import DictDiffer
import settings
import pprint
import pickle
import os
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
def connectFtp(url, cwd, login, passwd):
ftp = FTP(url)
if login is not None and passwd is not None:
ftp.log... | {
"repo_name": "liusiqi43/diffftp",
"path": "run.py",
"copies": "1",
"size": "1931",
"license": "mit",
"hash": -1771974883195103200,
"line_mean": 27.3970588235,
"line_max": 116,
"alpha_frac": 0.5660279648,
"autogenerated": false,
"ratio": 3.562730627306273,
"config_test": false,
"has_no_keywor... |
from ftplib import FTP
from fnmatch import fnmatch
import paramiko
import netrc
month_dict = {'1': 'jan', '2': 'feb', '3': 'mar', '4': 'apr', '5': 'may',
'6': 'jun', '7': 'jul', '8': 'aug', '9': 'sep', '10': 'oct',
'11': 'nov', '12': 'dec'}
def get_last_svlbi_schedule(month, year, save_f... | {
"repo_name": "ipashchenko/watcher",
"path": "watcher/watcher.py",
"copies": "1",
"size": "1884",
"license": "mit",
"hash": 499657064305442240,
"line_mean": 28.4375,
"line_max": 76,
"alpha_frac": 0.5652866242,
"autogenerated": false,
"ratio": 3.3345132743362833,
"config_test": false,
"has_no_... |
from ftplib import FTP
from getpass import getpass
from os import path
host = input("Host > ")
port = 21
user = input("User for {}:{} > ".format(host, port))
password = getpass("Password for {} on {}:{} > ".format(user, host, port))
debuglevel = 1
def store(connection, *args):
"Store a file (opened in binary mod... | {
"repo_name": "Loodoor/Simple-command-line-FTP",
"path": "main.py",
"copies": "1",
"size": "3028",
"license": "mit",
"hash": 8714897396668212000,
"line_mean": 25.3304347826,
"line_max": 94,
"alpha_frac": 0.6215323646,
"autogenerated": false,
"ratio": 3.44874715261959,
"config_test": false,
"h... |
from ftplib import FTP
from iniclass import INI
import subprocess as sp
import os
class FTPclass():
def __init__(self):
self.ini = INI()
def DLLN(self,scripts,directorylinx):
ip = self.ini.Config('ip')
name = self.ini.Config('name')
ftp = FTP(ip)
ftp.login(name)
o... | {
"repo_name": "bandit145/PCsetup",
"path": "ftpclass.py",
"copies": "1",
"size": "2592",
"license": "mit",
"hash": 7515892738640259000,
"line_mean": 47,
"line_max": 300,
"alpha_frac": 0.5679012346,
"autogenerated": false,
"ratio": 4.140575079872204,
"config_test": false,
"has_no_keywords": fa... |
from ftplib import FTP
from tkinter import messagebox
import pymysql as mysql
import sqlite3 as sqlite
import os
def flag_write(mode, flag):
if flag == "ftp":
return open("settings.conf", mode)
elif flag == "pdf":
return open("pdf.conf", mode)
class SQLConfig:
def __init__(self, placeho... | {
"repo_name": "egeemirozkan/ProjectLib",
"path": "beacon.py",
"copies": "1",
"size": "3619",
"license": "mit",
"hash": 2254296624313650200,
"line_mean": 31.5090909091,
"line_max": 79,
"alpha_frac": 0.5998322148,
"autogenerated": false,
"ratio": 3.44177093358999,
"config_test": false,
"has_no_... |
from ftplib import FTP
from urllib.parse import urlparse
from io import BytesIO
class FtpClient:
def __init__(self, url):
self.parsed_url = urlparse(url)
def upload(self, content, filename):
with FTP() as ftp:
port = self.parsed_url.port or 21
ftp.connect(self.parsed_... | {
"repo_name": "g8os/grid",
"path": "pyclient/zeroos/orchestrator/sal/FtpClient.py",
"copies": "2",
"size": "1049",
"license": "apache-2.0",
"hash": -3382464499749958000,
"line_mean": 35.1724137931,
"line_max": 85,
"alpha_frac": 0.6110581506,
"autogenerated": false,
"ratio": 3.8566176470588234,
... |
from ftplib import FTP
from XenAPI import Session
import requests
from os import path, makedirs, remove
import time
###############################################
################ configuration ################
###############################################
# FTP
ftp_host = "localhost"
ftp_user = "anonymous"
ftp_pw... | {
"repo_name": "curcas/xenserver-backup",
"path": "backup.py",
"copies": "1",
"size": "3356",
"license": "mit",
"hash": -7415859415885226000,
"line_mean": 26.9666666667,
"line_max": 129,
"alpha_frac": 0.5870083433,
"autogenerated": false,
"ratio": 3.3260654112983152,
"config_test": false,
"has... |
from ftplib import FTP
import bs4
import calendar
import requests
import time
seconds_in_hour = 60 * 60
def get_list(url, greenwich_time):
r = requests.get(url)
soup = bs4.BeautifulSoup(r.text, "html.parser")
streams = []
for it in soup.find_all("span"):
if "data-broadcast-end" in it.attrs a... | {
"repo_name": "piotrbla/pyExamples",
"path": "getRio.py",
"copies": "1",
"size": "4982",
"license": "mit",
"hash": 1434672224573805800,
"line_mean": 34.5642857143,
"line_max": 209,
"alpha_frac": 0.5914842338,
"autogenerated": false,
"ratio": 3.0249088699878492,
"config_test": false,
"has_no_k... |
from ftplib import FTP
import csv
# Download the NASDAQ's list of stock symbols
def fetchNASDAQfile():
print "Fetching NASDAQ file..."
try:
ftp = FTP('ftp.nasdaqtrader.com')
ftp.login()
ftp.cwd('SymbolDirectory')
ftp.retrbinary('RETR nasdaqlisted.txt', open('nasdaqlisted.txt', '... | {
"repo_name": "trswany/topStocks",
"path": "stockList.py",
"copies": "1",
"size": "1045",
"license": "mit",
"hash": 7704432297151843000,
"line_mean": 30.6666666667,
"line_max": 85,
"alpha_frac": 0.64784689,
"autogenerated": false,
"ratio": 3.448844884488449,
"config_test": false,
"has_no_keyw... |
from ftplib import FTP
import ftplib
import settings as settings
import glob
import os
"""
Will deliver to the named HW ftp bucket.
## Gotchas
I noted that on one run with a large number of PDFs the upload speed
was very slow, might need to be investigated
# TODO - elife - imulvany - put in place a check to see t... | {
"repo_name": "gnott/elife-poa-xml-generation",
"path": "ftp_to_highwire.py",
"copies": "1",
"size": "1805",
"license": "mit",
"hash": 7951888752992876000,
"line_mean": 22.75,
"line_max": 96,
"alpha_frac": 0.6958448753,
"autogenerated": false,
"ratio": 2.959016393442623,
"config_test": false,
... |
from ftplib import FTP
import os
class FTPClient(object):
url = None
user = None
password = None
pasv = None
def __enter__(self):
self.ftp = FTP(self.url,self.user,self.password)
self.ftp.set_pasv(self.pasv)
return self
def __exit__(self,exc_type,exc_value,traceback):
... | {
"repo_name": "wilsonc86/gokart",
"path": "gokart/ftp.py",
"copies": "1",
"size": "1110",
"license": "apache-2.0",
"hash": 6852485512550168000,
"line_mean": 26.75,
"line_max": 93,
"alpha_frac": 0.572972973,
"autogenerated": false,
"ratio": 3.3433734939759034,
"config_test": false,
"has_no_key... |
from ftplib import FTP
import os
def getsize( ftp, filename ):
try:
ftp.sendcmd('TYPE i')
return( ftp.size( filename ) )
except:
return( -1 )
def listdir( ftp ):
filenames = []
try:
ftp.retrlines( 'NLST', filenames.append )
return( [ ( x, getsize( ftp, x ) ) for... | {
"repo_name": "wilkinsg/piweb",
"path": "ftp.py",
"copies": "1",
"size": "2119",
"license": "mit",
"hash": -3041397624167142400,
"line_mean": 27.6351351351,
"line_max": 107,
"alpha_frac": 0.5191127891,
"autogenerated": false,
"ratio": 3.8880733944954127,
"config_test": false,
"has_no_keywords... |
from ftplib import FTP
import popen2, time, sys
directory = sys.argv[1]
filename = sys.argv[2]
download_dir = sys.argv[3]
host = sys.argv[4]
size_ftp = sys.argv[5]
path_to_cvs = sys.argv[6]
'''this commands needs to be redirected to /dev/null or it won't work, also can't read out from this for debugging b/c process wi... | {
"repo_name": "deapplegate/wtgpipeline",
"path": "download_manager.py",
"copies": "1",
"size": "1950",
"license": "mit",
"hash": -8201728422261608000,
"line_mean": 32.0508474576,
"line_max": 139,
"alpha_frac": 0.5748717949,
"autogenerated": false,
"ratio": 3.2072368421052633,
"config_test": fal... |
from ftplib import FTP
import pprint
pp = pprint.PrettyPrinter(indent = 4)
def _munge_fields(s, the_dict):
fields = s.split('=')
if len(fields) == 1:
key = 'name'
value = fields[0]
else:
key = fields[0]
value = fields[1]
if key == 'size':
value = int(valu... | {
"repo_name": "paulhtremblay/boto_emr",
"path": "boto_emr/ftp_chunker.py",
"copies": "1",
"size": "1308",
"license": "mit",
"hash": -5170773513033123000,
"line_mean": 23.2222222222,
"line_max": 67,
"alpha_frac": 0.4816513761,
"autogenerated": false,
"ratio": 3.442105263157895,
"config_test": fa... |
from ftplib import FTP
import sys, os, os.path, operator
def upload(handle,filename):
f = open(filename,"rb")
(base,ext) = os.path.splitext(filename)
picext = ".bmp .jpg .jpeg .dib .tif .tiff .gif .png"
if(operator.contains(picext,ext)):
try:
handle.storbinary("STOR " + filename,f,1)
except Exception:
pr... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/521925_Python_FTP_Client/recipe-521925.py",
"copies": "1",
"size": "5592",
"license": "mit",
"hash": 4435415135911788500,
"line_mean": 26.96,
"line_max": 252,
"alpha_frac": 0.676323319,
"autogenerated": false,
"ratio": 3.0912106135986734,
... |
from ftplib import FTP
class ftp(FTP):
def __init__(self,host, user='', passwd=''):
super(ftp,self).__init__(host)
self.login(user=user, passwd=passwd)
def read_file(self, file):
class Reader:
def __init__(self):
pass
def __call__(self,s):
self.data = s
r = Reader()
self.retrbinary('RETR ... | {
"repo_name": "geekpradd/Zoe",
"path": "core.py",
"copies": "1",
"size": "2248",
"license": "mit",
"hash": -384871630325597000,
"line_mean": 25.1511627907,
"line_max": 93,
"alpha_frac": 0.606316726,
"autogenerated": false,
"ratio": 2.8857509627727858,
"config_test": false,
"has_no_keywords": ... |
from ftplib import FTP
class ftp(FTP):
def __init__(self,host, user='', passwd=''):
super(ftp,self).__init__(host)
self.login(user=user, passwd=passwd)
def read_file(self, file):
class Reader:
def __init__(self):
pass
def __call__(self,s):
self.data = s
r = Reader()
self.retrbinary('RETR '... | {
"repo_name": "Uxio0/PyFTP",
"path": "ftp.py",
"copies": "2",
"size": "1684",
"license": "mit",
"hash": -2296664120277303000,
"line_mean": 23.7794117647,
"line_max": 93,
"alpha_frac": 0.6086698337,
"autogenerated": false,
"ratio": 2.918544194107452,
"config_test": false,
"has_no_keywords": fa... |
from ftplib import FTP
"""
giFTP - Git commit to FTP upload made easy.
The MIT License (MIT)
Copyright (c) 2013 Eka Putra
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, in... | {
"repo_name": "ekaputra07/giFTP",
"path": "giftp/ftp_session.py",
"copies": "1",
"size": "5739",
"license": "mit",
"hash": -5926478426148148000,
"line_mean": 31.9827586207,
"line_max": 86,
"alpha_frac": 0.5957483882,
"autogenerated": false,
"ratio": 4.617055510860821,
"config_test": false,
"h... |
from ftp_parser import Parser
class Filer:
suffix_of_interest = '.hdr.sgml'
content = []
content_parsed = []
parser = Parser()
def __init__(self, cik, connection):
self.cik = str(int(cik))
self.connection = connection
self._go_to_directory()
def _go_to_directory(self)... | {
"repo_name": "bkj/ernest",
"path": "enrich/modules/filer.py",
"copies": "2",
"size": "1285",
"license": "apache-2.0",
"hash": 7516083619486281000,
"line_mean": 26.3404255319,
"line_max": 79,
"alpha_frac": 0.5813229572,
"autogenerated": false,
"ratio": 3.4823848238482387,
"config_test": false,
... |
from ftracer_script import *
## note the capture details file is
## warnings is needed to suppress errors from mousehook tracker
def fxn():
warnings.warn("depreciated", DeprecationWarning)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()
if __name__ == "__main__":
# this code al... | {
"repo_name": "mirageglobe/upp-tracker",
"path": "tracer/ftracer.py",
"copies": "1",
"size": "1412",
"license": "apache-2.0",
"hash": -7412879201999883000,
"line_mean": 27.26,
"line_max": 109,
"alpha_frac": 0.6529745042,
"autogenerated": false,
"ratio": 3.512437810945274,
"config_test": false,
... |
from ftracer_script import *
## note the capture details file is
## warnings is needed to suppress errors from mousehook tracker
## Function: This is the main script file which houses all the scripts
import sys
import pythoncom, pyHook
import win32con, win32com.client
import win32gui, win32api
import codecs
imp... | {
"repo_name": "mirageglobe/upp-tracker",
"path": "tracer/ftraceadvance.py",
"copies": "1",
"size": "6390",
"license": "apache-2.0",
"hash": -7871875556618615000,
"line_mean": 29.8695652174,
"line_max": 283,
"alpha_frac": 0.6511737089,
"autogenerated": false,
"ratio": 3.7855450236966823,
"config... |
from ftw import ruleset, http, errors
"""
This script assumes that default blocking action is 403
and sampling is one. It will send a know bad request
that is expected to be blocked. If sampling is on it
will only block a certain percentage. We send 1000
requests to verify this. In order to do this we must
also turn... | {
"repo_name": "SpiderLabs/OWASP-CRS-regressions",
"path": "utils/testSampling.py",
"copies": "3",
"size": "1532",
"license": "apache-2.0",
"hash": -399656757327182660,
"line_mean": 32.3260869565,
"line_max": 185,
"alpha_frac": 0.703002611,
"autogenerated": false,
"ratio": 2.9689922480620154,
"c... |
from ftw import ruleset, http, errors
"""
This script reads in a list of popular Useragents and checks to see if it triggers
It expects 403's to be returned for a rule firing
"""
def read_useragents(filename):
f = open(filename,'r')
useragents = [agent.strip() for agent in f.readlines()]
return useragents... | {
"repo_name": "csjperon/OWASP-CRS-regressions",
"path": "utils/testUserAgents.py",
"copies": "3",
"size": "1251",
"license": "apache-2.0",
"hash": 2691167147439547000,
"line_mean": 32.8108108108,
"line_max": 155,
"alpha_frac": 0.621902478,
"autogenerated": false,
"ratio": 3.371967654986523,
"co... |
from ftw import ruleset, logchecker, testrunner
import datetime
import pytest
import sys
import re
import os
def test_crs(ruleset, test, logchecker_obj):
runner = testrunner.TestRunner()
for stage in test.stages:
runner.run_stage(stage, logchecker_obj)
class FooLogChecker(logchecker.LogChecker):
... | {
"repo_name": "SpiderLabs/owasp-modsecurity-crs",
"path": "tests/regression/CRS_Tests.py",
"copies": "1",
"size": "2142",
"license": "apache-2.0",
"hash": -4453423894128167400,
"line_mean": 32.46875,
"line_max": 80,
"alpha_frac": 0.5308123249,
"autogenerated": false,
"ratio": 4.049149338374291,
... |
from ftw import ruleset, logchecker, testrunner
import pytest
import pdb
import sys
import re
import os
import ConfigParser
def test_crs(ruleset, test, logchecker_obj, destaddr):
runner = testrunner.TestRunner()
for stage in test.stages:
if destaddr is not None:
stage.input.dest_addr = dest... | {
"repo_name": "csjperon/OWASP-CRS-regressions",
"path": "CRS_Tests.py",
"copies": "1",
"size": "2040",
"license": "apache-2.0",
"hash": 6173164529445813000,
"line_mean": 33.5762711864,
"line_max": 112,
"alpha_frac": 0.5147058824,
"autogenerated": false,
"ratio": 3.849056603773585,
"config_test"... |
from ftw import ruleset, testrunner, http, errors
import pytest
import re
import random
import threading
def test_logcontains(ruleset, test):
runner = testrunner.TestRunner()
for stage in test.stages:
runner.run_stage(stage)
# Should return a test error because its searching before response
def test_s... | {
"repo_name": "fastly/ftw",
"path": "test/integration/test_htmlcontains.py",
"copies": "1",
"size": "1658",
"license": "apache-2.0",
"hash": 7240484422778786000,
"line_mean": 36.6818181818,
"line_max": 90,
"alpha_frac": 0.6954161641,
"autogenerated": false,
"ratio": 3.5732758620689653,
"config_... |
from ftwpy import FTW, FTW_F
from mutagen.mp3 import EasyMP3 as MP3
import re
import os
import sys
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == os.errno.EEXIST and os.path.isdir(path):
pass
else:
raise
class FTW_... | {
"repo_name": "ein-shved/libpyhon",
"path": "psp_playlist.py",
"copies": "1",
"size": "1474",
"license": "mit",
"hash": 3926481822880168000,
"line_mean": 25.8,
"line_max": 70,
"alpha_frac": 0.4966078697,
"autogenerated": false,
"ratio": 3.077244258872651,
"config_test": false,
"has_no_keyword... |
from fudge import Fake
from fudge.inspector import arg
from sqlalchemy.orm import exc
from belt.tests import patch
pypi_base_url = 'https://pypi.python.org/packages'
class TestPackageList(object):
def test_requests_package_data_from_pypi(self, dummy_request):
from belt.views import package_list
d... | {
"repo_name": "rob-b/belt",
"path": "belt/tests/views/test_package_list.py",
"copies": "1",
"size": "1538",
"license": "bsd-3-clause",
"hash": -288082528055928420,
"line_mean": 38.4358974359,
"line_max": 92,
"alpha_frac": 0.6079323797,
"autogenerated": false,
"ratio": 3.8163771712158807,
"confi... |
from fudge import Fake
from neomodel.exception import DoesNotExist
from .index import FakeIndex
from .relationship_manager import FakeCategoryRelation
INDEX_REGISTER = []
class FakeCategoryNode(object):
def __init__(self, index):
self.instance = FakeCategoryRelation(self, index.nodes)
def factory_reset... | {
"repo_name": "joealcorn/mock-neomodel",
"path": "mock_neomodel/core.py",
"copies": "1",
"size": "1493",
"license": "mit",
"hash": -7375430865013173000,
"line_mean": 25.1929824561,
"line_max": 70,
"alpha_frac": 0.6115204287,
"autogenerated": false,
"ratio": 3.8380462724935733,
"config_test": fa... |
from fuel.converters.ilsvrc2010 import IMAGE_TARS
from fuel.downloaders.base import default_downloader
def fill_subparser(subparser):
"""Sets up a subparser to download the ILSVRC2010 dataset files.
Note that you will need to use `--url-prefix` to download the
non-public files (namely, the TARs of images... | {
"repo_name": "aalmah/fuel",
"path": "fuel/downloaders/ilsvrc2010.py",
"copies": "10",
"size": "1513",
"license": "mit",
"hash": 4355386616024203000,
"line_mean": 39.8918918919,
"line_max": 79,
"alpha_frac": 0.6516853933,
"autogenerated": false,
"ratio": 3.8794871794871795,
"config_test": false... |
from fuel.converters.ilsvrc2012 import ALL_FILES
from fuel.downloaders.base import default_downloader
def fill_subparser(subparser):
"""Sets up a subparser to download the ILSVRC2012 dataset files.
Note that you will need to use `--url-prefix` to download the
non-public files (namely, the TARs of images)... | {
"repo_name": "mila-udem/fuel",
"path": "fuel/downloaders/ilsvrc2012.py",
"copies": "3",
"size": "1270",
"license": "mit",
"hash": 1200634227538630700,
"line_mean": 38.6875,
"line_max": 79,
"alpha_frac": 0.662992126,
"autogenerated": false,
"ratio": 4.276094276094276,
"config_test": false,
"h... |
from fuel.datasets.hdf5 import H5PYDataset
class H5PyMTDataset(H5PYDataset):
def __init__(self, target_source, **kwargs):
super(H5PyMTDataset, self).__init__(**kwargs)
self.open()
self._token_map_cache = {}
self.word2num = self.token_map(target_source)
self.num2word = {nu... | {
"repo_name": "rizar/actor-critic-public",
"path": "lvsr/datasets/mt.py",
"copies": "1",
"size": "1179",
"license": "mit",
"hash": 8212923724793673000,
"line_mean": 34.7272727273,
"line_max": 86,
"alpha_frac": 0.6089906701,
"autogenerated": false,
"ratio": 3.427325581395349,
"config_test": fals... |
from fuel.datasets import Dataset
from fuel.utils import do_not_pickle_attributes
@do_not_pickle_attributes('nodes')
class H5Dataset(Dataset):
"""An eder's H5PY dataset.
Parameters
----------
sources : tuple of strings
Sources which the dataset returns
start : int
Start index
... | {
"repo_name": "EderSantana/blocks_contrib",
"path": "datasets/h5py.py",
"copies": "1",
"size": "2034",
"license": "mit",
"hash": -5925280822021783000,
"line_mean": 30.78125,
"line_max": 74,
"alpha_frac": 0.5865290069,
"autogenerated": false,
"ratio": 3.941860465116279,
"config_test": false,
"... |
from fuel.datasets import Dataset
import numpy as np
import theano
floatX = theano.config.floatX
class Pylearn2Dataset(Dataset):
'''Pylearn2Dataset wraps a `pylearn2.dataset` object and adds only the
minimal `fuel` interface. An object of this class can be used as input to
`fuel.streams.DataStream`.
P... | {
"repo_name": "EderSantana/blocks_contrib",
"path": "pylearn2fuel/__init__.py",
"copies": "1",
"size": "3179",
"license": "mit",
"hash": -6869398699987569000,
"line_mean": 38.7375,
"line_max": 84,
"alpha_frac": 0.6086819755,
"autogenerated": false,
"ratio": 3.9539800995024876,
"config_test": fa... |
from fuel.datasets import H5PYDataset
from fuel.transformers.defaults import uint8_pixels_to_floatX
from fuel.utils import find_in_data_path
class CelebA(H5PYDataset):
"""The CelebFaces Attributes Dataset (CelebA) dataset.
CelebA is a large-scale face
attributes dataset with more than 200K celebrity imag... | {
"repo_name": "dribnet/fuel",
"path": "fuel/datasets/celeba.py",
"copies": "8",
"size": "1766",
"license": "mit",
"hash": 9131920495863321000,
"line_mean": 34.32,
"line_max": 72,
"alpha_frac": 0.6834654587,
"autogenerated": false,
"ratio": 3.9070796460176993,
"config_test": false,
"has_no_key... |
from fuel.downloaders.base import default_downloader
BASE_URL = 'https://people.cs.umass.edu/~marlin/data/'
FILENAME = 'caltech101_silhouettes_{}_split1.mat'
def silhouettes_downloader(size, **kwargs):
if size not in (16, 28):
raise ValueError("size must be 16 or 28")
actual_filename = FILENAME.for... | {
"repo_name": "udibr/fuel",
"path": "fuel/downloaders/caltech101_silhouettes.py",
"copies": "15",
"size": "1165",
"license": "mit",
"hash": -8469283536065501000,
"line_mean": 30.4864864865,
"line_max": 72,
"alpha_frac": 0.6815450644,
"autogenerated": false,
"ratio": 3.4064327485380117,
"config_... |
from fuel.schemes import IterationScheme
import sqlite3
import random
import os
from picklable_itertools import iter_
import data
first_time = 1372636853
last_time = 1404172787
class TaxiTimeCutScheme(IterationScheme):
def __init__(self, num_cuts=100, dbfile=None, use_cuts=None):
self.num_cuts = num_cuts
... | {
"repo_name": "Saumya-Suvarna/machine-learning",
"path": "Route_prediction/data/cut.py",
"copies": "1",
"size": "1044",
"license": "apache-2.0",
"hash": -6309165706530802000,
"line_mean": 36.2857142857,
"line_max": 105,
"alpha_frac": 0.5708812261,
"autogenerated": false,
"ratio": 3.6,
"config_t... |
from FuelSDK.rest import ET_CUDSupportRest
########
##
## wrap an Exact Target Push Message
##
########
class ET_PushMessage(ET_CUDSupportRest):
def __init__(self):
super(ET_PushMessage, self).__init__()
self.endpoint = 'https://www.exacttargetapis.com/push/v1/message/{id}'
self.urlProps ... | {
"repo_name": "tzmfreedom/et-cli",
"path": "etcli/et_objects.py",
"copies": "1",
"size": "1432",
"license": "mit",
"hash": 5225243001491860000,
"line_mean": 28.8333333333,
"line_max": 113,
"alpha_frac": 0.6361731844,
"autogenerated": false,
"ratio": 3.450602409638554,
"config_test": false,
"h... |
from fuel.streams import AbstractDataStream
from fuel.iterator import DataIterator
import numpy as np
import theano
class IMAGENET(AbstractDataStream):
"""
A fuel DataStream for imagenet data
from fuel:
A data stream is an iterable stream of examples/minibatches. It shares
similarities with Python ... | {
"repo_name": "Sohl-Dickstein/Diffusion-Probabilistic-Models",
"path": "imagenet_data.py",
"copies": "2",
"size": "3663",
"license": "mit",
"hash": 7059201344131353000,
"line_mean": 30.0508474576,
"line_max": 139,
"alpha_frac": 0.5995085995,
"autogenerated": false,
"ratio": 3.8356020942408375,
... |
from fuel.transformers import Mapping
import numpy
import logging
from matplotlib.mlab import specgram
def log_spectrogram(signal):
return numpy.log(specgram(signal)[0].T)
logger = logging.getLogger(__name__)
class Normalization(object):
def __init__(self, data_stream, source):
index = data_stream... | {
"repo_name": "nke001/attention-lvcsr",
"path": "lvsr/preprocessing.py",
"copies": "3",
"size": "1559",
"license": "mit",
"hash": 7081670229342429000,
"line_mean": 27.8703703704,
"line_max": 83,
"alpha_frac": 0.6100064144,
"autogenerated": false,
"ratio": 3.8975,
"config_test": false,
"has_no... |
from fuel.transformers import Transformer
import numpy as np
class DropSources(Transformer):
"""Drops some sources from a stream
Parameters
----------
data_stream : :class:`DataStream` or :class:`Transformer`.
The data stream.
sources: list
A list of sources to drop
"""
def ... | {
"repo_name": "lukemetz/MLFun",
"path": "IMDB/transformers.py",
"copies": "1",
"size": "1119",
"license": "mit",
"hash": 5175895396965176000,
"line_mean": 31.9117647059,
"line_max": 89,
"alpha_frac": 0.5933869526,
"autogenerated": false,
"ratio": 4.083941605839416,
"config_test": false,
"has_... |
from fuel.transformers import Transformer
class DropSources(Transformer):
"""Drops some sources from a stream
Parameters
----------
data_stream : :class:`DataStream` or :class:`Transformer`.
The data stream.
sources: list
A list of sources to drop
"""
def __init__(self, da... | {
"repo_name": "lukemetz/cuboid",
"path": "cuboid/transformers.py",
"copies": "1",
"size": "1122",
"license": "mit",
"hash": 8197580196244888000,
"line_mean": 31.0571428571,
"line_max": 73,
"alpha_frac": 0.5748663102,
"autogenerated": false,
"ratio": 4.186567164179104,
"config_test": false,
"h... |
from fuel.transformers import Transformer
class NGrams(Transformer):
"""Return n-grams from a stream.
This data stream wrapper takes as an input a data stream outputting
sentences. From these sentences n-grams of a fixed order (e.g. bigrams,
trigrams, etc.) are extracted and returned. It also creates... | {
"repo_name": "nke001/attention-lvcsr",
"path": "libs/fuel/fuel/transformers/text.py",
"copies": "8",
"size": "1696",
"license": "mit",
"hash": 3376102955260386000,
"line_mean": 38.4418604651,
"line_max": 75,
"alpha_frac": 0.6491745283,
"autogenerated": false,
"ratio": 4,
"config_test": false,
... |
from fuel.transformers import Transformer
class Window(Transformer):
"""Return pairs of source and target windows from a stream.
This data stream wrapper takes as an input a data stream outputting
sequences of potentially varying lengths (e.g. sentences, audio tracks,
etc.). It then returns two slidi... | {
"repo_name": "udibr/fuel",
"path": "fuel/transformers/sequences.py",
"copies": "7",
"size": "4963",
"license": "mit",
"hash": 1376859687782830000,
"line_mean": 39.3495934959,
"line_max": 78,
"alpha_frac": 0.6258311505,
"autogenerated": false,
"ratio": 4.3006932409012135,
"config_test": false,
... |
from .fuelux_widget import FuelUxWidget
# from .. import utils
class Pillbox(FuelUxWidget):
"""
Widget for FuelUX's pillbox.
See http://getfuelux.com/javascript.html#pillbox.
Possible attributes:
- auto_init (boolean)
- whether to add 'data-initialize="pillbox"'
- id (string)
- it... | {
"repo_name": "jneuendorf/what-should-i-eat",
"path": "fuelux_widgets/widgets/pillbox.py",
"copies": "1",
"size": "1948",
"license": "mit",
"hash": 924874416910955800,
"line_mean": 28.9692307692,
"line_max": 73,
"alpha_frac": 0.5703285421,
"autogenerated": false,
"ratio": 4.075313807531381,
"co... |
from fulcrum.api import Client
from fulcrum.api.endpoints import (Forms, Records, Webhooks, Photos,
Memberships, Roles, ChoiceLists, Signatures,
ClassificationSets, Projects, Videos, Audio,
Changesets, ChildRecords,... | {
"repo_name": "fulcrumapp/fulcrum-python",
"path": "fulcrum/__init__.py",
"copies": "1",
"size": "2872",
"license": "apache-2.0",
"hash": -4832148072024034000,
"line_mean": 36.7894736842,
"line_max": 79,
"alpha_frac": 0.6058495822,
"autogenerated": false,
"ratio": 3.8191489361702127,
"config_te... |
from fulcrum.mixins import Findable, Deleteable, Createable, Searchable, Updateable, Media, Track, MediaCreateable
from . import BaseAPI
class Forms(BaseAPI, Findable, Deleteable, Createable, Searchable, Updateable):
path = 'forms'
def history(self, id, url_params=None):
api_resp = api_resp = sel... | {
"repo_name": "fulcrumapp/fulcrum-python",
"path": "fulcrum/api/endpoints.py",
"copies": "1",
"size": "3490",
"license": "apache-2.0",
"hash": -2294210087985207000,
"line_mean": 29.0862068966,
"line_max": 117,
"alpha_frac": 0.6532951289,
"autogenerated": false,
"ratio": 3.51460221550856,
"confi... |
from fulcrum.utils import is_string, generate_uuid
class Findable(object):
def find(self, id):
api_resp = self.client.call('get', '{0}/{1}'.format(self.path, id))
return api_resp
class Deleteable(object):
def delete(self, id):
self.client.call('delete', '{0}/{1}'.format(self.path, id)... | {
"repo_name": "fulcrumapp/fulcrum-python",
"path": "fulcrum/mixins.py",
"copies": "1",
"size": "2611",
"license": "apache-2.0",
"hash": 8030780666054748000,
"line_mean": 31.2345679012,
"line_max": 137,
"alpha_frac": 0.5878973573,
"autogenerated": false,
"ratio": 3.504697986577181,
"config_test"... |
from .FullScreenEffectClass import FullScreenEffect
from ..backends.RenderTargetBase import attachmentTypeEnum, renderTextureTypeEnum
from ..backends.base_backend import CompilationError, BaseBackend
from glaze.GL import glDetachShader
class FSEManager(object):
class states(object):
disable = 0
... | {
"repo_name": "jr-garcia/Engendro3D",
"path": "e3d/fse_management/FSEManagerClass.py",
"copies": "1",
"size": "8694",
"license": "mit",
"hash": -2044046759900511200,
"line_mean": 37.2995594714,
"line_max": 117,
"alpha_frac": 0.5393374741,
"autogenerated": false,
"ratio": 4.171785028790787,
"con... |
from fumblerooski.college.models import College
from fumblerooski.utils import *
from fumblerooski.scrapers.games import game_updater
def full_load(year, week):
"""
Given a year and week, performs a full load of games including all player and game stats.
>>> full_load(2010, 13)
"""
game_updater(yea... | {
"repo_name": "dwillis/fumblerooski",
"path": "scrapers/main.py",
"copies": "1",
"size": "1327",
"license": "bsd-3-clause",
"hash": 3042847344331374000,
"line_mean": 34.8648648649,
"line_max": 113,
"alpha_frac": 0.6887716654,
"autogenerated": false,
"ratio": 3.276543209876543,
"config_test": fa... |
from funcat import *
from string import punctuation
import sys
NGram = alias("N-Gram", ListOf(String))
@typed (Integer, String, NGram)
def ngrams(n, text):
"Produces the ngrams in a text given n"
tokens = reduce(lambda t, p: t.replace(p, ''), punctuation, text).split(' ')
return flat_map(lambda t: [t[i:i+n] for... | {
"repo_name": "zsck/NLPHomework",
"path": "Assignment1/tcomp1.py",
"copies": "2",
"size": "1771",
"license": "mit",
"hash": 2488503596082323500,
"line_mean": 33.0576923077,
"line_max": 87,
"alpha_frac": 0.6346696781,
"autogenerated": false,
"ratio": 2.9128289473684212,
"config_test": false,
"... |
from funcat import *
import sys
punctuation = "!'\"'()?:;,."
Index = alias("Index", Dictionary(String, ListOf(Integer)))
Occurrence = alias("Occurence", TupleOf(String, Integer))
@typed (Index, Occurrence, Index)
def add_index(index, occur):
"Append an entry into an index mapping a word to the list of lines the wor... | {
"repo_name": "zsck/NLPHomework",
"path": "Assignment1/index1.py",
"copies": "2",
"size": "1467",
"license": "mit",
"hash": 3078730080886201300,
"line_mean": 30.8913043478,
"line_max": 90,
"alpha_frac": 0.6591683708,
"autogenerated": false,
"ratio": 3.2171052631578947,
"config_test": false,
"... |
from funcat import *
import sys
@typed (String, SetOf(String))
def words(text):
"Produce a set of words contained in a text"
return set(filter(lambda s: len(s) > 0, text.replace('\n', ' ').split(' ')))
@typed (SetOf(String), Integer)
def num_words(words):
"Compute the number of words in the list of words provid... | {
"repo_name": "zsck/NLPHomework",
"path": "Assignment1/tcomp2.py",
"copies": "2",
"size": "1209",
"license": "mit",
"hash": -5556095163100945000,
"line_mean": 27.7857142857,
"line_max": 82,
"alpha_frac": 0.6426799007,
"autogenerated": false,
"ratio": 2.9559902200489,
"config_test": false,
"ha... |
from FuncDef import FuncDef
class FuncTable:
"""Store a function table"""
def __init__(self, base_name):
self.funcs = []
self.base_name = base_name
self.bias_map = {}
self.name_map = {}
self.max_bias = 0
def get_base_name(self):
return self.base_name
def get_funcs(self):
retur... | {
"repo_name": "alpine9000/amiga_examples",
"path": "tools/external/amitools/amitools/fd/FuncTable.py",
"copies": "1",
"size": "1159",
"license": "bsd-2-clause",
"hash": -1382948756755592000,
"line_mean": 20.0727272727,
"line_max": 38,
"alpha_frac": 0.5970664366,
"autogenerated": false,
"ratio": 3... |
from func import *
class Jugador(pygame.sprite.Sprite):
# Atributos
# velocidad del jugador
vel_x = 0
vel_y = 0
imaged=[]
imagei=[]
# Lista de elementos con los cuales chocar
nivel = None
def __init__(self):
pygame.sprite.Sprite.__init__(self)
# creamos el bloque
... | {
"repo_name": "jdiegoh3/gameproyect_pygame",
"path": "objetos.py",
"copies": "1",
"size": "25087",
"license": "mit",
"hash": 7179060580074756000,
"line_mean": 29.743872549,
"line_max": 140,
"alpha_frac": 0.531510344,
"autogenerated": false,
"ratio": 3.2015058703420114,
"config_test": false,
"... |
from func import *
startbuild = datetime.datetime.now()
nest.ResetKernel()
nest.SetKernelStatus({'overwrite_files': True,
'local_num_threads': 4,
'resolution': 0.1})
logger = logging.getLogger('neuromodulation')
logger.debug("* * * Building layers")
build_model(GlobalColu... | {
"repo_name": "research-team/robot-dream",
"path": "direct_translation/scripts/step_1 (columns+dopa)/neuromodulation.py",
"copies": "1",
"size": "9698",
"license": "mit",
"hash": -6550723429476623000,
"line_mean": 42.6846846847,
"line_max": 112,
"alpha_frac": 0.6827180862,
"autogenerated": false,
... |
from func import *
class SoftmaxActiveFn():
def __init__(self):
pass
@staticmethod
def forward(Z):
expY = np.exp(Z)
expYshape = np.copy(Z.shape)
expYshape[-1] = 1
Y = expY / np.sum(expY, axis=-1).reshape(expYshape).repeat(Z.shape[-1], axis=-1)
re... | {
"repo_name": "renmengye/imageqa-public",
"path": "src/nn/active_func.py",
"copies": "1",
"size": "1470",
"license": "mit",
"hash": -5120825137008048000,
"line_mean": 18.4166666667,
"line_max": 88,
"alpha_frac": 0.5034013605,
"autogenerated": false,
"ratio": 3.442622950819672,
"config_test": fa... |
from .func import XClass
def test_XClass():
X = XClass()
class A():
x = 'a'
assert (X == 'A')('A')
assert ('A' == X)('A')
assert (X.x.call('upper') == 'A')(A())
assert ((X.call('lower').upper)('a'))() == 'A'
assert (X[0][1] == 2)([(1, 2), (3, 4)])
assert (X + 2 + 3 == 6)(1)
... | {
"repo_name": "aymazon/functools-ex",
"path": "functoolsex/tests.py",
"copies": "1",
"size": "2487",
"license": "mit",
"hash": -8848559449395613000,
"line_mean": 26.3296703297,
"line_max": 50,
"alpha_frac": 0.3634901488,
"autogenerated": false,
"ratio": 2.386756238003839,
"config_test": false,
... |
from funcparserlib import parser as fp
from globibot.lib.helpers import parsing as p
class Value:
def __init__(self, unit, value):
self.unit = unit
self.value = value
def __add__(self, other):
assert(type(self.unit) is type(other.unit))
n1 = increase_max(self)
n2 = in... | {
"repo_name": "best-coloc-ever/globibot",
"path": "bot/plugins/utils/units.py",
"copies": "1",
"size": "6097",
"license": "mit",
"hash": -6573832254576999000,
"line_mean": 22.6240310078,
"line_max": 65,
"alpha_frac": 0.5937653815,
"autogenerated": false,
"ratio": 2.9190613026819925,
"config_tes... |
from funcparserlib.lexer import make_tokenizer
from funcparserlib import parser as p
from collections import namedtuple
from re import DOTALL
class TokenType:
Space = 'SPACE'
Integer = 'INTEGER'
Float = 'FLOAT'
Mention = 'MENTION'
Channel = 'CHANNEL'
Emoji = 'EMOJI'
Snippet = 'SNIPPET'
... | {
"repo_name": "best-coloc-ever/globibot",
"path": "bot/src/globibot/lib/helpers/parsing.py",
"copies": "1",
"size": "4706",
"license": "mit",
"hash": -1776550524899081200,
"line_mean": 31.2328767123,
"line_max": 97,
"alpha_frac": 0.5796855079,
"autogenerated": false,
"ratio": 3.210095497953615,
... |
from func_prototypes.util import dictjoin
from functools import partial, wraps
try:
from inspect import getfullargspec as inspector
except ImportError:
from inspect import getargspec as inspector # Python 2 fallback.
"""
Adapts args, kwargs into **kwargs only with help of function prototype.
Prototype should ... | {
"repo_name": "andrewguy9/func_prototypes",
"path": "func_prototypes/__init__.py",
"copies": "1",
"size": "3510",
"license": "mit",
"hash": 2623010867424563000,
"line_mean": 31.8037383178,
"line_max": 104,
"alpha_frac": 0.6743589744,
"autogenerated": false,
"ratio": 3.7580299785867237,
"config_... |
from .func_resolver import Library
from .context import Context
class CodeGenerator:
'''
The code generator for PhenoWL DSL
'''
def __init__(self):
self.context = Context()
self.code = ''
self.imports = set()
self.indent = 0
def get_params(self, expr):
v = [... | {
"repo_name": "mainulhossain/phenoproc",
"path": "app/biowl/dsl/pygen.py",
"copies": "1",
"size": "9425",
"license": "mit",
"hash": 9199486036215626000,
"line_mean": 30.6275167785,
"line_max": 126,
"alpha_frac": 0.4913527851,
"autogenerated": false,
"ratio": 3.6989795918367347,
"config_test": f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.